public void PerformsMarketFillSell() { var model = new ForexTransactionModel(); var security = CreateSecurity(); var order = new MarketOrder(Symbols.USDJPY, -100, DateTime.Now, type: SecurityType.Forex); security.SetLocalTimeKeeper(TimeKeeper.GetLocalTimeKeeper(TimeZones.NewYork)); security.SetMarketPrice(new IndicatorDataPoint(Symbols.USDJPY, DateTime.Now, 101.123m)); var fill = model.MarketFill(security, order); var slip = model.GetSlippageApproximation(security, order); Assert.AreEqual(order.Quantity, fill.FillQuantity); Assert.AreEqual(security.Price - slip, fill.FillPrice); Assert.AreEqual(OrderStatus.Filled, fill.Status); }
public void PerformsMarketFillSell() { var model = new ForexTransactionModel(); var order = new MarketOrder(Symbol, -100, DateTime.Now, type: SecurityType.Forex); var config = new SubscriptionDataConfig(typeof(TradeBar), SecurityType.Forex, Symbol, Resolution.Minute, true, true, true, true, false, 0); var security = new Security(config, 1); security.SetMarketPrice(DateTime.Now, new IndicatorDataPoint(Symbol, DateTime.Now, 101.123m)); var fill = model.MarketFill(security, order); var slip = model.GetSlippageApproximation(security, order); Assert.AreEqual(order.Quantity, fill.FillQuantity); Assert.AreEqual(security.Price - slip, fill.FillPrice); Assert.AreEqual(OrderStatus.Filled, fill.Status); Assert.AreEqual(OrderStatus.Filled, order.Status); }
public void PerformsMarketFillSell() { var model = new ForexTransactionModel(); var order = new MarketOrder(Symbol, -100, DateTime.Now, type: SecurityType.Forex); var config = CreateTradeBarDataConfig(SecurityType.Forex, Symbol); var security = new Security(SecurityExchangeHours.AlwaysOpen, config, 1); security.SetLocalTimeKeeper(TimeKeeper.GetLocalTimeKeeper(TimeZones.NewYork)); security.SetMarketPrice(new IndicatorDataPoint(Symbol, DateTime.Now, 101.123m)); var fill = model.MarketFill(security, order); var slip = model.GetSlippageApproximation(security, order); Assert.AreEqual(order.Quantity, fill.FillQuantity); Assert.AreEqual(security.Price - slip, fill.FillPrice); Assert.AreEqual(OrderStatus.Filled, fill.Status); Assert.AreEqual(OrderStatus.Filled, order.Status); }
public void PerformsMarketFillBuy() { var model = new ForexTransactionModel(); var order = new MarketOrder(Symbol, 100, DateTime.Now, type: SecurityType.Forex); var config = new SubscriptionDataConfig(typeof(TradeBar), SecurityType.Forex, Symbol, Resolution.Minute, true, true, true, true, false, 0); var security = new Security(config, 1); security.SetMarketPrice(DateTime.Now, new IndicatorDataPoint(Symbol, DateTime.Now, 101.123m)); var fill = model.MarketFill(security, order); var slip = model.GetSlippageApproximation(security, order); Assert.AreEqual(order.Quantity, fill.FillQuantity); Assert.AreEqual(security.Price + slip, fill.FillPrice); Assert.AreEqual(OrderStatus.Filled, fill.Status); Assert.AreEqual(OrderStatus.Filled, order.Status); }