Fully automated futures trading

Discussion in 'Journals' started by globalarbtrader, Feb 11, 2015.

  1. Instruments - let's say an hour? Including getting the data.

    'Adding a new system' -> have you got a piece of string I can measure? Could be anything from 1 minute for a parameter change to several years.

    GAT
     
    #3021     Dec 2, 2021
    newbunch likes this.
  2. newbunch

    newbunch

    For new system, I definitely didn't mean a parameter change. I mean, in theory, if you had an idea and it worked right away and you wanted to implement it right away (a lot of ifs there), how long does it take to program, test, and implement? I'm trying to get an idea of the amount of programming time it takes rather than testing.
     
    #3022     Dec 2, 2021
  3. Well let's take the dynamic optimisation. I did a lot of faffing around with different ideas, but once I knew how to do it, it probably took me about 2 days in all to write production quality code that I was happy to implement (the research code I wrote to test the idea, maybe took me a couple of hours).

    Implementation is just a question of a few keystrokes once the code is written.

    As an interesting PS, from this you can conclude that I write code way too quickly. Pysystemtrade is over 60k lines of python:

    Code:
    rob@RobLaptop:~$ cloc pysystemtrade/
        2143 text files.
        1113 unique files.                                         
        1685 files ignored.
    
    github.com/AlDanial/cloc v 1.82  T=2.86 s (215.1 files/s, 54328.4 lines/s)
    --------------------------------------------------------------------------------
    Language                      files          blank        comment           code
    --------------------------------------------------------------------------------
    Python                          527          25398          12235          62671
    YAML                             30             41            584          36248
    Markdown                         11           3843              0           8774
    Bourne Again Shell               33             64            142            529
    JavaScript                        1             18              5            528
    INI                               3            104              0            441
    HTML                              1             14              0            267
    XML                               5              0              0            225
    CSS                               1             12              0            125
    Jupyter Notebook                  3              0           3237             46
    JSON                              1              0              0              8
    --------------------------------------------------------------------------------
    SUM:                            616          29494          16203         109862
    --------------------------------------------------------------------------------
    
    I would guess I've spent the equivalent of 2 full time years writing this code (ignoring research time) which equates to about 86 lines of code a day. That doesn't sound much, but it's a lot. And the reason I can code that fast is I don't write enough tests, my documentation isn't great, and because I don't have to worry about things like user specifications - I am the user.

    GAT
     
    Last edited: Dec 2, 2021
    #3023     Dec 2, 2021
    newbunch likes this.
  4. newbunch

    newbunch

    No concerns that your system is overly complex? (I've been spending much of the last 2 week simplifying my system by removing old stuff that made sense at the time but are no longer needed.)
     
    #3024     Dec 2, 2021
  5. Always! That's why I dropped the idea of doing fancy fitting.

    I'd say the vol attenuation and mean reverting vol estimation don't add much complexity, and I think they're simple and intuitive by themselves.

    Extra trading rules, well they're individually simpler and linearly combined, so as long as I understand them in isolation I'm happy to have dozens of these.

    All of the above stuff is fine; it fits in with my philosophy that my system isn't that complicated, but is made up of lots and lots of simple things.

    The main thing that doesn't fall into this category is the dynamic optimisation, which fundamentally changes the way the system works. But I think it's worth it, although I've had to build in a lot of diagnostics and fail safes to make sure it doesn't do something stupid.

    GAT
     
    #3025     Dec 2, 2021
    newbunch likes this.
  6. Nice. Do you know what Sharpe ratio it achieved in the 10 year period starting on 2010 Jan 1st? It has been a challenging period for trend following but it looks quite nice on your chart. Or could you post numerical data of the backtest perhaps? Daily performance numbers?

    Backtest from the beginning of 2010 to this day:
    Screenshot_20211202-191028_Samsung Internet.jpg
     
    #3026     Dec 2, 2021
  7. Sharpe is .... well let's round it up: 1.0

    Code:
    perc.stats()
    [[('min', '-9.323'), ('max', '5.493'), ('median', '0.1334'), ('mean', '0.07394'), ('std', '1.185'), ('skew', '-1.052'), ('ann_mean', '18.91'), ('ann_std', '18.97'), ('sharpe', '0.9967'), ('sortino', '1.17'), ('avg_drawdown', '-13.53'), ('time_in_drawdown', '0.9137'), ('calmar', '0.3882'), ('avg_return_to_drawdown', '1.397'), ('avg_loss', '-0.8708'), ('avg_gain', '0.7933'), ('gaintolossratio', '0.911'), ('profitfactor', '1.196'), ('hitrate', '0.5677'), ('t_stat', '3.469'), ('p_value', '0.0005295')], ]
    
     
    #3027     Dec 2, 2021
  8. Is it for the period [2010-2019] or does it include 2020 and 2021? I assume this is before costs?
     
    #3028     Dec 2, 2021
  9. 2011 to now

    Always with costs

    GAT
     
    #3029     Dec 2, 2021
  10. The reason is 2020 was a very good year for trend following and generally 2011-2019 period is quite "dead". So I wonder what it was like for your system. If it's still SR 1.0 then it's quite extraordinary.
     
    #3030     Dec 2, 2021