示例#1
0
        public override void SetComponent(ComponentType type, IComponentBase component)
        {
            switch (type)
            {
            case ComponentType.CrossEntry:
                this.CrossEntry = component as CrossEntry;
                break;

            case ComponentType.CrossExit:
                this.CrossExit = component as CrossExit;
                break;

            case ComponentType.MarketManager:
                this.MarketManager = component as MarketManager;
                break;

            case ComponentType.ReportManager:
                this.ReportManager = component as ReportManager;
                break;

            case ComponentType.MoneyManager:
                this.MoneyManager = component as MoneyManager;
                break;

            case ComponentType.RiskManager:
                this.RiskManager = component as RiskManager;
                break;

            case ComponentType.Entry:
                this.Entry = component as Entry;
                break;

            case ComponentType.Exit:
                this.Exit = component as Exit;
                break;

            case ComponentType.ExposureManager:
                this.ExposureManager = component as ExposureManager;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
示例#2
0
 public Strategy(string name, string description)
     : base(name, description)
 {
     this.CrossExit       = StrategyComponentManager.GetComponent("GetComponent", (object)this) as CrossExit;
     this.CrossEntry      = StrategyComponentManager.GetComponent("GetComponent", (object)this) as CrossEntry;
     this.Entry           = StrategyComponentManager.GetComponent("GetComponent", (object)this) as Entry;
     this.Exit            = StrategyComponentManager.GetComponent("GetComponent", (object)this) as Exit;
     this.MoneyManager    = StrategyComponentManager.GetComponent("GetComponent", (object)this) as MoneyManager;
     this.RiskManager     = StrategyComponentManager.GetComponent("GetComponent", (object)this) as RiskManager;
     this.ExposureManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as ExposureManager;
     this.entries         = new Dictionary <Instrument, Entry>();
     this.exits           = new Dictionary <Instrument, Exit>();
     this.moneyManagers   = new Dictionary <Instrument, MoneyManager>();
     this.riskManagers    = new Dictionary <Instrument, RiskManager>();
     this.componentTypeList.Add(ComponentType.Entry);
     this.componentTypeList.Add(ComponentType.Exit);
     this.componentTypeList.Add(ComponentType.CrossEntry);
     this.componentTypeList.Add(ComponentType.CrossExit);
     this.componentTypeList.Add(ComponentType.RiskManager);
     this.componentTypeList.Add(ComponentType.MoneyManager);
     this.componentTypeList.Add(ComponentType.ExposureManager);
 }
示例#3
0
文件: Strategy.cs 项目: heber/FreeOQ
 public override void SetComponent(ComponentType type, IComponentBase component)
 {
   switch (type)
   {
     case ComponentType.CrossEntry:
       this.CrossEntry = component as CrossEntry;
       break;
     case ComponentType.CrossExit:
       this.CrossExit = component as CrossExit;
       break;
     case ComponentType.MarketManager:
       this.MarketManager = component as MarketManager;
       break;
     case ComponentType.ReportManager:
       this.ReportManager = component as ReportManager;
       break;
     case ComponentType.MoneyManager:
       this.MoneyManager = component as MoneyManager;
       break;
     case ComponentType.RiskManager:
       this.RiskManager = component as RiskManager;
       break;
     case ComponentType.Entry:
       this.Entry = component as Entry;
       break;
     case ComponentType.Exit:
       this.Exit = component as Exit;
       break;
     case ComponentType.ExposureManager:
       this.ExposureManager = component as ExposureManager;
       break;
     default:
       throw new InvalidOperationException();
   }
 }
示例#4
0
文件: Strategy.cs 项目: heber/FreeOQ
    public Strategy(string name, string description)
			: base(name, description) {

			this.CrossExit = StrategyComponentManager.GetComponent("GetComponent", (object) this) as CrossExit;
			this.CrossEntry = StrategyComponentManager.GetComponent("GetComponent", (object) this) as CrossEntry;
			this.Entry = StrategyComponentManager.GetComponent("GetComponent", (object) this) as Entry;
			this.Exit = StrategyComponentManager.GetComponent("GetComponent", (object) this) as Exit;
			this.MoneyManager = StrategyComponentManager.GetComponent("GetComponent", (object) this) as MoneyManager;
			this.RiskManager = StrategyComponentManager.GetComponent("GetComponent", (object) this) as RiskManager;
			this.ExposureManager = StrategyComponentManager.GetComponent("GetComponent", (object) this) as ExposureManager;
      this.entries = new Dictionary<Instrument, Entry>();
      this.exits = new Dictionary<Instrument, Exit>();
      this.moneyManagers = new Dictionary<Instrument, MoneyManager>();
      this.riskManagers = new Dictionary<Instrument, RiskManager>();
      this.componentTypeList.Add(ComponentType.Entry);
      this.componentTypeList.Add(ComponentType.Exit);
      this.componentTypeList.Add(ComponentType.CrossEntry);
      this.componentTypeList.Add(ComponentType.CrossExit);
      this.componentTypeList.Add(ComponentType.RiskManager);
      this.componentTypeList.Add(ComponentType.MoneyManager);
      this.componentTypeList.Add(ComponentType.ExposureManager);
    }