Oh no, not another python backtester...

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

  1. #131     Mar 16, 2018
    HobbyTrading and djames like this.
  2. traider

    traider

    Hi GAT,

    I'm wondering about 2 issues in bootstrapping forecast weights using chapter15.futuresestimateconfig.yaml

    1. carry weight seems to be below 0.1, not sure if this is too low
    2. when pooling instruments, weights for the same trading rule for each instrument is different

    forecast_weight_estimate:
    method: bootstrap
    pool_instruments: True

    CORN
    ewmac64_256 0.195
    ewmac16_64 0.521
    carry 0.087
    ewmac32_128 0.198
    EDOLLAR
    ewmac64_256 0.329
    carry 0.132
    ewmac32_128 0.539
    EUROSTX
    ewmac64_256 0.274
    ewmac16_64 0.450
    carry 0.116
    ewmac32_128 0.160
    MXP
    ewmac64_256 0.227
    ewmac16_64 0.536
    carry 0.090
    ewmac32_128 0.147
    US10
    ewmac64_256 0.206
    ewmac16_64 0.520
    carry 0.121
    ewmac32_128 0.152
    V2X
    ewmac64_256 0.360
    carry 0.119
    ewmac32_128 0.520


    Code:
    from systems.provided.futures_chapter15.estimatedsystem import futures_system
    from sysdata.configdata import Config
    
    system = futures_system()
    
    print(system.accounts.portfolio().sharpe())
    
    for instr_code in system.get_instrument_list():
        rule2weight = system.combForecast.get_forecast_weights(instr_code).iloc[-1].to_dict()
        print(instr_code)
        for rule in rule2weight:
            print(rule + " " + '{0:.3f}'.format(rule2weight[rule]))
    
    
     
    #132     May 8, 2018
  3. 2. is because of costs

    GAT
     
    #133     May 9, 2018
  4. traider

    traider

    Hi is there anyone using Pysystemtrade actively?

    Will love to create a live chat like discord etc or email so that we can talk about issues and stuff. I'm trying to get it to backtest other asset classes like stock, but I'm not sure if the sharpe ratios look correct and what are the changes necessary. Would love to discuss...
     
    #134     Jun 2, 2018
    djames likes this.
  5. JMW

    JMW

    Question for the general audience: I see that Quandl have stopped providing FX prices up to the current day. What are people doing for FX prices, what sources are people going to, and is anyone importing them into this upgraded data component?
     
    #135     Jun 26, 2018
  6. traider

    traider

    Can probably use FXCM or Kinetick from Ninjatrader as free data source.
     
    #136     Jun 26, 2018
  7. djames

    djames

    Iirc there are multiple sources of FX within Quandl, which one has become delayed? I've used the feed from the ECB before both via Quandl and direct from ECB website.
     
    #137     Jun 26, 2018
  8. I pull all prices, including FX, from IB. But I use my own software, not the tools developed by @globalarbtrader .
     
    #138     Jun 26, 2018
  9. JMW

    JMW

    I was using the codes configured out of the box in pysystemtrade e.g. "CURRFX/EURUSD". The series seem to stop at 2/28/2018 and there now seems to be a charge for them which is high (higher than GAT would approve of paying). You are right there do seem to be other series available also on quandl e.g. there is a series available from FRED which has all of the currencies except Korean Won e.g. "FRED/DEXUSEU" for Euro. Some of these are the wrong way around, which is not the end of the world. However I see that in spite of being advertised as daily, this one seems a few days out of date e.g. on today 6/27/2018 the latest available price is from 6/22/2018. So, usable for backtesting and research, but not for daily trading.
     
    #139     Jun 27, 2018
  10. Kernfusion

    Kernfusion

    Hi,
    I'm at the point right now where my own system that's doing real-time execution and IB integration is ready for paper-trading (C#+SQL, event-driven), only need to fit the parameters, but something doesn't seem to be working in pysystemtrade..
    So just to confirm, should the current version of pysystemtrade work correctly or there are some temporary issues with it at the moment ? (specifically the optimisation\fitting part)?
    Because no matter what I do, I'm always getting estimated weight on the carry rule only around 0.1 (same as pointed by traider) on all instruments (out of 4 EWMAC + 1 carry rules), which in theory shouldn't be like that (carry should receive around 0.5 weight).

    Also, when I'm printing positions with get_actual_position('CORN') they seem too large for 250k capital (though, I might be misunderstanding something here..).

    So if it's expected because of current "work in progress", what earlier version was relatively stable for weights optimisation ? (or maybe I'm just doing something wrong and everything should actually be working, that's always possible of course :) )

    here's the code I'm using:

    from systems.provided.futures_chapter15.estimatedsystem import futures_system
    system=futures_system()
    system.set_logging_level("on")
    system.config.forecast_weight_estimate["pool_instruments"]=True
    system.config.forecast_weight_estimate["method"]="bootstrap"
    system.config.forecast_weight_estimate["equalise_means"]=False
    system.config.forecast_weight_estimate["monte_runs"]=200
    system.config.forecast_weight_estimate["bootstrap_length"]=104
    system.accounts.portfolio().curve().plot()

    #print forecast weights:
    for instr in system.get_instrument_list():
    print(instr)
    fcW = system.combForecast.get_forecast_weights(instr)
    print(fcW.tail(1))
    fcW.plot(title=instr)

    #print positions:
    system.portfolio.get_actual_position('CORN').plot(title='Corn Positions')

    upload_2018-7-12_2-22-18.png
    upload_2018-7-12_2-22-40.png
    upload_2018-7-12_2-23-54.png
     
    #140     Jul 12, 2018