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

Issue with market orders #102

Closed fx007 closed 7 years ago

fx007 commented 7 years ago

Hi I'm a python beginner trying to issue some oanda orders with python. I'm stuck and would like some further illustration:

from exampleauth import exampleAuth
+ 
r = orders.OrderCreate(accountID, data=mktOrder.data)

1) my question is: what should i do with the first part? What should I replace it with for it to work?

2) Do I have to replace accountID in the second part with my oanda login?

I tried reading the thread with the same question but couldn't figure this problem out.

Thanks

hootnot commented 7 years ago

@fx007 Hi,

You provide very limited information regarding where you are stuck: 2 lines of code is not much to go on.

The examples repo provides a marketorders example: https://github.com/hootnot/oandapyV20-examples/blob/master/src/market_orders.py.

The README.rst of the oanda-api-v20 repo also shows in detail how to place a market order.

Since you ask what to do with accountID I guess you need to read the documentation and possibly some code. The exampleAuth class reads both the token and the accountID from the configfiles token.txt and account.txt. So that is where you need to enter this information. Please make sure you have a V20 token and accountID. Within an hour the FX-markets are opening. Trying to place a marketorder before opening will return a V20 error.

All the examples should work out of the box. So, please try them out, study those, make changes as you like them. ... and check the Jupyter notebooks.

Good luck!

fx007 commented 7 years ago

Thank you!! It's working now and I issued my first order ^^^

hootnot commented 6 years ago

http://oanda-api-v20.readthedocs.io/en/latest/contrib/orders.html

2017-10-08 23:53 GMT+02:00 fx007 notifications@github.com:

Say for example I would like to create limit orders, i.e. activate trade when price reaches a certain area, how to do it? is there a tutorial explaining somewhere?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/hootnot/oanda-api-v20/issues/102#issuecomment-335041439, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQ6bdGucn2osJ787nBn1CeK5-nnaawFks5sqURhgaJpZM4Px00c .

-- Feite Brekeveld

feitebrekeveld https://nl.linkedin.com/in/feitebrekeveld @feite_brekeveld https://twitter.com/feite_brekeveld github https://github.com/hootnot