[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Bitvavo editOrderWs deadlock #24188

Closed
apollace opened this issue Nov 6, 2024 · 16 comments
Closed

Bitvavo editOrderWs deadlock #24188

apollace opened this issue Nov 6, 2024 · 16 comments
Assignees
Labels

Comments

@apollace
Copy link
apollace commented Nov 6, 2024

Operating System

Debian 12

Programming Languages

JavaScript

CCXT Version

4.4.27

Description

Calling multiple times editOrderWs reliably generates a deadlock.

I tried to debug but I did not really understood the reason behind the deadlock.

Everything looks fine while debugging, the watch function inside looks ok, the state looks ok, there are no pending futures inside the client of the Exchange class but at the end of the watch function the result is a deadlock.

Can someone help me understanding what is going on?

Code

  (async () => {
    const bitvavo = new ccxt.pro.bitvavo({
        apiKey: apiKey,
        secret: apiSecret,
    });;
    const order = await bitvavo.createOrderWs('GRASS/EUR', 'limit', 'buy', 10, 1);
    await new Promise(resolve => setTimeout(resolve, 2000));
    const editedOrder = await bitvavo.editOrderWs(order.id, 'GRASS/EUR', 'limit', 'buy', 10, 0.98);
    await new Promise(resolve => setTimeout(resolve, 2000));

    // << Here now it will be stuck
    const editedOrder2 = await bitvavo.editOrderWs(editedOrder.id, 'GRASS/EUR', 'limit', 'buy', 10, 0.97); 
    await new Promise(resolve => setTimeout(resolve, 2000));
    await bitvavo.cancelOrderWs(editedOrder2.id, 'GRASS/EUR');
})();

@carlosmiei
Copy link
Collaborator

Hello @apollace,

Thanks for reporting it. We will take a look and get back to you.

@apollace
Copy link
Author
apollace commented Nov 8, 2024

Hello @carlosmiei, thanks, if you find anything I would be happy to see what was the issue in the PR 👍

@carlosmiei
Copy link
Collaborator

@apollace Managed to reproduce the issue on my end, working on a fix right now.

@carlosmiei
Copy link
Collaborator

@apollace can you please upgrade your ccxt version and try again? It should be working as expected now.

@apollace
Copy link
Author

Thanks I will have a look this afternoon

@apollace
Copy link
Author

Thanks for the fix, unluckily the client order id is not returned in the response in case of rejection. this makes the order stuck in case of rejection.

from the doc page (https://docs.bitvavo.com/#tag/Frequently-asked-questions/Trading):

Q: I've started working on connecting to Bitvavo and found out that rejection messages for the orders do not have any
information about which order was rejected. I subscribed for 'account' channel, and it doesn't have any rejection messages:

{
"action": "privateCreateOrder",
"market": "BTC-EUR",
"errorCode": 216,
"error": "You do not have sufficient balance to complete this operation."
}
There is no way to distinguish orders in WebSocket. Is it possible to add clientOrderId to rejection messages?

A: You can add a requestId to their request to trace the order.

@apollace
Copy link
Author
apollace commented Nov 12, 2024

In addition the version 4.4.29 broke the rest API

@carlosmiei
Copy link
Collaborator

@apollace I will check this, I wasn't aware of the requestId, that would make things much easier.

In addition the version 4.4.29 broke the rest API

@apollace Can you elaborate a bit more here please?

@carlosmiei
Copy link
Collaborator

@apollace I tried adding a requestId/id but as you can see the value is not returned

connecting to wss://ws.bitvavo.com/v2
2024-11-16T10:32:25.227Z onUpgrade
2024-11-16T10:32:25.228Z onOpen
2024-11-16T10:32:25.229Z sending {
  action: 'authenticate',
  key: '6ddbc7adbe112e98db39381e3358779ac735931e170acc65ac56f7d47daebd70',
  signature: '389a1022a455f9de9a44ba2b40c0dbe456e793da43e469eb185317464ca27fc1',
  timestamp: 1731753145027
}
2024-11-16T10:32:25.303Z onMessage { event: 'authenticate', authenticated: true }
2024-11-16T10:32:25.305Z sending {
  market: 'BTC-EUR',
  action: 'privateGetOrdersOpen',
  requestId: '17317531453043618'
}
2024-11-16T10:32:25.377Z onMessage { action: 'privateGetOrdersOpen', response: [] }
2024-11-16T10:32:25.379Z iteration 0 passed in 352 ms

[]

@carlosmiei
Copy link
Collaborator

@apollace Oh Ok it needs to be an int:

nMessage { event: 'authenticate', authenticated: true }
2024-11-16T10:34:16.941Z sending {
  market: 'BTC-EUR',
  action: 'privateGetOrdersOpen',
  requestId: 17317532569411208
}
2024-11-16T10:34:17.021Z onMessage {
  action: 'privateGetOrdersOpen',
  requestId: '17317532569411208',
  response: []
}

@carlosmiei
Copy link
Collaborator

@apollace Ok found the issue with the clientorderId as well, going to fix that too

@apollace
Copy link
Author

@carlosmiei Sorry for the late response, I missed you comments.
I will test and let you know how it goes. Thanks for the help :)

I will ask to improve the doc because it doesn't look to be clear enough.

@carlosmiei
Copy link
Collaborator

@apollace We haven't released yet, but we will do shortly

@carlosmiei
Copy link
Collaborator

@apollace We just released a new version 4.4.32. Can you please upgrade and try again?

@apollace
Copy link
Author

@carlosmiei Seems to work, I will let you know if I see more issues

@apollace
Copy link
Author

@carlosmiei I can confirm that this issue is not present anymore. Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants