public static bool ReadOrderCondition(this IFixReader reader, FixTags tag, TimeZoneInfo timeZone, string dateTimeFormat, Func <QuikOrderCondition> getCondition) { if (getCondition == null) { throw new ArgumentNullException(nameof(getCondition)); } switch ((QuikFixTags)tag) { case QuikFixTags.Type: getCondition().Type = (QuikOrderConditionTypes)reader.ReadInt(); return(true); case QuikFixTags.StopPriceCondition: getCondition().StopPriceCondition = (QuikStopPriceConditions)reader.ReadInt(); return(true); case QuikFixTags.ConditionOrderSide: getCondition().ConditionOrderSide = (Sides)reader.ReadInt(); return(true); case QuikFixTags.LinkedOrderCancel: getCondition().LinkedOrderCancel = reader.ReadBool(); return(true); case QuikFixTags.Result: getCondition().Result = (QuikOrderConditionResults)reader.ReadInt(); return(true); case QuikFixTags.OtherSecurityCode: getCondition().OtherSecurityId = new SecurityId { SecurityCode = reader.ReadString() }; return(true); case QuikFixTags.StopPrice: getCondition().StopPrice = reader.ReadDecimal(); return(true); case QuikFixTags.StopLimitPrice: getCondition().StopLimitPrice = reader.ReadDecimal(); return(true); case QuikFixTags.IsMarketStopLimit: getCondition().IsMarketStopLimit = reader.ReadBool(); return(true); case QuikFixTags.ActiveTimeFrom: if (getCondition().ActiveTime == null) { getCondition().ActiveTime = new Range <DateTimeOffset>(); } getCondition().ActiveTime.Min = reader.ReadDateTime(dateTimeFormat).ToDateTimeOffset(timeZone); return(true); case QuikFixTags.ActiveTimeTo: if (getCondition().ActiveTime == null) { getCondition().ActiveTime = new Range <DateTimeOffset>(); } getCondition().ActiveTime.Max = reader.ReadDateTime(dateTimeFormat).ToDateTimeOffset(timeZone); return(true); case QuikFixTags.ConditionOrderId: getCondition().ConditionOrderId = reader.ReadLong(); return(true); case QuikFixTags.ConditionOrderPartiallyMatched: getCondition().ConditionOrderPartiallyMatched = reader.ReadBool(); return(true); case QuikFixTags.ConditionOrderUseMatchedBalance: getCondition().ConditionOrderUseMatchedBalance = reader.ReadBool(); return(true); case QuikFixTags.LinkedOrderPrice: getCondition().LinkedOrderPrice = reader.ReadDecimal(); return(true); case QuikFixTags.Offset: getCondition().Offset = reader.ReadString().ToUnit(); return(true); case QuikFixTags.StopSpread: getCondition().Spread = reader.ReadString().ToUnit(); return(true); case QuikFixTags.IsMarketTakeProfit: getCondition().IsMarketTakeProfit = reader.ReadBool(); return(true); default: return(false); } }
public static bool ReadOrderCondition(this IFixReader reader, FixTags tag, TimeSpan dateTimeOffset, QuikOrderCondition condition) { switch ((QuikFixTags)tag) { case QuikFixTags.Type: condition.Type = (QuikOrderConditionTypes)reader.ReadInt(); return(true); case QuikFixTags.StopPriceCondition: condition.StopPriceCondition = (QuikStopPriceConditions)reader.ReadInt(); return(true); case QuikFixTags.ConditionOrderSide: condition.ConditionOrderSide = (Sides)reader.ReadInt(); return(true); case QuikFixTags.LinkedOrderCancel: condition.LinkedOrderCancel = reader.ReadBool(); return(true); case QuikFixTags.Result: condition.Result = (QuikOrderConditionResults)reader.ReadInt(); return(true); case QuikFixTags.OtherSecurityCode: condition.OtherSecurityId = new SecurityId { SecurityCode = reader.ReadString() }; return(true); case QuikFixTags.StopPrice: condition.StopPrice = reader.ReadDecimal(); return(true); case QuikFixTags.StopLimitPrice: condition.StopLimitPrice = reader.ReadDecimal(); return(true); case QuikFixTags.IsMarketStopLimit: condition.IsMarketStopLimit = reader.ReadBool(); return(true); case QuikFixTags.ActiveTimeFrom: if (condition.ActiveTime == null) { condition.ActiveTime = new Range <DateTimeOffset>(); } condition.ActiveTime.Min = reader.ReadDateTime().ApplyTimeZone(dateTimeOffset); return(true); case QuikFixTags.ActiveTimeTo: if (condition.ActiveTime == null) { condition.ActiveTime = new Range <DateTimeOffset>(); } condition.ActiveTime.Max = reader.ReadDateTime().ApplyTimeZone(dateTimeOffset); return(true); case QuikFixTags.ConditionOrderId: condition.ConditionOrderId = reader.ReadLong(); return(true); case QuikFixTags.ConditionOrderPartiallyMatched: condition.ConditionOrderPartiallyMatched = reader.ReadBool(); return(true); case QuikFixTags.ConditionOrderUseMatchedBalance: condition.ConditionOrderUseMatchedBalance = reader.ReadBool(); return(true); case QuikFixTags.LinkedOrderPrice: condition.LinkedOrderPrice = reader.ReadDecimal(); return(true); case QuikFixTags.Offset: condition.Offset = reader.ReadString().ToUnit(); return(true); case QuikFixTags.StopSpread: condition.Spread = reader.ReadString().ToUnit(); return(true); case QuikFixTags.IsMarketTakeProfit: condition.IsMarketTakeProfit = reader.ReadBool(); return(true); default: return(false); } }