Пример #1
0
 public OrderBook(StatefulServiceContext context)
     : base(context)
 {
     Init(context);
     this.asks = new OrderSet(this.StateManager, AskBookName);
     this.bids = new OrderSet(this.StateManager, BidBookName);
 }
Пример #2
0
 // This constructor is used during unit testing by setting a mock IReliableStateManagerReplica
 public OrderBook(StatefulServiceContext context, IReliableStateManagerReplica reliableStateManagerReplica, Order ask = null, Order bid = null, int maxPendingAsks = 10, int maxPendingBids = 10)
     : base(context, reliableStateManagerReplica)
 {
     this.maxPendingAsks = maxPendingAsks;
     this.maxPendingBids = maxPendingBids;
     this.asks           = new OrderSet(reliableStateManagerReplica, AskBookName);
     if (ask != null)
     {
         this.asks.SecondaryIndex = this.asks.SecondaryIndex.Add(ask);
     }
     this.bids = new OrderSet(reliableStateManagerReplica, BidBookName);
     if (bid != null)
     {
         this.bids.SecondaryIndex = this.bids.SecondaryIndex.Add(bid);
     }
 }