public static IOrder Create(string type) { IOrder order; switch (type) { case OrderType.Limit: order = new LimitOrder(); break; case OrderType.Market: order = new MarketOrder(); break; case OrderType.MarketIfTouched: order = new MarketIfTouchedOrder(); break; case OrderType.Stop: order = new StopOrder(); break; case OrderType.StopLoss: order = new StopLossOrder(); break; case OrderType.TakeProfit: order = new TakeProfitOrder(); break; case OrderType.TrailingStopLoss: order = new TrailingStopLossOrder(); break; default: order = new Order(); break; } order.type = type; return(order); }
public Trade() { this.Id = new TradeID(); this.Instrument = new InstrumentName(); this.Price = new PriceValue(); this.OpenTime = new DateTime(); this.State = new TradeState(); this.InitialMarginRequired = new AccountUnits(); this.RealizedPL = new AccountUnits(); this.UnrealizedPL = new AccountUnits(); this.MarginUsed = new AccountUnits(); this.AverageClosePrice = new PriceValue(); this.ClosingTransactionIDs = new List <TransactionID>(); this.Financing = new AccountUnits(); this.CloseTime = new DateTime(); this.ClientExtensions = new ClientExtensions(); this.takeProfitOrder = new TakeProfitOrder(); this.StopLossOrder = new StopLossOrder(); this.TrailingStopLossOrder = new TrailingStopLossOrder(); }
public Trade(TradeID id, InstrumentName instrument, PriceValue price, DateTime openTime, TradeState state, double initialUnits, AccountUnits initialMarginRequired, double currentUnits, AccountUnits realizedPL, AccountUnits unrealizedPL, AccountUnits marginUsed, PriceValue averageClosePrice, List <TransactionID> closingTransactionIDs, AccountUnits financing, DateTime closeTime, ClientExtensions clientExtensions, TakeProfitOrder takeProfitOrder, StopLossOrder stopLossOrder, TrailingStopLossOrder trailingStopLossOrder) { this.Id = id; this.Instrument = instrument; this.Price = price; this.OpenTime = openTime; this.State = state; this.InitialUnits = initialUnits; this.InitialMarginRequired = initialMarginRequired; this.CurrentUnits = currentUnits; this.RealizedPL = realizedPL; this.UnrealizedPL = unrealizedPL; this.MarginUsed = marginUsed; this.AverageClosePrice = averageClosePrice; this.ClosingTransactionIDs = closingTransactionIDs; this.Financing = financing; this.CloseTime = closeTime; this.ClientExtensions = clientExtensions; this.takeProfitOrder = takeProfitOrder; this.StopLossOrder = stopLossOrder; this.TrailingStopLossOrder = trailingStopLossOrder; }