hootnot / oanda-api-v20

OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
MIT License
402 stars 107 forks source link

question for feit #204

Closed traveller1011 closed 1 year ago

traveller1011 commented 1 year ago

Feit,

Writing an issue as I am not sure where to scope a general question (and you answered me before in this format).

I am running into an issue and I wonder if you have any comment. I am actually directly tapping Oanda Endpoint directly in this case (so technically this library is not involved, but i suspect you will know the answer regardless)

The issue is...

  1. I place a market order by submitting a POST request to this endpoint: /v3/accounts/<OANDA_ACCOUNT_ID>/orders.

  2. I get a successful response, including the oanda_id's for the newly created Order and Trade.

  3. Moments later, i query this endpoint /v3/accounts/<OANDA_ACCOUNT_ID>/orders/<OANDA_ORDER_ID> (or the Trade one) and pass the oanda ID i got back from the oanda response.

  4. For a brief period of time - maybe 0.25-0.50 seconds, i get back this response {'lastTransactionID': '1168', 'errorMessage': 'The order ID specified does not exist', 'errorCode': 'NO_SUCH_ORDER'}......

  5. After retrying a few times, the error goes away and I get a clean response.

Is it normal to have to use exponential backoff approach--- is this something you contended with building the oanda-api-v20 package?

Any insights greatly appreciated,

Mark

hootnot commented 1 year ago

And the orderspec looks like ?

It looks like you try to query for an order that already is executed and therefore you get a NO_SUCH_ORDER response

But retrying should consistently give that response.

So, please show the code and orderspec, otherwise it is all guess work.