Comments (8)
Hello @eurekawild,
What's the best way of reproducing the issue? Do we have to wait an hour?
from ccxt.
Hello @eurekawild,
What's the best way of reproducing the issue? Do we have to wait an hour?
I dont have a best way. In my program, the same code for Binance is well. Maybe something is wrong in OKX, like the frequency limit etc. Now I restart my program per one hour, It's OK for me.
from ccxt.
async def symbol_loop(ex, symbol, timeframe):
try:
await ex.watch_ohlcv(symbol, timeframe)
except Exception as e:
traceback.print_exc()
return
cur_ohlcvs = await ex.fetch_ohlcv(symbol, timeframe, None,100)
while True:
latest_ohlcvs = ex.ohlcvs[symbol][timeframe]
for ohlcv in latest_ohlcvs:
last_ohlcv = cur_ohlcvs[-1]
if ohlcv[0] > last_ohlcv[0]:
cur_ohlcvs.append(ohlcv)
cur_ohlcvs.pop(0)
elif ohlcv[0] == last_ohlcv[0]:
cur_ohlcvs[-1] = ohlcv
print("cur ohlcvs:", cur_ohlcvs)
await ex.sleep(5000)
This is the core code in my production environment. I just call the func watch_ohlcv() once, the func fetch_ohlcv() once. in the loop I just visit the ohlcv cache in ex. So I think it is not my code problem, and also not the question of the frequency limit. The code is simple and clear, but the ohlcvs stoped updating after the code runing an hour or two. So something is wrong in the func watch_ohlcv() in OKX exchange in my opinion.
from ccxt.
I can confirm the same. I am trying OKX watchOrderbook and it doesn't work but the same code for Bybit works. Version 4.3.11
Example code:
const exchange = new pro.okx({
"enableRateLimit": true,
"apiKey": okexApiKey,
"secret": okexSecret,
"password": okexPass,
});
watchOrderBooks(exchange, ["BTC-USDT-SWAP","ETH-USDT-SWAP"])
async function watchOrderBooks(exchange, perpSymbols) {
while (true) {
try {
for (const symbol of perpSymbols) {
console.log("Symbol: "+ symbol)
const orderbook = await exchange.watchOrderBook(symbol, 50)
}
} catch (e) {
logger.error (e.message)
}
}
}
If you run this code, the ETH-USDT-SWAP never console.logs.
from ccxt.
Also, when i am trying the same code without apikey i am getting okx requires "apiKey" credential. Does the OKX needs API keys for public orderbooks? By the way, it works on 4.1.11 version
from ccxt.
Hi @makarid , for the apiKey error you can set the params.depth to 'books' and that should fix it. I also opened a PR to default to it
from ccxt.
Hi @makarid , I believe I found the problem, I think your api keys don't have VIP4 permission to use the depth channel books50-l2-tbt
and the library wasn't throwing the error correctly so it appeared to be "stuck"
I opened one PR to default to the public channel and another to properly throw the error in this event. In the meantime the code should work if you use the depth channel books
from ccxt.
Thank you very much @pcriadoperez !
from ccxt.
Related Issues (20)
- Can't not fetch leverage with binace HOT 5
- Biance watch_ticker response value is None HOT 11
- Binance Portfolio Margin `timeInForce` option `PO` results in no TIF parameter in new order (UM) request HOT 7
- Bitget order subscription duplication. C# HOT 6
- Subscription does not receive any result. C# HOT 4
- Move event handler map from exchange.handle_message to an exchange instance variable HOT 3
- python ccxt fetch_ohlcv on kraken doesnt honor since parameter HOT 9
- Bitget error OHLCV for delivery futures HOT 5
- Coinbase trades pagination cursor HOT 9
- MEXC InvalidNonce HOT 1
- Bitget - increase speed limit on createOrder HOT 1
- add safetrade exchange
- New Exchange Request: BTCC
- CCXT.Pro watchOrders sending incorrect order events
- Bitmart error fetching tickers HOT 2
- Revert exchange name "Coinbase Advanced" back to "Coinbase" for backward compatibility... HOT 4
- kraken fetch_ohlcv since parameter broken HOT 3
- request poloniex private api show 400 Bad Request HOT 4
- Coinbase: Implementing fetch_trading_fees? HOT 5
- ccxt pro bingX watchTrades in swap market return empty list in python HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ccxt.