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

param for openTrade #146

Closed haegwan closed 5 years ago

haegwan commented 5 years ago

Hello,

After reading the doc and Oanda doc (https://developer.oanda.com/rest-live-v20/trade-ep/) it seems you cannot param filter by openTrade time?

something like below

params = { "state":"CLOSED", 'to': '2019-06-25T08:00:00Z', 'from': '2019-06-01T00:00:00Z', }

I'd like to get closed orders in a speicif date range to analyze performance. Also checked up transaction endpoint but seems it has no answer neither.

Thanks!

hootnot commented 5 years ago

Hi,

the /v3/accounts{accountID}/trades/ endpoint allows queries by id and a list of ids.

I don't know how you designed your code, but every time you place an order you get a response holding the transaction ID also. So, you could pass a list of the ids you have (in case you save these)

The way I do it: It is pretty easy to download all transactions with a few lines of code. Then load it in Pandas from a Jupyter notebook. Pandas offers you all the manipulation you want and will save you a huge amount of time.