// funkcja pomocnicza przygotowująca typ zlecenia FIXML private static OrderType Order_GetType(OrderMainData data) { switch (data.PriceType) { case PriceType.Limit: return (data.ActivationPrice != null) ? OrderType.StopLimit : OrderType.Limit; case PriceType.PKC: return (data.ActivationPrice != null) ? OrderType.StopLoss : OrderType.PKC; default: return OrderType.PCR_PCRO; } }
// funkcja pomocnicza przygotowująca parametr FIXML TimeInForce private static OrdTimeInForce Order_GetTimeInForce(OrderMainData data) { if (data.ImmediateOrCancel) return OrdTimeInForce.WiA; if (data.MinimumQuantity == data.Quantity) return OrdTimeInForce.WuA; if (data.PriceType == PriceType.PCRO) return (DateTime.Now.Hour < 12) ? OrdTimeInForce.Opening : OrdTimeInForce.Closing; if (data.ExpirationDate != null) return OrdTimeInForce.Date; return OrdTimeInForce.Day; }
// aktualizacja danych z sieci - podstawowe dane zlecenia private void Update(OrderMainData data) { CreateTime = data.CreateTime; Instrument = BosInstrument.Create(data.Instrument); Side = data.Side; Price = BosPrice.Create(data.PriceType, data.PriceLimit); ActivationPrice = data.ActivationPrice; Quantity = data.Quantity; MinimumQuantity = data.MinimumQuantity; VisibleQuantity = data.VisibleQuantity; ImmediateOrCancel = data.ImmediateOrCancel; ExpirationDate = data.ExpirationDate; }