Oh no, not another python backtester...

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

  1. djames

    djames

    OK, stupid question coming up.

    I'm about to place my first trade for Eurodollar (GE), buying 2 lots, in my test portfolio i have GE and V2TX, varget vol 15% and 50k account balance. With these params i should be long 2 GE, short 5 V2TX with longer MAs and carry rules.

    But, when placing the LIMIT order through IB, i get a warning "The estimated order value of 490,800 USD exceeds the value limit of 77,701 GBP."

    1. Do you guys set this limit to very high amounts?
    2. Does this limit apply to the gateway as well when I go fully automatic?
    3. Ok, i under stand that i am buying using leverage, but that level of leverage is more than i would have anticipated for nominal trading amount of 50k GBP - can someone shed light for a futures newbie? I think I have been to wrapped up in the systems programming and am having a shock when actually placing a trade.
     
    #71     Aug 16, 2017
  2. traider

    traider

    Best way to get a sense of the dollars n cents, in your demo account, buy 1 lot, then watch the price fluctuations, also look at the margins used. its all very nicely computed by IB
     
    #72     Aug 16, 2017
  3. 1. Yes
    2. No, you won't get that warning.
    3. You have to consider the difference between the total contract value and the risk of value fluctuation (the value volatility).
     
    #73     Aug 16, 2017
  4. The notional value of a Eurodollar contract is 250,000 * price / 100 hence the size of the order value (because it's a quarter of a years interest on a million dollars). This is probably the largest notional value you will see, unless you trade Japanese Government bonds (for which you need a massive account size).

    GAT
     
    #74     Aug 17, 2017
  5. Hi GAT,
    Is it possible to assign static weights to instruments for specific dates? I know you can assign static weights for all dates but am sure how to set these for e.g., specific years. The reason being, due to the bootstrapping nature of the estimation techniques used, the weights generated lead to slightly different positions over time, so when running live some trades that were previously generated don't appear when run at a later date, increasing the tracking error between live trading and simulated trading. If I assign static weights, due to the different instrument history lengths the system remains 'underinvested' in the past when there are fewer instruments...
    Also, if I input static weights, how does this impact the Instrument Diversification Multiplier?
    One last question, is the IDM the same for all instruments or does it vary by instrument? I suspect it varies by instrument given that theoretically instruments with a greater diversification benefit should receive a larger weight.
    Thanks,
    AG
     
    #75     Aug 25, 2017
  6. Hacky, but can be done: In /pysystemtrade/systems/portfolio.py you'd override the method get_raw_fixed_instrument_weights so it returned a specific pandas dataframe (assuming config.use_instrument_weight_estimates = False)

    There is no underinvestment problem. If you set config.use_instrument_div_mult_estimates=True then an IDM will be calculated that will compensate for changes in the length of price history in the past. This is equally true for static instruments weights, semi-static weights like you want to use, or fully estimated weights.

    By construction the IDM is something that is the same for all instruments. The IDM of a system with a single instrument would be 1. An instrument which had better diversification properties would get a higher instrument weight.

    GAT
     
    #76     Aug 25, 2017
    AvantGarde likes this.
  7. djames

    djames

    would it be that crazy to reoptimise weights every day as new data is added? is it not better to use all available data as it's available rather than fixing weights statically?
     
    #77     Aug 27, 2017
  8. Hi GAT,
    I'm still struggling with this. I noticed with my config that each time I fix the weights, the IDM always shows up as 1 over the entire sample period. How can I fix the weights but allow the IDM to fluctuate?

    My yaml config is as follows:

    forecast_weight_estimate:
    method: bootstrap
    frequency: W
    pool_instruments: True
    date_method: expanding
    monte_runs: 100
    cleaning: True
    bootstrap_length: 50
    floor_at_zero: True
    ewma_span: 0
    #
    use_forecast_scale_estimates: True
    #
    forecast_scalar_estimate:
    pool_instruments: True
    #
    use_forecast_weight_estimates: False #(I'm using my own)
    #
    rule_variations: ['carry', ... etc ]
    #
    instruments: ['NKY', 'NASDAQ', ...etc]
    #
    forecast_correlation_estimate:
    pool_instruments: True
    #
    use_instrument_weight_estimates: False
    #
    use_instrument_div_mult_estimates: True
    #
    instrument_div_mult_estimate:
    func: syscore.divmultipliers.diversification_multiplier_from_list
    ewma_span: 125 ## smooth to apply
    floor_at_zero: True ## floor negative correlations
    dm_max: 2.5 ## maximum
    #
    instrument_weight_estimate:
    method: bootstrap
    frequency: M
    pool_instruments: True
    date_method: expanding
    monte_runs: 100
    cleaning: True
    bootstrap_length: 50
    floor_at_zero: True
    ewma_span: 0
    #
    instrument_weights:
    NKY: 0.0344
    NASDAQ: 0.0349
    etc...
     
    #78     Sep 5, 2017
  9. Are you using the latest version?
    If so, what happens if you look at system.portfolio.get_instrument_correlation_matrix()
    Does it have different correlation matrices inside it?

    GAT
     
    #79     Sep 6, 2017
  10. Unless your data series is really short the weights should hardly change at all. But do it if you want to.

    GAT
     
    #80     Sep 6, 2017