Click or drag to resize

Delta hedging

If you want to protect positions by option strategies (for example, as Volatility trading), you can use the DeltaHedgeStrategy.

Delta hedging

  1. As a demonstration of the DeltaHedgeStrategy work the SampleOptionQuoting example is modified (for details see Volatility trading).

  2. The VolatilityQuotingStrategy strategy itself does not start, but instead it is packed in the BasketStrategy, from which the strategy start method is called:

    // create delta hedge strategy
    var hedge = new DeltaHedgeStrategy
    {
        Security = option.GetUnderlyingAsset(Connector),
        Portfolio = Portfolio.SelectedPortfolio,
        Connector = Connector,
    };
    
    // create option quoting for 20 contracts
    var quoting = new VolatilityQuotingStrategy(Sides.Buy, 20,
            new Range<decimal>(ImpliedVolatilityMin.Value ?? 0, ImpliedVolatilityMax.Value ?? 100))
    {
        // working size is 1 contract
        Volume = 1,
        Security = option,
        Portfolio = Portfolio.SelectedPortfolio,
        Connector = Connector,
    };
    
    // link quoting and hending
    hedge.ChildStrategies.Add(quoting);
    
    // start henging
    hedge.Start();

    The DeltaHedgeStrategy takes the parental strategy that contains child strategies working separately on their strike. Thus DeltaHedgeStrategy controls the total position of all option strategies. As an example works with only one strike and therefore with one option strategy, this strategy has been packed in the special strategies “basket” - BasketStrategy. BasketStrategy does not contain trading logic and is made to create the strategies hierarchy, which is needed by DeltaHedgeStrategy.

  3. Completing the delta hedging:

    hedge.Stop();