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
397 stars 107 forks source link

Setting `expiry` on LimitOrderRequest #125

Closed trevorwelch closed 6 years ago

trevorwelch commented 6 years ago

Hi all,

I'm trying to figure out how to place an expiry date on all the limit orders I place.

Has anyone had any luck with this? I don't see anything in the documentation about it.

Thanks for your reply.

hootnot commented 6 years ago

Hi,

All documentation on the V20 REST API is found on developer.oanda.com. The oandapyV20 library supports all parameters you find in the docs.

So, regarding your specfic question: http://developer.oanda.com/rest-live-v20/order-df/#OrderRequest gives details on order requests.

You should use timeInForce and set it to GTD and you pass gtdTime with a date assigned when you want it to expire.

take a look at: http://oanda-api-v20.readthedocs.io/en/latest/contrib/orders/limitorderrequest.html

it shows an example with the defaults. So just change the 2 parameters and it is done.

hootnot commented 6 years ago

Hi,

I've added some examples to the jupyter notebooks: https://github.com/hootnot/oanda-api-v20/blob/master/jupyter/orders.ipynb.

It covers: