Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement percentage based alerts #8

Open
AlexITC opened this issue Feb 10, 2018 · 0 comments
Open

Implement percentage based alerts #8

AlexITC opened this issue Feb 10, 2018 · 0 comments
Labels

Comments

@AlexITC
Copy link
Owner

AlexITC commented Feb 10, 2018

We have support for fixed price alerts, which is triggering an alert when a price condition is reached.

This needs the user to give us the price that he is interested in, it is common to compute a percentage manually based on the current price, with this we can get an alert when a currency increased by certain percentage but it is tedious to compute that by ourselves.

In order to simplify this process, we could ask the user to enter a percentage and the price condition and we can compute the fixed price related to the percentage, what is stopping us to add this to the UI is the need to know the current price of the currency.

There are some possible approaches to get the current price:

Call the exchange API from the client

While this has several advantages, like avoiding useless traffic in our server, not all exchanges have Cross-Origin Resource Sharing (CORS) enabled which makes this option harder.

To avoid requiring CORS enabled in the exchanges, we could use nginx the proxy the API calls to the exchanges.

As all exchanges have different API behavior, we would need to implement the logic for every exchange on the client which could be a significant amount of maintenance cost (and code).

Exchange-agnostic API

As we already call the exchanges from our server, we could generate consistent responses for any exchange, this would be the preferred approach which lead us to design a way for retrieving the prices.

Proxy traffic to the exchanges

This is similar to the nginx approach and we could get scaling issues due to rate limits from the exchanges which could be quite bad for us.

Keep the prices in-memory

We could keep the prices in-memory and keep a scheduled job to update the prices frequently, at the moment we keep track of less than 1500 currencies and even adding support for Coinmarketcap would keep the number below 5000, which should not be a problem to store them in-memory.

Using this approach would help us to redesign the tasks sending the alerts to not call the exchanges directly but to use our stored prices, also, we could remove the schedulers for these tasks and use listeners that get notified when the prices are updated, this should avoid us to send repeated requests to the exchanges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant