Oh no, not another python backtester...

pysystemtrade seems to be a very interesting project and on eof the very few using IB native Python API. Great work. I have been trying to run one of the example file :asimpletradingrule.py, however I still get
AttributeError: 'DataFrame' object has no attribute 'Instrument'. I was able to fix another typo (submitted on github for you to review) but I am not sure as to what is happening on this one? I would be really grateful if you could show me what I am doing wrong? [I have been following the instal instruction to the dot regarding packages required and python version)

Trace below:

runfile('/home/olivier/pysystemtrade/examples/introduction/asimpletradingrule.py', wdir='/home/olivier/pysystemtrade/examples/introduction')
Reloaded modules: sysdata, sysdata.csvdata, syscore, syscore.fileutils, systems, examples, private, syscore.pdutils, syscore.dateutils, syscore.genutils, sysdata.futuresdata, sysdata.data, syslogdiag, syslogdiag.log, syscore.objects
using /home/olivier/pysystemtrade/data/futures/legacycsv
Traceback (most recent call last):

File "<ipython-input-3-c338bc01d55f>", line 1, in <module>
runfile('/home/olivier/pysystemtrade/examples/introduction/asimpletradingrule.py', wdir='/home/olivier/pysystemtrade/examples/introduction')

File "/home/olivier/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)

File "/home/olivier/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "/home/olivier/pysystemtrade/examples/introduction/asimpletradingrule.py", line 19, in <module>
print(data)

File "/home/olivier/pysystemtrade/sysdata/futuresdata.py", line 20, in __repr__
self.get_instrument_list())

File "/home/olivier/pysystemtrade/sysdata/csvdata.py", line 253, in get_instrument_list
instr_data = self._get_instrument_data()

File "/home/olivier/pysystemtrade/sysdata/csvdata.py", line 236, in _get_instrument_data
instr_data.index = instr_data.Instrument

File "/home/olivier/.local/lib/python3.6/site-packages/pandas/core/generic.py", line 3614, in __getattr__
return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'Instrument'
 
Thanks Traider, as you can see from the 3rd last line in the slack trace above I am running this on Python 3.6 already, any other suggestion would be welcome . It looks like a tool tool and I would really like to give it a try :-)
 
Hi GAT,

is it possible to make available the roll information you use ?

Instrument code rollcycle pricecycle lastrolloffset firstrolloffset carryoffset
CRUDE_W 12 1 -60 -90 -1
ES 3 3 -15 -35 1
 
Hi GAT,

is it possible to make available the roll information you use ?

Instrument code rollcycle pricecycle lastrolloffset firstrolloffset carryoffset
CRUDE_W 12 1 -60 -90 -1
ES 3 3 -15 -35 1

The roll dates can be backed out from the carry files, these contain raw prices for the listed PRICE and CARRY contracts. I use these dates to construct my own panama price series from Quandl data, sometimes using data from pysystemtrade carry csv files to if it covers more dates than Quandl data.
 
The roll dates can be backed out from the carry files, these contain raw prices for the listed PRICE and CARRY contracts. I use these dates to construct my own panama price series from Quandl data, sometimes using data from pysystemtrade carry csv files to if it covers more dates than Quandl data.

Yup can get roll cycle and carryoffset, but what about
lastrolloffset firstrolloffset
 
I'm currently working on code for all this stuff, hopefully will commit soon.

GAT

Thank you so much sir,

I saw the new futures roll code and was planning to hack this bit, but since you are going to check in new version I will eagerly await. Will work on other bits and pieces first.

Cheers!
 
I'm currently working on code for all this stuff, hopefully will commit soon.

GAT

Hi GAT, I have a couple of questions about pysystemtrade

1) for live running, can I write the optimiser generated weights to config file so that all estimation is turned off in a system dedicated for generating live trades. Optimiser can be run in a separate process say each day.

2) Am I right to say that both variables below are only used during optimization?
forecast_weight_ewma_span
instrument_weight_ewma_span

3) To get the position for trading, I should call portfolio.get_subsystem_position

Thanks a lot
 
Back
Top