public static NewStopOrderElement CreateStopLoss(TransaqOrderCondition cond) { if (cond == null) { throw new ArgumentNullException("cond"); } return(new NewStopOrderElement { ActivationPrice = cond.StopLossActivationPrice, OrderPrice = cond.StopLossOrderPrice == null ? null : cond.StopLossOrderPrice.ToString(), ByMarket = cond.StopLossByMarket, Quantity = cond.StopLossVolume.ToString(), UseCredit = cond.StopLossUseCredit, GuardTime = cond.StopLossGuardTime, BrokerRef = cond.StopLossComment }); }
public static bool CheckConditionUnitType(this TransaqOrderCondition cond) { if (cond == null) { throw new ArgumentNullException("cond"); } if ((cond.StopLossOrderPrice != null && cond.StopLossOrderPrice.Type != UnitTypes.Absolute & cond.StopLossOrderPrice.Type != UnitTypes.Percent) || (cond.StopLossVolume != null && cond.StopLossVolume.Type != UnitTypes.Absolute & cond.StopLossVolume.Type != UnitTypes.Percent) || (cond.TakeProfitVolume != null && cond.TakeProfitVolume.Type != UnitTypes.Absolute & cond.TakeProfitVolume.Type != UnitTypes.Percent) || (cond.TakeProfitCorrection != null && cond.TakeProfitCorrection.Type != UnitTypes.Absolute & cond.TakeProfitCorrection.Type != UnitTypes.Percent) || (cond.TakeProfitGuardSpread != null && cond.TakeProfitGuardSpread.Type != UnitTypes.Absolute & cond.TakeProfitGuardSpread.Type != UnitTypes.Percent)) { return(false); } return(true); }
public static NewStopOrderElement CreateTakeProfit(TransaqOrderCondition cond) { if (cond == null) { throw new ArgumentNullException("cond"); } return(new NewStopOrderElement { ActivationPrice = cond.TakeProfitActivationPrice, ByMarket = cond.TakeProfitByMarket, Quantity = cond.TakeProfitVolume.ToString(), UseCredit = cond.TakeProfitUseCredit, GuardTime = cond.TakeProfitGuardTime, BrokerRef = cond.TakeProfitComment, Correction = cond.TakeProfitCorrection == null ? null : cond.TakeProfitCorrection.ToString(), Spread = cond.TakeProfitGuardSpread == null ? null : cond.TakeProfitGuardSpread.ToString() }); }