-
Notifications
You must be signed in to change notification settings - Fork 1
Project Description
A ticker service that provides quotes for <fiat>/DASH pair(s). Initially only the USD/DASH pair will be supported by combining a ticker service that provides USD/BTC quotes and another that provides BTC/DASH quotes. Extending this to other <fiat>/DASH pairs would require a service to provide other <fiat>/BTC pairs.
A single route must be implemented under v1/ticker/USD_DASH and return data in JSON format. The returned data must contain at a minimum the following fields:
-
bid(integer representing USD cents) -
ask(integer representing USD cents) -
updatetime(unix timestamp regarding when this quote was defined) -
marketset toUSD_DASH.
In the future this may be extended to list bid and ask for different transaction sizes, which must then be implemented under v2/ticker/USD_DASH.
- Use the small level returned from
https://api.coinapult.com/api/tickeras the USD/BTC rate; - Use the lowestAsk and highestBid returned from
https://poloniex.com/public?command=returnTickerunder the key "BTC_DASH" for the BTC/DASH rate; - Combine the tickers to produce a USD/DASH rate;
- Convert the results to integers representing USD cents and return that.
Both Coinapult and Poloniex support websocket for listening to ticker changes, the preference is to use that instead of polling these services to get the latest rates (but if that is not reliable, or if it's easier during initial testing, polling may be used). The latest rates must be cached by the server so clients consulting the API get an immediate, and accurate, reply. If the rate is too old the server may refuse to answer client.
At least this initial implementation will be done in Python. The API will use Flask with gunicorn and deployed with nginx in front of it; multiple servers may be deployed and load balanced if the demand is high enough. There will be one process for each service that is polled or that uses a websocket client (that is one process will be consulting Coinapult, another one will be consulting Poloniex), and the caching will be done using redis. Therefore at least three services will be executing: API server, Coinapult listener, Poloniex listener. To start/stop/restart automatically and log these, supervisor will be used.