ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
31.86k stars 7.36k forks source link

Regarding Update #22781 #22885

Open BingBong1234567898765321 opened 4 days ago

BingBong1234567898765321 commented 4 days ago

Operating System

Windows 11 - PythonAnywhere.com

Programming Languages

Python

CCXT Version

4.3.98

Description

Hello @carlosmiei , in regards to the change #22781, when I run this:

            order_details = exchange.fetch_orders('id' == new_order_id, symbol = 'BTC/USDT:USDT')
            print(f"ORDER DETAILS: {order_details}")
            open_order_status = order_details['status']
            print(f"open order status: {open_order_status}")

I am getting this error:

New ID: c7608d93-1c3d-470e-92b1-0074c837e5c3 June 24, 2024 at 10:18 PM: Opening long at BTC price: $61238.5 Error in fetching order status: phemex.fetch_orders() got multiple values for argument 'symbol' Exception found in new order ID: phemex.fetch_orders() got multiple values for argument 'symbol'

Could you please assist in troubleshooting why the fetch_orders command for USDT-settled pair 'BTC/USDT:USDT' is returning this error?

Please and thank you,

Code

                 order_details = exchange.fetch_orders('id' == new_order_id, symbol = 'BTC/USDT:USDT')
                print(f"ORDER DETAILS: {order_details}")
                open_order_status = order_details['status']
                print(f"open order status: {open_order_status}") 
carlosmiei commented 3 days ago

Hello @BingBong1234567898765321,

exchange.fetch_orders('id' == new_order_id, symbol = 'BTC/USDT:USDT')

this call is invalid, fetch_orders does not accept an id, only symbol/since/limit/params

As you can see, if properly invoked it works fine

p phemex fetchOrders "BTC/USDT:USDT" --sand
box
Python v3.12.3
CCXT v4.3.51
phemex.fetchOrders(BTC/USDT:USDT)
[{'amount': 0.01,
  'average': 68356.5,
  'clientOrderId': 'c24b393',
  'cost': 683.565,
  'datetime': '2024-05-20T17:14:35.379Z',
  'fee': {'cost': '0.410139', 'currency': 'USDT'},
  'fees': [{'cost': 0.410139, 'currency': 'USDT'}],
  'filled': 0.01,
  'id': 'c24b3938-90ea-41a7-b516-b0f30bab6590',
  'info': {'actionBy': '5',
           'avgTransactPriceRp': None,
           'bizError': '0',
           'clOrdId': 'c24b393',
           'createdAt': '1716225275379',
           'cumValueRv': '683.565',
           'execFeeRv': '0.410139',
           'execPriceRp': '68356.5',
           'execQtyRq': '0.01',
           'execStatus': '7',
           'leavesQtyRq': '0',
           'leavesValueRv': '0',
           'ordStatus': '7',
           'ordType': '1',
           'orderDetailsVos': None,
           'orderId': 'c24b3938-90ea-41a7-b516-b0f30bab6590',
           'orderQtyRq': '0.01',
           'orderValueRv': '683.565',
           'posSide': '1',
           'priceRp': '51267.3',
           'side': '2',
           'stopDirection': '0',
           'stopPxRp': '0',
           'symbol': 'BTCUSDT',
           'totalPnlRv': None,
           'tradeType': '1',
           'trigger': '0',
           'updatedAt': '1716225275384'},
  'lastTradeTimestamp': None,
BingBong1234567898765321 commented 3 days ago

@carlosmiei Is it possible to add 'id' as an argument? I'm using this functionality immediately after submitting a limit order, and trying to determine if the order is still open or closed.

Also, I see 'ordStatus' = 7, what do the different order status numbers mean? With the USD command of fetch_order_status, I was able to fetch 'open', 'closed', or 'canceled' while identifying the specific 'id' in the params.

carlosmiei commented 3 days ago

@BingBong1234567898765321 No it's not possible to add id because the endpoint does not support it.

You can provide ordStatus in params upon using fetch_orders, but you have to follow the exchange's terminology, in this case: image

BingBong1234567898765321 commented 2 days ago

@carlosmiei How do I make sure that I am pulling the ordStatus of the order that was just created rather than pulling all ordStatus for every order I've ever submitted? Can I somehow specify the order ID without including 'id' in the params?

Thank you,

-Bing Bong

BingBong1234567898765321 commented 2 days ago

@carlosmiei And can you confirm whether the values associated with the ordStatus (5,7, etc.) are strings or floats?