public void TestSendCustomNumLots() { var order = new MarketOrder( new SOrderParameters(Contracts.CreateUserSpecified(100), EOrderAction.Buy)); using var monitoredOrder = order.Monitor(); order.Send(25); monitoredOrder.Should().Raise("OrderSent") .WithArgs <OrderInfo>(info => info.OrderAction == EOrderAction.Buy) .WithArgs <OrderInfo>(info => info.Size == 25); }
public void TestSendWithUserDefinedSize() { var order = new LimitOrder(new SOrderParameters( Contracts.CreateUserSpecified(50), EOrderAction.Sell)); using var monitoredOrder = order.Monitor(); order.Send(15); monitoredOrder.Should().Raise("OrderSent") .WithArgs <OrderInfo>(info => info.Price == 15) .WithArgs <OrderInfo>(info => info.OrderAction == EOrderAction.Sell) .WithArgs <OrderInfo>(info => info.Size == 50); }
public void TestMarketThisBar() { var orderCreator = new OrderCreator(); using var monitoredOrderCreator = orderCreator.Monitor(); var order = orderCreator.MarketThisBar( new SOrderParameters(Contracts.CreateUserSpecified(10), EOrderAction.Buy)); order.Send(99); monitoredOrderCreator .Should().Raise("OrderSent") .WithArgs <OrderInfo>(info => info.Order == order) .WithArgs <OrderInfo>(info => info.OrderAction == EOrderAction.Buy) .WithArgs <OrderInfo>(info => info.Size == 99); }
/// <summary> /// 設定預設的下單數量規模 /// </summary> /// <param name="lots">下單數量</param> public void SetDefaultContracts(int lots) { __cDefaultContracts = Contracts.CreateUserSpecified(lots); }