You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have made a simple test, using the kraken client. I just wanted to see how long ccxt took to download an order because it seemed to me that it was taking too long. So I measured the time it takes to fetch an order after a call to both loadMarkets and fetchClosedOrders and ccxt takes 3 seconds to execute fetchOrder (not counting the other seconds to execute those two prior calls to loadMarkets and fetchClosedOrders).
But if I'm understanding correctly how ccxt works, the orders should already have been downloaded from the fetchClosedOrders call. Indeed if I swap the fetchOrder call in the code below with an array search, it takes 1 ms instead of 3000 ms because the order I am looking for is indeed already in the array but it looks like it is being downloaded again.
Or is the fetchOrder call intended to download it again, even if it is a closed order that is not going to change anymore?
Even so, comparing it to my own implementation which takes less than 100 ms, three seconds seem way too much.
Am I doing something wrong or is there an underlying issue? Thanks in advance.
Code
this.#ccxtClient = new ccxt[accountSettings.type]({
apiKey: accountSettings.publicKey,
secret: accountSettings.privateKey,
});
// [...]
var orderId = 'xxxxx-...';
await this.#ccxtClient.loadMarkets();
var orders = await this.#ccxtClient.fetchClosedOrders(undefined, undefined, 100);
var now = Date.now();
var order = await this.#ccxtClient.fetchOrder(orderId);
// if I replace the above line with this next one, the code outputs "1 ms" because the order is already in that array.
//var order = orders.find((o) => o.id === orderId);
console.log(order.id);
var elapsed = Date.now() - now;
App.warning(`Took: ${elapsed} ms`);
now = Date.now();
// #krakenClient is my own implementation
order = await this.#krakenClient.queryOrder(orderId);
elapsed = Date.now() - now;
console.log(order.txid);
App.warning(`Took: ${elapsed} ms`);
Output:
xxxxx-...
Took: 3109 ms
xxxxx-...
Took: 65 ms
The text was updated successfully, but these errors were encountered:
Operating System
Windows 11
Programming Languages
JavaScript
CCXT Version
4.3.1
Description
I have made a simple test, using the kraken client. I just wanted to see how long ccxt took to download an order because it seemed to me that it was taking too long. So I measured the time it takes to fetch an order after a call to both
loadMarkets
andfetchClosedOrders
and ccxt takes 3 seconds to execute fetchOrder (not counting the other seconds to execute those two prior calls toloadMarkets
andfetchClosedOrders
).But if I'm understanding correctly how ccxt works, the orders should already have been downloaded from the
fetchClosedOrders
call. Indeed if I swap the fetchOrder call in the code below with an array search, it takes 1 ms instead of 3000 ms because the order I am looking for is indeed already in the array but it looks like it is being downloaded again.Or is the
fetchOrder
call intended to download it again, even if it is a closed order that is not going to change anymore?Even so, comparing it to my own implementation which takes less than 100 ms, three seconds seem way too much.
Am I doing something wrong or is there an underlying issue? Thanks in advance.
Code
Output:
The text was updated successfully, but these errors were encountered: