Allows to load markets data from disk
For debugging purposes would be convenient to load data not from the real exchange but from the prepared json file.
Usage:
const binance = ccxt.binance()
await binance.fetchMarkets(reload, {loadMarketsFromDisk: './path/to/binance.loadMarkets.json'})
what about setting manually:
binance.setMarkets ( your_markets_obj_obtained_from_cache );
side-note: re-creating instance and re-loading markets might be a sign of incorrect implementation of userland app. you typically have to instantiate the exchange instance & load markets once and then reuse that instance for a longer time.
side-note: re-creating instance and re-loading markets might be a sign of incorrect implementation of userland app. you typically have to instantiate the exchange instance & load markets once and then reuse that instance for a longer time.
Hi, @ttodua, thanks for your reply. First, the market data is very-very slow-changeable stuff, and I don't think the cache has to be refreshed more than 1 time per day. I've managed some exchanges, and they really do not change a lot of time. Second, I'm In an attempt to write tooling, based on a couple of scripts, running from the shell command. The markets will be copied via the environment variable, which means a great boost ever by compare to reading/parsing data from the disk
what about setting manually:
binance.setMarkets ( your_markets_obj_obtained_from_cache );
yes, one of the obvious solutions. I have made this, because was not sure any exchange does not require more steps to process internal structure. If you could confirm, that there is no additional step for that - this is very good :-) One thing more, I see now only with possible rate limits, the issue with rate limits could be also resolved via additional parameters as well. But currently, I want to gather statistics about possible pit-stops and then try to find a solution
I'll upload an example of how it can be done. shortly, yeah, setMarkets can be what you want.
Hi guys! Please, also check the existing examples here:
- https://github.com/ccxt/ccxt/blob/master/examples/js/load-markets-to-files.js
- https://github.com/ccxt/ccxt/blob/master/examples/js/shared-load-markets.js
The above examples might not be a complete solution, but they show how markets could be saved, loaded and reset from json structures. We'd like to keep CCXT utilitarian, meaning that fs i/o should not be a part of the library (we have a browser-only version of the lib), so we won't include fs things into the core of the lib (as that is beyond the scope of the lib), but that functionality can be easily added on top as discussed in this draft.