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

subtle bug in order structure for "create_order" for "krakenfutures", the fields amount, filled and remaining are incorrect #23469

Closed
reinhardullrich opened this issue Aug 19, 2024 · 2 comments
Assignees
Labels

Comments

@reinhardullrich
Copy link

reinhardullrich commented Aug 19, 2024

Operating System

Ubuntu 22.04

Programming Languages

Python

CCXT Version

4.3.75

Description

i executed a market order for 0.01 BTC which hit three orders in the orderbook, two for 0.0001 BTC and one for 0.0098.
the order structure i received from "create_order" (the asnycio version!) shows 0.0098 BTC for 'amount, 0.0102 BTC for 'filled' and -0.0002 BTC for 'remaing'.
see the code below, it is a real execution from my logfiles.
i tried to analyze the (python) sourcecode for krakenfutures, but i dont understand ccxt enough yet to fully understand what "parse_order" is doing....
thank you very much!

Code

{'amount': 0.0098,
 'average': 58717.93,
 'clientOrderId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
 'cost': 598.922886,
 'datetime': '2024-08-19T13:16:29.639Z',
 'fee': None,
 'fees': [],
 'filled': 0.0102,
 'id': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
 'info': {'cliOrdId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
          'orderEvents': [{'amount': '0.0001',
                           'executionId': '08789e54-d8de-4736-8041-0421bdaf99cf',
                           'orderPriorEdit': None,
                           'orderPriorExecution': {'cliOrdId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
                                                   'filled': '0',
                                                   'lastUpdateTimestamp': '2024-08-19T13:16:29.639Z',
                                                   'limitPrice': '59301.00',
                                                   'orderId': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
                                                   'quantity': '0.01',
                                                   'reduceOnly': False,
                                                   'side': 'buy',
                                                   'symbol': 'PF_XBTUSD',
                                                   'timestamp': '2024-08-19T13:16:29.639Z',
                                                   'type': 'ioc'},
                           'price': '58714',
                           'takerReducedQuantity': None,
                           'type': 'EXECUTION'},
                          {'amount': '0.0001',
                           'executionId': '97d3261e-cb8a-4a53-9215-b1cb79a3f959',
                           'orderPriorEdit': None,
                           'orderPriorExecution': {'cliOrdId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
                                                   'filled': '0.0001',
                                                   'lastUpdateTimestamp': '2024-08-19T13:16:29.639Z',
                                                   'limitPrice': '59301.00',
                                                   'orderId': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
                                                   'quantity': '0.0099',
                                                   'reduceOnly': False,
                                                   'side': 'buy',
                                                   'symbol': 'PF_XBTUSD',
                                                   'timestamp': '2024-08-19T13:16:29.639Z',
                                                   'type': 'ioc'},
                           'price': '58715',
                           'takerReducedQuantity': None,
                           'type': 'EXECUTION'},
                          {'amount': '0.0098',
                           'executionId': '3bdc8c29-cc8f-4166-bf30-d570330a8d59',
                           'orderPriorEdit': None,
                           'orderPriorExecution': {'cliOrdId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
                                                   'filled': '0.0002',
                                                   'lastUpdateTimestamp': '2024-08-19T13:16:29.639Z',
                                                   'limitPrice': '59301.00',
                                                   'orderId': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
                                                   'quantity': '0.0098',
                                                   'reduceOnly': False,
                                                   'side': 'buy',
                                                   'symbol': 'PF_XBTUSD',
                                                   'timestamp': '2024-08-19T13:16:29.639Z',
                                                   'type': 'ioc'},
                           'price': '58718',
                           'takerReducedQuantity': None,
                           'type': 'EXECUTION'}],
          'order_id': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
          'receivedTime': '2024-08-19T13:16:29.639Z',
          'status': 'placed'},
 'lastTradeTimestamp': None,
 'lastUpdateTimestamp': None,
 'postOnly': False,
 'price': 59301.0,
 'reduceOnly': False,
 'remaining': -0.0002,
 'side': 'buy',
 'status': 'closed',
 'stopLossPrice': None,
 'stopPrice': None,
 'symbol': 'BTC/USD:USD',
 'takeProfitPrice': None,
 'timeInForce': 'ioc',
 'timestamp': 1724073389639,
 'trades': [{'amount': 0.0001,
             'cost': 5.8714,
             'datetime': None,
             'fee': {'cost': None},
             'fees': [],
             'id': '08789e54-d8de-4736-8041-0421bdaf99cf',
             'info': {'amount': '0.0001',
                      'executionId': '08789e54-d8de-4736-8041-0421bdaf99cf',
                      'orderPriorEdit': None,
                      'orderPriorExecution': {'cliOrdId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
                                              'filled': '0',
                                              'lastUpdateTimestamp': '2024-08-19T13:16:29.639Z',
                                              'limitPrice': '59301.00',
                                              'orderId': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
                                              'quantity': '0.01',
                                              'reduceOnly': False,
                                              'side': 'buy',
                                              'symbol': 'PF_XBTUSD',
                                              'timestamp': '2024-08-19T13:16:29.639Z',
                                              'type': 'ioc'},
                      'price': '58714',
                      'takerReducedQuantity': None,
                      'type': 'EXECUTION'},
             'order': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
             'price': 58714.0,
             'side': 'buy',
             'symbol': 'BTC/USD:USD',
             'takerOrMaker': None,
             'timestamp': None,
             'type': 'market'},
            {'amount': 0.0098,
             'cost': 575.4364,
             'datetime': None,
             'fee': {'cost': None},
             'fees': [],
             'id': '3bdc8c29-cc8f-4166-bf30-d570330a8d59',
             'info': {'amount': '0.0098',
                      'executionId': '3bdc8c29-cc8f-4166-bf30-d570330a8d59',
                      'orderPriorEdit': None,
                      'orderPriorExecution': {'cliOrdId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
                                              'filled': '0.0002',
                                              'lastUpdateTimestamp': '2024-08-19T13:16:29.639Z',
                                              'limitPrice': '59301.00',
                                              'orderId': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
                                              'quantity': '0.0098',
                                              'reduceOnly': False,
                                              'side': 'buy',
                                              'symbol': 'PF_XBTUSD',
                                              'timestamp': '2024-08-19T13:16:29.639Z',
                                              'type': 'ioc'},
                      'price': '58718',
                      'takerReducedQuantity': None,
                      'type': 'EXECUTION'},
             'order': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
             'price': 58718.0,
             'side': 'buy',
             'symbol': 'BTC/USD:USD',
             'takerOrMaker': None,
             'timestamp': None,
             'type': 'market'},
            {'amount': 0.0001,
             'cost': 5.8715,
             'datetime': None,
             'fee': {'cost': None},
             'fees': [],
             'id': '97d3261e-cb8a-4a53-9215-b1cb79a3f959',
             'info': {'amount': '0.0001',
                      'executionId': '97d3261e-cb8a-4a53-9215-b1cb79a3f959',
                      'orderPriorEdit': None,
                      'orderPriorExecution': {'cliOrdId': '029db5a9-02aa-4586-ad2c-31ef0991ae00',
                                              'filled': '0.0001',
                                              'lastUpdateTimestamp': '2024-08-19T13:16:29.639Z',
                                              'limitPrice': '59301.00',
                                              'orderId': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
                                              'quantity': '0.0099',
                                              'reduceOnly': False,
                                              'side': 'buy',
                                              'symbol': 'PF_XBTUSD',
                                              'timestamp': '2024-08-19T13:16:29.639Z',
                                              'type': 'ioc'},
                      'price': '58715',
                      'takerReducedQuantity': None,
                      'type': 'EXECUTION'},
             'order': 'e7a24021-e2e5-49e5-8470-09819ed785d0',
             'price': 58715.0,
             'side': 'buy',
             'symbol': 'BTC/USD:USD',
             'takerOrMaker': None,
             'timestamp': None,
             'type': 'market'}],
 'triggerPrice': None,
 'type': 'market'}``
@reinhardullrich reinhardullrich changed the title subtle but in order structure for "create_order" for "krakenfutures", the fields amount, filled and remaining are incorrect subtle bug in order structure for "create_order" for "krakenfutures", the fields amount, filled and remaining are incorrect Aug 19, 2024
@sc0Vu sc0Vu self-assigned this Aug 20, 2024
@sc0Vu sc0Vu added the bug label Aug 20, 2024
@sc0Vu
Copy link
Contributor

sc0Vu commented Aug 20, 2024

@reinhardullrich Thanks for the report, we'll fix this asap.

@sc0Vu
Copy link
Contributor

sc0Vu commented Aug 27, 2024

@reinhardullrich We've published the fix. Could you upgrade CCXT and test it? Let us know if you encounter any issues.

@sc0Vu sc0Vu closed this as completed Aug 27, 2024
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

2 participants