Table of Contents

Base algorithms

Along with Quoting, the S# contains the TraderHelper class, which includes a variety of simple trading algorithms methods:

  1. To adjust the price through the TraderHelper.ShrinkPrice(StockSharp.BusinessEntities.Security security, System.Decimal price, StockSharp.Messages.ShrinkRules rule**)** method, so it become a multiple of price increment and trading system accepts the order:

    // the sample security
    var someSecurity = _connector.Securities.First();
    Console.WriteLine(someSecurity.ShrinkPrice(13453.65342));
    
  2. To check whether the current time traded (is session closed? is clearing started?) through the TraderHelper.IsTradeTime(StockSharp.Messages.WorkingTime workingTime, System.DateTime time, System.Nullable<System.Boolean>@ isWorkingDay, out StockSharp.Messages.WorkingTimePeriod period**)** method:

    // the sample security
    var someSecurity = _connector.Securities.First();
    Console.WriteLine(someSecurity.Board.IsTradeTime(currentTime));
    
  3. The rest of the TraderHelper class methods are described in the Order cancel and Order replace sections.

Quoting

Order cancel

Order replace