Algorithmic trading for hedge funds: hedging techniques and application to a folio

Discussion in 'Journals' started by fullautotrading, Jul 21, 2014.

  1. Added another of those option configurations to GDXJ (structurally the same as TBT, but ratio R 4:1), since it raised a bit today and tomorrow we have some option expirations.

    GDXJ_OPT2.png

    Currently we have 55 layers under watch, 2 of which are currently "inactive" (VXX and DGAZ). Tomorrow we will have 12 options expiring, so by Monday 12 layers will be gone. Tomorrow we will examine one by one the protective structures which are expiring and how to "close" them.

    There is of course the little "dilemma" on the best way to deal with those expiring structures and still have a "perfect" representation of the PNL (which currently is accurate to the penny, and includes the closing costs and spread).

    The little "problem" we face - and maybe some readers have some ideas to suggest in regard - is how to deal neatly with the options and the shares used to cover the short options, while maintaining a precise PNL. The problem seems to be especially with the options expiring ITM (in the money), because we do not know (do we?) exactly what prices will be used for the settlement on both sides (option and shares) and if there are some other fees associated with the process. With options expiring OTM (out of the money), I think we can just assume the price equal to 0. Clearly, we are talking of a few bucks, but still, we would like to keep the PNL curve very accurate. To avoid this uncertainty, and in the conviction that there are no "free lunches" anyway, I will follow the following procedure, unless some of you readers can suggest something better.

    Options OTM: I will not do anything. Just after expiry I will force the price to 0 (this is just an option of the application, in "layer settings"), to get a precise PNL.
    Option ITM: I will close the position (if possible) before the market closes, so that the app will know for sure the price to be used for the PNL computation.
    Shares (those on the "manual" layer used to cover the short options): I will close the position before the market closes (along with the corresponding options).

    After all these actions, the 12 option layers will be removed (the application will keep anyway memory of the removed layers, and the PNL curve will of course continue to incorporate their contribution).

    This way we should ensure to remain accurate to the penny. Clearly, the alternative would be to let everything expire without doing anything, close the shares related with OTM or cash-settled options and, on Monday, simply re-sync the shares position which need so, by using the facility "project a virtual fill", which allows to re-sync the application position with the current account position. However, I think that doing so we may introduce some (small) inaccuracy in the PNL curve (a few bucks).
    Clearly, let me know if you have better ideas.

    An example of current "state" of option layers is the following, showing a couple of options layers (expiring tomorrow) of
    TNA: PUT 58 and a CALL 75, with the first one OTM and the other one slightly ITM (at this very moment).
    (The "yellow line" (follow the cyan arrow) is a recent addition (of these days), to help summarize at a glance the status of the option). You also see the spread is worth about $15 (that's already taken into account in the PNL figure shown by the app).

    TNA_OPT2.png
     
    Last edited: Aug 28, 2014
    #41     Aug 28, 2014
  2. Ok let's begin taking care of the options, as we said.

    I just closed two short CALLs of TNA which were ITM, and sold 200 shares on the "manual" layer. All the other TNA options are abundantly OTM (and we just leave them there). So, we are done for now with TNA. Pretty simple. Let's proceed with the next one.

    TNA_OPT3.png
     
    Last edited: Aug 29, 2014
    #42     Aug 29, 2014
  3. TZA is just pretty much similar. We have 2 short PUTs ITM. Closed them and "bought back" 200 shares on the "manual" layer:

    TZA_OPT1.png

    (The only difference with previous case is that the option orders did not fill immediately, but took a few seconds.)
     
    Last edited: Aug 29, 2014
    #43     Aug 29, 2014
  4. Finally, there is a short PUT of GDXJ and a short PUT of TBT. Then we are done. All the other ones expiring today are (largely, at least 18%) OTM.

    GDXJ

    GDXJ_OPT3.png

    TBT

    TBT_OPT2.png

    When the mkt closes, I will bring the price to 0 for all the OTM options, and then remove the 12 option layers expiring today,
     
    Last edited: Aug 29, 2014
    #44     Aug 29, 2014
  5. I hope it did not sound complicated: it's actually easier actually doing this than explaining, or following on a thread. Anyway, let me make a "flashcard" with a simple summary of what to do on option expiration:

    ------------------- On option expiration -------------------

    Method 1 (hopefully accurate to the penny)

    It the option is ITM (or very close to that) you close it. In addition, if the option is (was) short you take care of the "cover" shares by closing them (in the "manual" layer).

    (That's all: pretty simple: the yellow line on screen offers a quick help).


    Method 2 (may introduce a small inaccuracy, of very few $, in the PNL curve)

    Do nothing. When mkt opens, remove the layers of the expired options and, then, re-sync the instrument positions on the manual layer (using the "virtual fill" dialog).

    ------------------------------------------------------------------
     
    #45     Aug 29, 2014
  6. As a last detail, I mentioned that after expiry the price of an OTM option is forced to "0", to the purpose of PNL computations.

    This is done because we would never "receive" zero, so it must be forced algorithmically.

    More in detail, what the application does, is, for the expired options to considers for the purpose of PNL computations the "closing" price:

    p = Max(0, Underlying - Strike) for CALLs
    p = Max(0, Strike - Underlying) for PUTs

    if there is an open position.

    So, in particular, for OTM options (where the second argument in the max() function is always non positive), we automatically get 0. The reason for closing the ITM options was essentially in order to have an accurate price for the last PNL computation (instead of essentially relying on this mechanism, which nevertheless, can provide a reasonable approximation).

    You see, in this case, we have let expire the OTM CALL option (top picture) with a position equal to 4, while we have instead closed the ITM PUT option (bottom picture), which had a position equal to -1.


    GDXJ_OPT4.png

    I have been going with some detail in the question of dealing with options at expiration, so that next time we do not have to repeat again all the various details. Clearly, if you have ideas to improve these functionalities, they are always welcome.

    Finally, let's observe that the account and sync check of the application (green $ icon) now shows:

    Code:
    ============================================== NOT MATCHING PRESENT IN THIS INSTANCE ===============================================
    Symb                                                                       This G-BOT             IB            Exp
    GDXJ                               [GDXJ  140829C00050000]                          4              0        Expired
    TBT                                [TBT   140829C00064500]                          4              0        Expired
    TZA                                [TZA   140829C00019000]                          3              0        Expired
    TZA                                [TZA   140829C00021500]                          4              0        Expired
    TNA                                [TNA   140829P00055000]                          4              0        Expired
    TNA                                [TNA   140829P00058000]                          4              0        Expired
    ------------------------------------------------------------------------------------------------------------------------------------
    
    
    ================================================ POSITIONS STRANGER TO THIS INSTANCE ===============================================
    None
    ------------------------------------------------------------------------------------------------------------------------------------
    thus indicating that, by this time, the broker has already removed the options from the account.

    When we also remove these layers (belonging to the OTM options we did not close), the application will indicate we are back in perfect sync with the account.
     
    Last edited: Aug 29, 2014
    #46     Aug 29, 2014
  7. We can also login in IB acct management and cross-check in Reports>Activity>Statements>Trades and we find a match:

    Trades1.png

    What, instead, remains a bit of a mystery (to me) is the "discrepancy", that we have already noted in a previous post, between the real PNL (the application's PNL is accurate to the penny, and, currently, about 4.7K), and the figures shown by IB (the same exact figures are sent via API):

    IB_Acct.png

    So according to this, the variation of the NetLiquidation increase from the initial value (cf. first post) is larger than 25K. I am not sure how they get such a figure, which, to me, seems confusing (I would probably be quite uncomfortable without the exact computation of the PNL provided by the application.) If anyone has more info on that, let me know.

    Finally note that we have been using so far just a small fraction of the available funds, and in fact, even using Reg T (which can be a multiple of "portfolio margin", like 3 or 4 times, the max ever seen full maint margin was just 114K. Clearly, when trading with this approach in a real account, one should, instead, always use the portfolio margin.
     
    Last edited: Aug 30, 2014
    #47     Aug 30, 2014
  8. Can you explain why you chose those instruments to trade. They seem like inefficient non-primary markets with dubious adverse selection fill propensity. If you are going for the decay in these instruments, wouldn't it be better to sell and hold those instruments, and trade better ones like liquid futures GC, CL,ES, etc.
     
    #48     Aug 30, 2014
  9. Hi tropicalknight, thank you.

    Sure, the instrument selection is mostly up to the fund manager, the investors' preferences, and depends much on the available capital. This illustration is done by using ETFs, and in the space of the ETFs, that's pretty much what we get. Anyway, once one is comfortable trading with ETFs (which offer significant challenges), futures are even simpler to deal with (from the application point of view), and of course they give the "biggest bang for the buck", boosting the profit/margin ratio.

    I am planning to do also an illustration with Futures, but it's probably better to make a distinct thread, so it can be followed more easily.

    Sure, if you get the right capital, I agree that futures are the primary way to go. But, of course, in that case, you can still have additional application instances also trading ETFs and other instruments, if you wish. The main disadvantages of futures are: size of a single "packet" (which, along the associated drawdowns (DD), can be "too large" relative to some account sizes), rollovers (which are a bit annoying). (Contango and backwardation issues, can be dealt with in a similar way we have been treating the drifting ETFs.)

    About your expression "inefficient non-primary markets with dubious adverse selection fill propensity" I am not sure what you mean by "adverse selection fill propensity".

    And no, I am not "going for the decay". I am simply going "not against it", because no one could ever survive scalping long term against that (the scalping component would not be enough to catch up with the unbounded "runaway"); so when trading, if there are "structural" (/"mathematical") drifts one has obviously to take them into account, or he would be "steamrolled" :) by them.

    On the other hand, simply trading the "decay" (or conversely, the "upward drift" on stuff like SVXY, TNA, etc.) would also not work, because the occasional DD (which, sooner or later, will necessarily happen) would be too large for most account or investors' taste (so that you either face acct liquidation, or psychological pressure to take a significant loss). And that's why we create those scalping "corridors" through appropriate option/shares "configurations".
     
    Last edited: Aug 30, 2014
    #49     Aug 30, 2014
  10. Resuming after the "labor day". Removed the expired option layers:

    PNL44.png


    Just added a new "protective option-share configuration" to TZA expiry October 17 (so about 45 days), "usual" type R N CALL / - N PUT -N 100 shares] with R=4:

    TZA_OPT2.png

    We have a next expiration date on september 5 (TBT). From now on we will use the other method we have indicated in previous flashcard for dealing with expiring options, which conceptually seems more sound. That is, we will do nothing, and simply re-sync the position and square up the PNL as appropriate after expiration (we will see that in detail at the next expiration date).
     
    Last edited: Sep 2, 2014
    #50     Sep 2, 2014