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

Fix: Replace ccxt.loadMarkets() with the IExchange.loadMarkets() wrapper to cache markets across exchange instances #13

Open
bludnic opened this issue Apr 30, 2024 · 0 comments

Comments

@bludnic
Copy link
Owner

bludnic commented Apr 30, 2024

This will probably not work. The second exchange will load markets from the exchange and not the database.

import { exchanges, cache } from '@opentrader/exchanges'
import { PrismaCacheProvider } from '@opentrader/exchanges/server'

cache.setCacheProvider(new PrismaCacheProvider())

const exchange1 = exchanges.OKX()
await exchange1.loadMarkets() // from cache

const exchange2 = exchanges.OKX()
await exchange2.fetchTicker('BTC/USDT') // will call `ccxt.loadMarkets()`
@bludnic bludnic changed the title Fix: Replace ccxt.loadMarkets() with the IExchange.loadMarkets() wrapper to cache markets across exchange instances Fix: Replace ccxt.loadMarkets() with the IExchange.loadMarkets() wrapper to cache markets across exchange instances Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant