Ejemplo n.º 1
0
 protected StrategyBase(string name, string description)
 {
     this.metaStrategyBase = null;
     this.name             = name;
     this.description      = description;
     this.isEnabled        = true;
     this.isActive         = true;
     this.ReportManager    = (StrategyComponentManager.GetComponent("{5E7810DC-C9C1-427f-8CD9-1DFFE26E59B5}", this) as ReportManager);
     this.MarketManager    = (StrategyComponentManager.GetComponent("{849E4CFE-C19E-4d1e-899D-0BB26DB12AAD}", this) as MarketManager);
     this.portfolio        = PortfolioManager.Portfolios[name];
     if (this.portfolio == null)
     {
         this.portfolio = new Portfolio(name);
     }
     this.tester             = new LiveTester(this.portfolio);
     this.stops              = new StopList();
     this.triggers           = new TriggerList();
     this.marketDataProvider = null;
     this.executionProvider  = null;
     this.newsProvider       = null;
     this.executionService   = null;
     this.orders             = new OrderTable();
     this.global             = new Hashtable();
     this.activeInstruments  = new InstrumentList();
     this.barSliceManager    = new BarSliceManager();
     this.componentTypeList  = new List <ComponentType>();
     this.componentTypeList.Add(ComponentType.MarketManager);
     this.componentTypeList.Add(ComponentType.ReportManager);
     this.activeStops = new Dictionary <Instrument, List <StopBase> >();
     this.portfolios  = new Dictionary <Instrument, Portfolio>();
     this.testers     = new Dictionary <Instrument, LiveTester>();
     this.statisticsPerInstrumentEnabled = false;
 }
Ejemplo n.º 2
0
 public ATSStrategy(string name, string description) : base(name, description)
 {
     this.ATSCrossComponent = (StrategyComponentManager.GetComponent("{E70A6417-E7FA-4ec1-BC16-B03DE53C6E85}", this) as ATSCrossComponent);
     this.ATSComponent      = (StrategyComponentManager.GetComponent("{AC3C53E2-6C94-4718-A5D8-8A475D8B4EB7}", this) as ATSComponent);
     this.atsComponents     = new Dictionary <Instrument, ATSComponent>();
     this.componentTypeList.Add(ComponentType.ATSComponent);
     this.componentTypeList.Add(ComponentType.ATSCrossComponent);
 }
Ejemplo n.º 3
0
 public MetaStrategy(string name) : base(name)
 {
     this.MetaExposureManager = (StrategyComponentManager.GetComponent("{2DBD0B38-8399-4d0b-9FAA-7C29FC1462BC}", this) as MetaExposureManager);
     this.ExecutionManager    = (StrategyComponentManager.GetComponent("{D106D35A-E1E4-4e86-8869-846289E98232}", this) as ExecutionManager);
     this.MetaRiskManager     = (StrategyComponentManager.GetComponent("{521B9C4F-01AE-4488-B4A5-104027D06BB8}", this) as MetaRiskManager);
     this.signals             = new SignalList();
     this.componentTypeList.Add(ComponentType.MetaRiskManager);
     this.componentTypeList.Add(ComponentType.MetaExposureManager);
     this.componentTypeList.Add(ComponentType.ExecutionManager);
 }
Ejemplo n.º 4
0
 public Strategy(string name, string description) : base(name, description)
 {
     this.CrossExit       = (StrategyComponentManager.GetComponent("{D779BA8E-C0CA-44cf-8745-99105365882F}", this) as CrossExit);
     this.CrossEntry      = (StrategyComponentManager.GetComponent("{664274F3-FDE1-46da-A84F-556E4A0EB170}", this) as CrossEntry);
     this.Entry           = (StrategyComponentManager.GetComponent("{94FAFF9D-5281-4c67-A599-B893F1F58B38}", this) as Entry);
     this.Exit            = (StrategyComponentManager.GetComponent("{6FEE0044-0FD2-418d-94E6-400834BEE5D3}", this) as Exit);
     this.MoneyManager    = (StrategyComponentManager.GetComponent("{9637DF40-0F84-46e3-AC54-0EC2D2CE2699}", this) as MoneyManager);
     this.RiskManager     = (StrategyComponentManager.GetComponent("{BE0176A8-3BBD-407c-814A-D5A3E3437899}", this) as RiskManager);
     this.ExposureManager = (StrategyComponentManager.GetComponent("{0449D7E3-2016-47f6-9B80-C787B3E0F18F}", 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);
 }
 public static IComponentBase GetComponent(string guid, object issuer)
 {
     return(StrategyComponentManager.GetComponent(new Guid(guid), issuer));
 }
        public static IComponentBase GetDefaultComponent(ComponentType type, object issuer)
        {
            if (type <= ComponentType.MetaExposureManager)
            {
                if (type <= ComponentType.MoneyManager)
                {
                    switch (type)
                    {
                    case ComponentType.Entry:
                        return(StrategyComponentManager.GetComponent("{94FAFF9D-5281-4c67-A599-B893F1F58B38}", issuer));

                    case (ComponentType)3:
                        break;

                    case ComponentType.Exit:
                        return(StrategyComponentManager.GetComponent("{6FEE0044-0FD2-418d-94E6-400834BEE5D3}", issuer));

                    default:
                        if (type == ComponentType.ExposureManager)
                        {
                            return(StrategyComponentManager.GetComponent("{0449D7E3-2016-47f6-9B80-C787B3E0F18F}", issuer));
                        }
                        if (type == ComponentType.MoneyManager)
                        {
                            return(StrategyComponentManager.GetComponent("{9637DF40-0F84-46e3-AC54-0EC2D2CE2699}", issuer));
                        }
                        break;
                    }
                }
                else if (type <= ComponentType.MarketManager)
                {
                    if (type == ComponentType.RiskManager)
                    {
                        return(StrategyComponentManager.GetComponent("{BE0176A8-3BBD-407c-814A-D5A3E3437899}", issuer));
                    }
                    if (type == ComponentType.MarketManager)
                    {
                        return(StrategyComponentManager.GetComponent("{849E4CFE-C19E-4d1e-899D-0BB26DB12AAD}", issuer));
                    }
                }
                else
                {
                    if (type == ComponentType.OptimizationManager)
                    {
                        return(StrategyComponentManager.GetComponent("{A4D510F9-13DB-4b4c-9557-BC6A48A25D0B}", issuer));
                    }
                    if (type == ComponentType.MetaExposureManager)
                    {
                        return(StrategyComponentManager.GetComponent("{2DBD0B38-8399-4d0b-9FAA-7C29FC1462BC}", issuer));
                    }
                }
            }
            else if (type <= ComponentType.MetaRiskManager)
            {
                if (type <= ComponentType.ExecutionManager)
                {
                    if (type == ComponentType.SimulationManager)
                    {
                        return(StrategyComponentManager.GetComponent("{872476E5-3774-4687-828F-34978288A6E0}", issuer));
                    }
                    if (type == ComponentType.ExecutionManager)
                    {
                        return(StrategyComponentManager.GetComponent("{D106D35A-E1E4-4e86-8869-846289E98232}", issuer));
                    }
                }
                else
                {
                    if (type == ComponentType.MetaMoneyManager)
                    {
                        return(StrategyComponentManager.GetComponent("{FED5076A-C710-4d3a-B134-3D9D32B8B248}", issuer));
                    }
                    if (type == ComponentType.MetaRiskManager)
                    {
                        return(StrategyComponentManager.GetComponent("{521B9C4F-01AE-4488-B4A5-104027D06BB8}", issuer));
                    }
                }
            }
            else if (type <= ComponentType.ATSComponent)
            {
                if (type == ComponentType.ReportManager)
                {
                    return(StrategyComponentManager.GetComponent("{5E7810DC-C9C1-427f-8CD9-1DFFE26E59B5}", issuer));
                }
                if (type == ComponentType.ATSComponent)
                {
                    return(StrategyComponentManager.GetComponent("{AC3C53E2-6C94-4718-A5D8-8A475D8B4EB7}", issuer));
                }
            }
            else
            {
                if (type == ComponentType.CrossEntry)
                {
                    return(StrategyComponentManager.GetComponent("{664274F3-FDE1-46da-A84F-556E4A0EB170}", issuer));
                }
                if (type == ComponentType.ATSCrossComponent)
                {
                    return(StrategyComponentManager.GetComponent("{E70A6417-E7FA-4ec1-BC16-B03DE53C6E85}", issuer));
                }
            }
            return(null);
        }