Closed traveller1011 closed 1 year ago
Make sure you enter a limit order. Market orders will get executed directly and therefore not show up in the orderlist since that one does PENDING by default.
So, in your case, without specifying params, you only will see PENDING orders, and there will be none if you only issue MARKET orders.
I've just entered a limit sell EUR_JPY @145 and it gives me:
{
"orders": [
{
"id": "387093",
"createTime": "2023-01-06T08:28:04.607826616Z",
"type": "LIMIT",
"instrument": "EUR_JPY",
"units": "-500000",
"timeInForce": "GTD",
"price": "145.000",
"gtdTime": "2023-01-13T08:27:48.000000000Z",
"triggerCondition": "DEFAULT",
"partialFill": "DEFAULT_FILL",
"positionFill": "DEFAULT",
"state": "PENDING"
}
],
"lastTransactionID": "387093"
}
In your case you need to pass:
params = {"state": "FILLED"}
Or use the definitions: oandapyV20.definitions.orders
import oandapyV20.definitions.orders as od
...
params = {"state": od.OrderState.FILLED}
... and then your MARKET orders will show up.
hootnot,
question about the orders in
import oandapyV20.endpoints.orders as orders
Context
i seem to NOT get a complete list of orders back. and i cannot figure out why.
... i get a healthy, but empty, response:
{'orders': [], 'lastTransactionID': '89'}
the Oanda endpoint in question is here:
https://developer.oanda.com/rest-live-v20/order-ep/
How I have been getting Orders in the interim
So I queried for Transactions list, which worked great. Then, from transactions, i deduced a list of order IDs that "must" exist. And queried for order details by individual pk.. You can see some orders here:
... But i want to query a list of my orders directly, instead of approaching it from the backdoor. I think I am just missing something dumb.
Question/Ask
Do you see where I might have gone wrong? If you just give me an inkling of idea, it would be appreciated. Also - i really love this package. And the style of code. Thank you for publishing this.