PeterMalkin / oandapybot

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

Issue with running main.py #5

Closed andy-thomas-83 closed 8 years ago

andy-thomas-83 commented 8 years ago

Hey,

I have been running some back testing and was ready to test a few strategies but am having some problems using the main.py. When I try to execute it I get:

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 811, in *bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 764, in run self.__target(_self.__args, _self.__kwargs) File "/home/andy/Oanada/oandapybot/exchange/oanda.py", line 44, in _start self.start(accountId=self._account_id,instruments=self._instrument,ignore_heartbeat=False) File "/home/andy/Oanada/oandapybot/exchange/oandapy.py", line 315, in start data = json.loads(line.decode("utf-8")) File "/usr/lib64/python2.7/json/__init**.py", line 338, in loads return _default_decoder.decode(s) File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python2.7/json/decoder.py", line 381, in raw_decode obj, end = self.scan_once(s, idx) ValueError: Expecting object: line 1 column 1 (char 0)

Which I guess means its not getting any data back from OANDA. I am using a practice account and have set my AccountID, Access Token and Environment.

Any help would be greatly appreciated.

andy-thomas-83 commented 8 years ago

I was trying to a use a v20 API account, requested a legacy account, updated the API code and its working perfectly.

PeterMalkin commented 8 years ago

Good it works now!

Let me know if you want to do backtesting - I can share some historical data with you

andy-thomas-83 commented 8 years ago

Hi Peter,

I have been downloading data from HistData and been running some testing. Looking at the code it was using OHLC's and I have been able to test combinations of 1 to 100, on a 1 minute candle chart in SMA for EURUSD for last month.

I have nearly finished back testing the strongest pairs for the last year. I have started trading in a practice account now with the updated strategy and hoping to do more back testing over the weekend.

Many thanks for coming back to me,

Cheers,

Andy