PeterMalkin / oandapybot

Simple python bot for trading forex on oanda.com
MIT License
167 stars 61 forks source link

Debugging #3

Closed murtagh1 closed 8 years ago

murtagh1 commented 8 years ago

I am very VERY new to messing with anything more advanced that using matlab to do matrix equations. I got this bot from jonromero on here but even using others, like yours, I get the same message. The token and ID that used are indeed the correct ones with my account. Please help! Btw, thank you for uploading this to begin with!

Trace back message

ubuntu@ubuntu:~/Downloads/forex_algotrading-master/post3$ python runner.py ------ System online ------- 2016-09-16 21:53:13.002630 Buy at 1.11532 Traceback (most recent call last): File "runner.py", line 29, in main() File "runner.py", line 23, in main type='market') File "/home/ubuntu/Downloads/forex_algotrading-master/post3/oandapy.py", line 73, in create_order return self.request(endpoint, "POST", params=params) File "/home/ubuntu/Downloads/forex_algotrading-master/post3/oandapy.py", line 262, in request raise OandaError(content) oandapy.OandaError: OANDA API returned error code 4 (The access token provided does not allow this request to be made)

PeterMalkin commented 8 years ago

Hey there murtagh1!

Thanks for your interest in my bot.

The problem looks like is not with the code, but with your access parameters.

If you are trading live, make sure you put the following into the settings.py:

# This is your sub-account id. Create at using oanda.com.
# Log into oanda, select "fxtrade", provide your login and password.
# Then click "Add Sub-Account", it will create one. Put its number here:
ACCOUNT_ID = "77777" 

# Now create the access token. Under "My services" click "Manage API access"
# Create access token. Put it in the line below
ACCESS_TOKEN = "doodc52952aa493aa2b74a7dfea4007-b9d2623902992f8772df937131facbc6"

# This means you are trading with real money
ENVIRONMENT = "live"

If you want to paper trade, You need to change settings.py to have the following: ENVIRONMENT = "practice"

Make sure you follow similar steps as above to create the token and account#, but login to "fxtrade practice" first.

murtagh1 commented 8 years ago

Thank you, I think that got me closer.. I still get an error code when trying to pip install the requirements.txt file you have, I have looked around and didn't find anything that worked on the internet. Thank you so much for helping!

ubuntu@ubuntu:~/Downloads/oandapybot-master$ pip install requirements.txt Collecting requirements.txt Could not find a version that satisfies the requirement requirements.txt (from versions: ) No matching distribution found for requirements.txt

PeterMalkin commented 8 years ago

Well, that's just basic Python infrastructure. If you cant install requirements or pip - dont worry. Just open the text file and install the requirements one by one.

If you have further questions, it may be easier to connect over email. http://pastebin.com/wide2meQ

murtagh1 commented 8 years ago

I've got it running now! Thank you! Now to figure out how/where to code more complex strategy.. lol