예제 #1
0
 internal void method_2(Strategy strategy__1, Subscription subscription_0)
 {
     if (this.idArray_3[subscription_0.int_2] == null)
     {
         this.idArray_3[subscription_0.int_2] = new IdArray<List<Strategy>>();
     }
     if (this.idArray_3[subscription_0.int_2][subscription_0.int_3] == null)
     {
         this.idArray_3[subscription_0.int_2][subscription_0.int_3] = new List<Strateg_>();
     }
     if (this.idArray_3[subscription_0.int_2][subscription_0.int_3].Contains(strategy__1))
     {
         this.idArray_3[subscription_0.int_2][subscription_0.int_3].Remove(strategy__1);
     }
     if (this.idArray_2[subscription_0.int_2] == null)
     {
         this.idArray_2[subscription_0.int_2] = new List<Strategy_>();
     }
     if (this.idArray_2[subscription_0.int_2].Contains(strategy__1))
     {
         this.idArray_2[subscription_0.int_2].Remove(strategy__1);
     }
 }
예제 #2
0
 public Stop(Strategy strategy, Position position, DateTime time)
 {
     this.type = StopType.Trailing;
     this.mode = StopMode.Percent;
     this.traceOnQuote = true;
     this.traceOnTrade = true;
     this.traceOnBar = true;
     this.traceOnBarOpen = true;
     this.trailOnOpen = true;
     this.filterBarSize = -1L;
     this.filterBarType = BarType.Time;
     this.fillMode = StopFillMode.Stop;
     this.strategy = strategy;
     this.position = position;
     this.instrument = position.Instrument;
     this.qty = position.Qty;
     this.side = position.Side;
     this.type = StopType.Time;
     this.creationTime = strategy.Framework.Clock.DateTime;
     this.completionTime = time;
     this.stopPrice = GetInstrumentPrice();
     if (this.completionTime > this.creationTime)
     {
         strategy.Framework.Clock.AddReminder(new Reminder(this.method_9, this.completionTime, null));
     }
 }
예제 #3
0
 public Stop(Strategy strategy, Position position, double level, StopType type, StopMode mode)
 {
     this.type = StopType.Trailing;
     this.mode = StopMode.Percent;
     this.traceOnQuote = true;
     this.traceOnTrade = true;
     this.traceOnBar = true;
     this.traceOnBarOpen = true;
     this.trailOnOpen = true;
     this.filterBarSize = -1L;
     this.filterBarType = BarType.Time;
     this.fillMode = StopFillMode.Stop;
     this.strategy = strategy;
     this.position = position;
     this.instrument = position.Instrument;
     this.qty = position.Qty;
     this.side = position.Side;
     this.level = level;
     this.type = type;
     this.mode = mode;
     this.currPrice = GetInstrumentPrice();
     this.trailPrice = this.currPrice;
     this.stopPrice = GetStopPrice();
     this.creationTime = strategy.Framework.Clock.DateTime;
     this.completionTime = DateTime.MinValue;
     this.method_0();
 }
예제 #4
0
 public void Start(Strategy strategy, StrategyMode mode)
 {
     if (this.Status != StrategyStatus.Running)
     {
         this.strategy__0 = strategy;
         this.Mode = mode;
         this.method_39(StrategyStatusType.Started);
         this.method_40();
         if (this.Persistence != StrategyPersistence.Full)
         {
             if (this.Persistence != StrategyPersistence.Save)
             {
                 this.framework.orderManager_0.bool_0 = false;
                 goto IL_74;
             }
         }
         this.framework.orderServer_0.SeriesName = strategy.Name;
         this.framework.orderManager_0.bool_0 = true;
         IL_74:
         if (this.Persistence == StrategyPersistence.Full || this.Persistence == StrategyPersistence.Load)
         {
             this.framework.portfolioManager_0.Load(strategy.Name);
             this.framework.orderManager_0.Load(strategy.Name, -1);
         }
         this.Status = StrategyStatus.Running;
         if (mode == StrategyMode.Backtest && !this.framework.bool_6)
         {
             this.framework.providerManager_0.idataSimulator_0.RunOnSubscribe = false;
         }
         strategy.icojrGfcqNm();
         if ((this.Persistence == StrategyPersistence.Full || this.Persistence == StrategyPersistence.Save) && !strategy.Portfolio.iEcAijqtwI)
         {
             this.framework.portfolioManager_0.Save(strategy.Portfolio);
         }
         strategy.vmethod_0(mode);
         if (mode == StrategyMode.Backtest && !this.framework.bool_6)
         {
             this.framework.providerManager_0.idataSimulator_0.Run();
             this.framework.providerManager_0.idataSimulator_0.RunOnSubscribe = true;
         }
     }
 }
예제 #5
0
 internal void method_0(Strategy strategy__1)
 {
     this.list_0.Add(strategy__1);
     this.idArray_0[strategy__1.Id] = strategy__1;
     this.idArray_1[strategy__1.Portfolio.int_0] = strategy__1;
 }
예제 #6
0
 internal void method_7(Strategy strategy__1)
 {
     FieldInfo[] fields = strategy__1.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
     for (int i = 0; i < fields.Length; i++)
     {
         FieldInfo fieldInfo = fields[i];
         if (fieldInfo.GetCustomAttributes(typeof(ParameterAttribute), true).Length != 0)
         {
             fieldInfo.SetValue(strategy__1, fieldInfo.GetValue(this));
         }
     }
     PropertyInfo[] properties = strategy__1.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
     for (int i = 0; i < properties.Length; i++)
     {
         PropertyInfo propertyInfo = properties[i];
         if (propertyInfo.GetCustomAttributes(typeof(ParameterAttribute), true).Length != 0 && propertyInfo.CanWrite)
         {
             propertyInfo.SetValue(strategy__1, propertyInfo.GetValue(this));
         }
     }
 }
예제 #7
0
 public virtual void Add(Strategy strategy)
 {
     this.method_5(strategy);
 }
예제 #8
0
 internal void method_5(Strategy strategy__1)
 {
     if (strategy__1.Parent != null)
     {
         Console.WriteLine("Strategy::Add Can not add a startegy that already has a parent " + strategy__1);
         return;
     }
     if (strategy__1.Id == -1)
     {
         strategy__1.Id = StrategyManager.GetNextId();
     }
     strategy__1.Parent = this;
     this.Strategies.Add(strategy__1);
     if (this.Status == StrategyStatus.Running)
     {
         strategy__1.icojrGfcqNm();
         strategy__1.vmethod_0(this.Mode);
     }
 }