public static decimal PickUpClosurePrice(InstrumentValueLayer layer) { decimal closure = default(decimal); if (layer != null) { if (layer.Index == 0) { closure = layer.ClosurePrice; } else { closure = layer.ClosurePrice * Multiplier; } } return closure; }
public static decimal PickUpInitiatePrice(InstrumentValueLayer layer) { decimal initial = default(decimal); if (layer != null) { initial = layer.InitiatePrice * Multiplier; } return initial; }
static InstrumentValueLayer() { MaxValue = 999999999999999999m; MinValue = default(decimal); Zero = new InstrumentValueLayer() { Index = 0, Name = "全部", InitiatePrice = default(decimal), ClosurePrice = MaxValue }; First = new InstrumentValueLayer() { Index = 1, Name = "0-10", InitiatePrice = 0.0m, ClosurePrice = 10.0m }; Second = new InstrumentValueLayer() { Index = 2, Name = "10-20", InitiatePrice = 10.0m, ClosurePrice = 20.0m }; Third = new InstrumentValueLayer() { Index = 3, Name = "20-30", InitiatePrice = 20.0m, ClosurePrice = 30.0m }; Forth = new InstrumentValueLayer() { Index = 4, Name = "30-40", InitiatePrice = 30.0m, ClosurePrice = 40.0m }; Fifth = new InstrumentValueLayer() { Index = 5, Name = "40-50", InitiatePrice = 40.0m, ClosurePrice = 50.0m }; Sixth = new InstrumentValueLayer() { Index = 6, Name = "50-60", InitiatePrice = 50.0m, ClosurePrice = 60.0m }; Seventh = new InstrumentValueLayer() { Index = 7, Name = "60-70", InitiatePrice = 60.0m, ClosurePrice = 70.0m }; Eighth = new InstrumentValueLayer() { Index = 8, Name = "70-80", InitiatePrice = 70.0m, ClosurePrice = 80.0m }; Ninth = new InstrumentValueLayer() { Index = 9, Name = "80-90", InitiatePrice = 80.0m, ClosurePrice = 90.0m }; Multiplier = 10000.0m; InstruValueLayers = new Dictionary<int, InstrumentValueLayer>(); InstruValueLayers.Add(Zero.Index, Zero); InstruValueLayers.Add(First.Index, First); InstruValueLayers.Add(Second.Index, Second); InstruValueLayers.Add(Third.Index, Third); InstruValueLayers.Add(Forth.Index, Forth); InstruValueLayers.Add(Fifth.Index, Fifth); InstruValueLayers.Add(Sixth.Index, Sixth); InstruValueLayers.Add(Seventh.Index, Seventh); InstruValueLayers.Add(Eighth.Index, Eighth); InstruValueLayers.Add(Ninth.Index, Ninth); }