public Account(string accountId, double money, IDataForward_Code historyDataForward_Code) { this.accountId = accountId; this.accountTrade = new AccountTrade(money); this.priceGetter = new PriceGetter_HistoryDataForward_Code(historyDataForward_Code); this.priceGetter.timeChange += PriceGetter_timeChange; }
public void TestAccountTradeSendOrder() { List <AccountFeeInfo> feeInfo = new List <AccountFeeInfo>(); feeInfo.Add(new AccountFeeInfo("m1705", 10, 10, 3, CommissionChargeCalcType.Fix)); AccountFee fee = new AccountFee(feeInfo); AccountTrade accountTrade = new AccountTrade(100000, fee); MockPriceGetter priceGetter = new MockPriceGetter(); 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); priceGetter.ChangePattern(0); accountTrade.SendOrder(order); accountTrade.SendOrder(order2); accountTrade.ChangeTime(20170601.093300, priceGetter); //accountTrade.ChangeTime(20170103.093001,) Console.WriteLine(accountTrade); priceGetter.ChangePattern(1); OrderInfo order_Sell = new OrderInfo(code, 20170601.093501, OpenCloseType.Close, 3110, 5, OrderSide.Buy); OrderInfo order2_Sell = new OrderInfo(code, 20170601.093505, OpenCloseType.Close, 3120, 10, OrderSide.Buy); accountTrade.SendOrder(order_Sell); accountTrade.SendOrder(order2_Sell); accountTrade.ChangeTime(20170601.093300, priceGetter); Assert.AreEqual(25, accountTrade.AccountPosition.GetAllPositions()[0].Position); Console.WriteLine(accountTrade); }
public Account(string accountId, double initMoney, IDataForward historyDataForward) { this.accountId = accountId; this.accountTrade = new AccountTrade(initMoney); }