Oh no, not another python backtester...

Discussion in 'App Development' started by globalarbtrader, Dec 18, 2015.

  1. Sdoofy

    Sdoofy

    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'
     
    #111     Feb 2, 2018
  2. traider

    traider

    Try installing anaconda with python 3 +
     
    #112     Feb 3, 2018
  3. Sdoofy

    Sdoofy

    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 :)
     
    #113     Feb 3, 2018
  4. Now fixed (more comments on the github issue you opened)

    GAT
     
    #114     Feb 5, 2018
  5. traider

    traider

    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
     
    #115     Feb 12, 2018
  6. djames

    djames

    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.
     
    #116     Feb 13, 2018
  7. traider

    traider

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

    GAT
     
    #118     Feb 13, 2018
  9. traider

    traider

    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!
     
    #119     Feb 13, 2018
  10. traider

    traider

    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
     
    #120     Feb 20, 2018