KomodoPlatform / komodo-wallet-mobile

KomodoWallet Mobile codebase
https://komodoplatform.com
MIT License
25 stars 35 forks source link

Candlestick charting #27

Open smk762 opened 1 year ago

smk762 commented 1 year ago

The prior endpoint used for this via cryptowatch is no longer functioning as it once did, and the cost of credits vs the frequency of our requests is suboptimal. I'll scout alternatives an post them here for discussion.

It the private repo, Tony mentioned potentially using widgets - we did this in desktop app for basic charts, first TradingView, then Nomics (no longer active), now Livecoinwatch.

IMO if https://www.tradingview.com/widget/advanced-chart/ can be used it seems the best option (at least until I find something else better for the same price of zero).

cipig commented 1 year ago

afaik tradingview only supports specific pairs on specific exchanges, so they don't have eg a VRSC/KMD chart and you need to define the exact exchange and pair like here: https://github.com/KomodoPlatform/atomicDEX-Desktop/blob/dev/atomic_defi_design/Dex/Constants/General.qml#L2362

CharlVS commented 1 year ago

@smk762 for mobile, it's not critical to have live rates, so it's acceptable for the data to be a bit stale, especially on less-used pairs.

What do you think about the following?

Use Coingecko's free plan (or minimal credits) with a new caching layer to take full advantage of the 10-30 requests per minute limit to eagerly cache as often as the limit allows eagerly. E.g. Prioritise 80% of the API requests to the top 50% most requested pairs. Then the remaining 20% of API requests would go to whichever pairs have the oldest data.

smk762 commented 11 months ago

I've had a look at replacing the cryptowat candles api data with the kraken equivalent, but it is lacking many pairs and timeframes. The url we used for cryptowat was for binance markets (https://github.com/KomodoPlatform/CexPricesEndpoint/blob/master/cex_prices_endpoint/http/http_routes.go#L7) so I figured checking the source, and it looks like a better alternative.

The way their rate limits work is IP based tho, so if I create a proxy it will have less coverage before throttling than if the request is made client side. There is also a websocket stream which I think might be the best option (client side)

rest: https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data ws: https://binance-docs.github.io/apidocs/spot/en/#trade-streams Once we add Binance API ids for coins and pairs to https://github.com/KomodoPlatform/coins/tree/master/api_ids this would allow faster streamed data with more coverage than before.