public void AddOrder(MarketOrder order) { if (order.IsBid) { BuyOrders.Add(order); } else { SellOrders.Add(order); } }
private void AddOrder(Order newOrder) { if (newOrder.Action == ActionEnum.BUY) { BuyOrders.Add(newOrder); } else if (newOrder.Action == ActionEnum.SELL) { SellOrders.Add(newOrder); } else { throw new SmartException(ExceptionImportanceLevel.HIGH, "AddOrder", "StrategyState", "No other options. New Order = " + newOrder.ToString()); } MakeConsistent(); }
public BuyOrder CreateBuyOrder(string name, ulong quantity, ulong pricePerItem) { var orderAccount = new Account(0); if (!BalanceAccount.DepositInto(orderAccount, quantity * pricePerItem)) { return(null); } var order = new BuyOrder(name, pricePerItem, quantity, orderAccount); order.AddCancelAction(CancelBuyOrder); order.AddExecuteAction(ExecuteBuyOrder); lock (BuyOrders) { BuyOrders.Add(order); } Updated?.Invoke(this, this); return(order); }
public void AddOrder(ILimitOrder order) { if (order.Price != Price) { return; } switch (order.Way) { case WayEnum.Buy: BuyOrders.Add(order); break; case WayEnum.Sell: SellOrders.Add(order); break; } order.RegisterDeleteNotificationHandler(HandleDeleteOrFilled); order.RegisterFilledNotification(HandleDeleteOrFilled); }
public TestDbState AddOrder(BuyOrder buyOrder) { BuyOrders.Add(buyOrder); return(this); }