private static void Trade(AccountPosition accountPosition) { string code = "m1705"; OrderInfo order = new OrderInfo(code, 20170601.093101, OpenCloseType.Open, 3110, 15, OrderSide.Buy); OrderInfo order2 = new OrderInfo(code, 20170601.093201, OpenCloseType.Open, 3120, 15, OrderSide.Buy); accountPosition.SendPosition(order, 5); accountPosition.SendPosition(order2, 10); Console.WriteLine(accountPosition); OrderInfo order_Sell = new OrderInfo(code, 20170601.093101, OpenCloseType.Close, 3110, 5, OrderSide.Buy); OrderInfo order2_Sell = new OrderInfo(code, 20170601.093201, OpenCloseType.Close, 3120, 10, OrderSide.Buy); accountPosition.SendPosition(order_Sell, 5); accountPosition.SendPosition(order2_Sell, 10); Console.WriteLine(accountPosition); }
/// <summary> /// /// </summary> /// <param name="priceGetter"></param> public void ChangeTime(double time, IPriceGetter priceGetter) { lock (lockObj) { List <OrderInfo> orders = accountOrder.TodayOrderInfos; for (int i = 0; i < orders.Count; i++) { OrderInfo order = orders[i]; string code = order.Instrumentid; int mount = accountOrder.CalcOrder(order, priceGetter.GetBuyPrice(code), priceGetter.GetBuyMount(code)); if (mount > 0) { accountPosition.SendPosition(order, mount); } } } }