You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: