Click or drag to resize

Continuous futures

ContinuousSecurityWindow - is a visual editor for creating continuous (ContinuousSecurity) instruments. See Continuous futures.

This component includes:

  • Special SecurityIdTextBox text field, whivh generates a continuous instrument with the input of Id - [Code]@[Board].

  • The SecurityJumpsEditor component is a special DataGrid for working with instruments that are part of a continuous instrument. The component instruments are wrapped in the SecurityJump, class, which has two properties: Security and Date (roll forward). The added instruments are stored in the Jumps. list. The component has the Validate function to check the correctness of the component instruments.

  • Buttons for adding/removing instruments.

  • Auto button allows you to automatically create a continuous instrument.

  • Ok button completes the creation of a continuous instrument.

Main properties

Below is the appearance of the component and the code snippet with its use.

Hydra GluingCSCustom
C#
private void CreateContinuousSecurity_OnClick(object sender, RoutedEventArgs e)
{
    _continuousSecurityWindow = new ContinuousSecurityWindow
    {
        SecurityStorage = _entityRegistry.Securities,
        Security = new ContinuousSecurity { Board = ExchangeBoard.Associated }
    };

    if (!_continuousSecurityWindow.ShowModal(this))
        return;

    _continuousSecurity = _continuousSecurityWindow.Security;
    ContinuousSecurity.Content = _continuousSecurity.Id;

    var first = _continuousSecurity.InnerSecurities.First();

    var gluingSecurity = new Security
    {
        Id = _continuousSecurity.Id,
        Code = _continuousSecurity.Code,
        Board = ExchangeBoard.Associated,
        Type = _continuousSecurity.Type,
        VolumeStep = first.VolumeStep,
        PriceStep = first.PriceStep,
        ExtensionInfo = new Dictionary<object, object> { { "GluingSecurity", true } }
    };

    if (_entityRegistry.Securities.ReadById(gluingSecurity.Id) == null)
    {
        _entityRegistry.Securities.Save(gluingSecurity);
    }
}
See Also

Other Resources