Fully automated futures trading

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

  1. KCOJ

    KCOJ

    My understanding is that you're considering including these markets within some form of a longer term trend-following (LTTF) strategy. If that’s the case then imo (providing your account size is sufficient) you should absolutely add them to your portfolio.

    I’ve always found a key tenet of successful LTTF to be a broad diversification of markets, and these 3 markets have little, if any correlation to other commodities, let alone financials. Of course they’re all priced in USD, so a big USD move can certainly have an impact. But in general whenever you can find a liquid market that you can afford to trade, and it has little correlation to your existing portfolio … there’s only one rule … trade it.

    A few comments here …
    • LTTF is not overly sensitive to bid/ask spreads or execution costs in general, compared to shorter term trading styles such as swing or day trading
    • Sugar normally trades about the same daily volume as Wheat, often higher
    • Try to consider more than just daily volume when thinking about slippage. For example if you’re currently trading 5 lots of Corn then you’ll only need to trade 1 lot of Coffee assuming that you’re wanting to equalise your risk exposure to uncorrelated markets, so even if daily volume is less for Coffee, your market impact will also be less by only trading a 1-lot vs 5 lots
    • That said, if you’re trading during the US day session the bid/ask on Cotton and Sugar is normally just the 1 tick and Coffee only 1-2 ticks
    • And while on the subject of ticks … a tick of Corn is normally about 4% of the daily range, while a tick of Coffee is only 0.4% … so think about this … it actually makes Coffee a much cheaper market to trade than Corn if you’re concerned about slippage impacting on your PnL
     
    #2251     Aug 12, 2020
    .sigma and Kernfusion like this.
  2. Kernfusion

    Kernfusion

    I think the problem with trading these things on IB specifically (or actually it's because of the exchange they're traded on) is market data, I tried searching for all 3 here "https://misc.interactivebrokers.com/cstools/contract_info/v3.10/index.php", was able to find them and add to watch list, but only with delayed quotes, and when I tried adding the data-subscription, the only option was Level II ICE Futures U.S. (NYBOT) for an insane price of 120.75$\month. I tried adding "US Futures Value Bundle PLUS" but that didn't give me real-time prices for these 3 futures :( .
    I guess it's possible to trade them with delayed prices placing market orders.. But nor sure if it's gonna be worth it, as for everything else I use real-time with a limit-order execution algo..
     
    Last edited: Aug 12, 2020
    #2252     Aug 12, 2020
  3. A bit off topic, but I there should be enough mathematical talent here :)

    I have a small number of “alphas” and a covariance matrix (well, a synthetic covariance matrix, but never mind). Is there a quick and dirty analytical approximation to minimum variance portfolio? Actually doing the numerical optimization is too slow
     
    #2253     Aug 12, 2020
    .sigma likes this.
  4. Kernfusion

    Kernfusion

    Wasn't it like a solved analytical problem with Lagrangian and quadratic programming? I mean isn't it that "Markovitz bullet" or "Efficient frontier" for which he received his Nobel? Or you're talking about something else ?
    If it's that, then I remember listening a Courserra course about it, which looks like no longer available "Introduction to computational finance and financial econometrics", but here's the book by the course author "Eric Zivot" where he has "R" code to calculate it (maybe search for "solve.QP")
    https://canvas.uw.edu/courses/10986...e5dhpSR7zfF2WQxDGjAVERP0NFGd4KThy7zyDu&wrap=1
     
    #2254     Aug 12, 2020
  5. Yup, it's the efficient frontier, solving for the best alpha/variance. Unfortunately, QP is a numerical method and it is a bit too slow for my taste. I recall vaguely that there is some method based on simple matrix inversion that gets you close enough to optimal in most cases, but i can't remember what it was called.
     
    #2255     Aug 12, 2020
  6. Kernfusion

    Kernfusion

    Oh, yes, you're right it's still not an analytical solution but numeric, it's just we have gradient of the function in this case, so we can use smarter optimisation methods to converge on the minimum, but we still need to search it numerically.. Sorry, don't know if there's an approximate analytical solution for it..
     
    #2256     Aug 12, 2020
  7. FCT

    FCT

    You contribute yourself quite a bit, so here you go. Inverse of your covariance matrix times the vector of expected returns. That’ll give you the uncontrained MV weights (not minimum variance, which does not use expected returns), which can then be scaled to constant return, unit length, constant risk, you name it. If you add constraints, there’s no closed-form and you’ll have to resort to numerical optimization.
     
    #2257     Aug 12, 2020
    Same Lazy Element likes this.
  8. Makes sense! Thank you!
     
    #2258     Aug 12, 2020
  9. Elder

    Elder

    Have you looked into this? Its GAT's own way to do fast optimisations.
     
    #2259     Aug 13, 2020
  10. wopr

    wopr

    Since Elder brought it up, I've been playing with Rob's handcrafting method for a few weeks now, trying to understand the results I'm getting.

    Here's what I get for 12 instruments (returns data for the date range 2015/07/01-2020/07/01) that I think are somewhat diverse, representing each group (stocks, bonds, vol, aggs, metals, stir):
    Code:
                        ZC      V2TX        GE       MXP    ESTX50        NG        PL        HE       GBP        ZS       GBM        ZF
    Vol weights   0.036196  0.143411  0.113382  0.085424  0.099760  0.083576  0.077732  0.040960  0.069278  0.030971  0.141333  0.077977
    Std.          0.190274  0.439473  0.008014  0.145823  0.219591  0.380968  0.266162  0.340262  0.103737  0.166355  0.019816  0.027569
    Cash weights  0.007006  0.012019  0.521088  0.021576  0.016732  0.008080  0.010756  0.004434  0.024596  0.006857  0.262684  0.104172
    There's a 52% cash allocation to Eurodollar, which really seems odd. This was ran with no risk target, natural risk came out at 1.38%.
    I then looked at the subportfolios:

    Code:
    ['V2TX', 'GE', 'GBM', 'ZF']
    ['MXP', 'ESTX50', 'PL', 'GBP']
    ['ZC', 'NG', 'HE', 'ZS']
    Seems like VSTOXX got put together in the same group as bonds, which is weird.
    I then looked into the correlations, which somewhat explains how that happened:

    Code:
                  ZC      V2TX        GE       MXP    ESTX50        NG        PL        HE       GBP        ZS       GBM        ZF
    ZC      1.000000 -0.064267 -0.121516  0.170380  0.150131  0.016875  0.049561  0.265098  0.154059  0.629425 -0.117282 -0.129847
    V2TX   -0.064267  1.000000  0.370536 -0.411786 -0.769686 -0.106653 -0.313154 -0.158634 -0.312296 -0.078578  0.175712  0.420393
    GE     -0.121516  0.370536  1.000000 -0.057798 -0.406423 -0.142400 -0.001980 -0.172233 -0.104512 -0.100224  0.605351  0.949195
    MXP     0.170380 -0.411786 -0.057798  1.000000  0.498750  0.122098  0.425653  0.210096  0.357280  0.250902  0.057800 -0.081791
    ESTX50  0.150131 -0.769686 -0.406423  0.498750  1.000000  0.108295  0.361960  0.249286  0.326445  0.199973 -0.127219 -0.454780
    NG      0.016875 -0.106653 -0.142400  0.122098  0.108295  1.000000  0.073907  0.129099  0.053497  0.112193 -0.091922 -0.132716
    PL      0.049561 -0.313154 -0.001980  0.425653  0.361960  0.073907  1.000000  0.162243  0.415357  0.132317  0.122485 -0.013490
    HE      0.265098 -0.158634 -0.172233  0.210096  0.249286  0.129099  0.162243  1.000000  0.118090  0.275095 -0.073586 -0.196772
    GBP     0.154059 -0.312296 -0.104512  0.357280  0.326445  0.053497  0.415357  0.118090  1.000000  0.161429 -0.056220 -0.061670
    ZS      0.629425 -0.078578 -0.100224  0.250902  0.199973  0.112193  0.132317  0.275095  0.161429  1.000000 -0.110987 -0.105146
    GBM    -0.117282  0.175712  0.605351  0.057800 -0.127219 -0.091922  0.122485 -0.073586 -0.056220 -0.110987  1.000000  0.617952
    ZF     -0.129847  0.420393  0.949195 -0.081791 -0.454780 -0.132716 -0.013490 -0.196772 -0.061670 -0.105146  0.617952  1.000000
    Do others get similar results? I could try to "fix" these by running with a higher risk target, but I'd like to understand what's happening before I do that, and also, how to determine the risk target I should be running with. Without leverage, max risk that this portfolio can reach is about 7.5%. My system is based off of Rob's Leveraged Trading book so there's a leverage factor built in the system in the form of instrument_risk_target / instrument_risk.
     
    #2260     Aug 13, 2020