ccxt: Bybit - RateLimitExceeded error on fetchPositions() function

Operating System

Ubuntu

Programming Languages

JavaScript

CCXT Version

4.2.8

Description

When trying to call fetchPositions() asynchronously with bybit in Node.js, I get a 10006 error (which I assume is due to rate limits). Below you could find my example code and some example output. I don’t have this when running the same code for another exchange like Binance.

Code

const exchange = new ccxt.bybit ({
'apiKey': '...',
'secret': '...',
'enableRateLimit': true,
});

try {
const [openOrdersResponse, positionResponse, testResp] = await Promise.all([
exchange.fetchOpenOrders(),
exchange.fetchPositions(),
exchange.fetchOrders(req.body.symbol),
]);
res.json({ success: true });
} catch (error) {
console.log('viewOrders error', error);
const errorResponse = { error: error.message };
}

Code

RateLimitExceeded: bybit {"retCode":10006,"retMsg":"Too many visits. Exceeded the API Rate Limit.","result":{},"retExtInfo":{},"time":1704663597201}

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

@pastanorm I opened a pull request that should resolve this RateLimitExceeded error for you

As for your other question, binance is the only exchange that has support for fetchPositionsRisk which has the same values in it’s parser as fetchPositions and fetchPosition, so I would recommend using either fetchPosition or fetchPositions instead

@Dan-krm , do you have any ideas?

It looks like it might be triggered from fetchCurrencies because the response is showing this 'X-Bapi-Limit-Status': '0' for the fetchCurrencies endpoint, I’ll do some more testing and let you know

Hello @pastanorm, thanks for reporting it, we will take a look at it.