コード例 #1
0
 public static void RemoveComponent(ComponentRecord record)
 {
     record.File.Delete();
     StrategyComponentManager.wcrRFbhwry.fc56KRbFEA(record);
     StrategyComponentManager.gLhRsqD2VZ.Remove((object)record);
     StrategyComponentManager.IP7RCltgOJ(record);
 }
コード例 #2
0
ファイル: StrategyBase.cs プロジェクト: zhuzhenping/FreeOQ
 protected StrategyBase(string name, string description)
 {
     this.metaStrategyBase = (MetaStrategyBase)null;
     this.name             = name;
     this.description      = description;
     this.isEnabled        = true;
     this.isActive         = true;
     this.ReportManager    = StrategyComponentManager.GetComponent("getcom", (object)this) as ReportManager;
     this.MarketManager    = StrategyComponentManager.GetComponent("getcom", (object)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 = (IMarketDataProvider)null;
     this.executionProvider  = (IExecutionProvider)null;
     this.newsProvider       = (INewsProvider)null;
     this.executionService   = (IExecutionService)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;
 }
コード例 #3
0
 private static void qGjRTr4ZHe()
 {
     foreach (Type runtimeType in (IEnumerable)StrategyComponentManager.ComponentRuntimeTypes)
     {
         StrategyComponentManager.RegisterDefaultComponent(runtimeType);
     }
 }
コード例 #4
0
 static StrategyComponentManager()
 {
     StrategyComponentManager.tuxR3OBtRK = new Hashtable();
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.CrossEntry, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.CrossExit, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.Entry, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.Exit, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.ExecutionManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.ExposureManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.MoneyManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.RiskManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.MarketManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.OptimizationManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.ReportManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.MetaExposureManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.MetaMoneyManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.MetaRiskManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.SimulationManager, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.ATSComponent, "");
     StrategyComponentManager.tuxR3OBtRK.Add((object)ComponentType.ATSCrossComponent, "");
     StrategyComponentManager.gLhRsqD2VZ = new Hashtable();
     StrategyComponentManager.wcrRFbhwry = new StrategyComponentList();
     StrategyComponentManager.yNoRLNTZ2P = new List <string>();
     StrategyComponentManager.qGjRTr4ZHe();
 }
コード例 #5
0
        private static void sLsRSGwrU3([In] FileInfo obj0)
        {
            CompilerResults compilerResults = CompilingService.Compile(obj0.FullName, false);

            if (compilerResults.Errors.HasErrors)
            {
                ComponentRecord componentRecord = new ComponentRecord(Guid.Empty, ComponentType.Unknown, obj0.Name, "", obj0, (Type)null, compilerResults.Errors);
                StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                StrategyComponentManager.H13R1k6g2K(componentRecord);
            }
            else
            {
                bool flag = false;
                foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                {
                    ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, obj0);
                    if (componentRecord != null)
                    {
                        StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                        StrategyComponentManager.H13R1k6g2K(componentRecord);
                        flag = true;
                    }
                }
                if (flag)
                {
                    return;
                }
                ComponentRecord componentRecord1 = new ComponentRecord(Guid.Empty, ComponentType.Unknown, obj0.Name, "", obj0, (Type)null, new CompilerErrorCollection(new CompilerError[1]
                {
                    new CompilerError(obj0.FullName, -1, -1, "dfdfs", "fdsdfs")
                }));
                StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord1);
                StrategyComponentManager.H13R1k6g2K(componentRecord1);
            }
        }
コード例 #6
0
 public ATSStrategy(string name, string description)
     : base(name, description)
 {
     this.ATSCrossComponent = StrategyComponentManager.GetComponent("componentname", this) as ATSCrossComponent;
     this.ATSComponent      = StrategyComponentManager.GetComponent("componentname", this) as ATSComponent;
     this.csNiLdTRqH        = new Dictionary <Instrument, ATSComponent>();
     this.componentTypeList.Add(ComponentType.ATSComponent);
     this.componentTypeList.Add(ComponentType.ATSCrossComponent);
 }
コード例 #7
0
        public static IComponentBase GetDefaultComponent(ComponentType type, object issuer)
        {
            switch (type)
            {
            case ComponentType.CrossEntry:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.ATSCrossComponent:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.ReportManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.ATSComponent:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.MetaMoneyManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.MetaRiskManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.SimulationManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.ExecutionManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.OptimizationManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.MetaExposureManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.RiskManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.MarketManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.Entry:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.Exit:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.ExposureManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            case ComponentType.MoneyManager:
                return(StrategyComponentManager.GetComponent("getCom", issuer));

            default:
                return((IComponentBase)null);
            }
        }
コード例 #8
0
ファイル: MetaStrategy.cs プロジェクト: zhuzhenping/FreeOQ
 public MetaStrategy(string name) : base(name)
 {
     this.MetaExposureManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as MetaExposureManager;
     this.ExecutionManager    = StrategyComponentManager.GetComponent("GetComponent", (object)this) as ExecutionManager;
     this.MetaRiskManager     = StrategyComponentManager.GetComponent("GetComponent", (object)this) as MetaRiskManager;
     this.aNKR2wRnBL          = new SignalList();
     this.componentTypeList.Add(ComponentType.MetaRiskManager);
     this.componentTypeList.Add(ComponentType.MetaExposureManager);
     this.componentTypeList.Add(ComponentType.ExecutionManager);
 }
コード例 #9
0
        public static void LoadComponents()
        {
            StrategyComponentManager.idbRrwVHpr();
            FileSystemWatcher fileSystemWatcher = new FileSystemWatcher();

            fileSystemWatcher.Path                = Framework.Installation.ComponentDir.FullName;
            fileSystemWatcher.Filter              = "filer";
            fileSystemWatcher.NotifyFilter        = NotifyFilters.LastWrite;
            fileSystemWatcher.Changed            += new FileSystemEventHandler(StrategyComponentManager.uWxRhBPP9U);
            fileSystemWatcher.EnableRaisingEvents = true;
        }
コード例 #10
0
        public static IComponentBase GetComponent(Guid guid, object issuer)
        {
            ComponentRecord record1 = StrategyComponentManager.wcrRFbhwry.FindRecord(guid);

            if (record1 == null)
            {
                return((IComponentBase)null);
            }
            if (record1.IsChanged)
            {
                StrategyComponentManager.gLhRsqD2VZ.Remove((object)record1);
                CompilerResults compilerResults = CompilingService.Compile(record1.File.FullName, false);
                if (compilerResults.Errors.HasErrors)
                {
                    record1.HrjA5j3PaA(compilerResults.Errors);
                    return((IComponentBase)null);
                }
                else
                {
                    record1.VnhAiVxt7S(false);
                    foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                    {
                        ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, record1.File);
                        if (componentRecord != null)
                        {
                            record1.X8yAQiuh7R(componentRecord.RuntimeType);
                            break;
                        }
                    }
                }
            }
            Hashtable hashtable = StrategyComponentManager.gLhRsqD2VZ[(object)record1] as Hashtable;

            if (hashtable == null)
            {
                hashtable = new Hashtable();
                StrategyComponentManager.gLhRsqD2VZ.Add((object)record1, (object)hashtable);
            }
            IComponentBase componentBase = hashtable[issuer] as IComponentBase;

            if (componentBase == null)
            {
                ComponentRecord record2 = StrategyComponentManager.wcrRFbhwry.FindRecord(guid);
                componentBase             = Activator.CreateInstance(record2.RuntimeType) as IComponentBase;
                componentBase.Name        = record2.Name;
                componentBase.Description = record2.Description;
                hashtable.Add(issuer, (object)componentBase);
            }
            return(componentBase);
        }
コード例 #11
0
        public static void AddNewComponent(ComponentType componentType, string name, string description)
        {
            StreamReader streamReader = new StreamReader(Framework.Installation.ComponentDir.FullName + (string)StrategyComponentManager.tuxR3OBtRK[(object)componentType]);
            string       str1         = streamReader.ReadToEnd();

            streamReader.Close();
            string   newValue = Guid.NewGuid().ToString() + ((object)componentType).ToString() + name + description;
            string   str2     = str1.Replace("fdddfs", newValue).Replace("dfdfs", name);
            FileInfo fileInfo = new FileInfo(Framework.Installation.ComponentDir.FullName + name);

            if (fileInfo.Exists)
            {
                throw new IOException(string.Format("fdsfd", (object)fileInfo.Name));
            }
            StreamWriter text = fileInfo.CreateText();

            text.Write(str2);
            text.Close();
            StrategyComponentManager.sLsRSGwrU3(fileInfo);
        }
コード例 #12
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);
 }
コード例 #13
0
ファイル: StrategyBase.cs プロジェクト: zhuzhenping/FreeOQ
 internal void VgOXd6ZUI()
 {
     StrategyComponentManager.ClearComponentCache((object)this);
     this.metaStrategyBase = (MetaStrategyBase)null;
 }
コード例 #14
0
        private static void faQRIM6nIU([In] FileInfo[] obj0)
        {
            string source = "";
            Dictionary <string, FileInfo> dictionary = new Dictionary <string, FileInfo>();
            List <FileInfo> list1 = new List <FileInfo>();
            List <FileInfo> list2 = new List <FileInfo>();
            int             num   = 1;

            foreach (FileInfo fileInfo in obj0)
            {
                if (StrategyComponentManager.yNoRLNTZ2P.Contains(fileInfo.Name))
                {
                    StreamReader streamReader = new StreamReader(fileInfo.FullName);
                    string       index        = num.ToString();
                    dictionary[index] = fileInfo;
                    list1.Add(fileInfo);
                    source = source + index + Environment.NewLine + Environment.NewLine + streamReader.ReadToEnd() + Environment.NewLine + Environment.NewLine;
                    ++num;
                    streamReader.Close();
                }
                else
                {
                    list2.Add(fileInfo);
                }
            }
            CompilerResults compilerResults = CompilingService.CompileSource(source);

            if (compilerResults.Errors.HasErrors)
            {
                foreach (FileInfo fileInfo in obj0)
                {
                    StrategyComponentManager.sLsRSGwrU3(fileInfo);
                }
            }
            else
            {
                foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                {
                    if (type.IsPublic)
                    {
                        string   index    = type.FullName.Substring(0, type.FullName.IndexOf(""));
                        FileInfo fileInfo = dictionary[index];
                        list1.Remove(fileInfo);
                        ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, fileInfo);
                        if (componentRecord != null)
                        {
                            StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                            StrategyComponentManager.H13R1k6g2K(componentRecord);
                        }
                    }
                }
                foreach (FileInfo file in list1)
                {
                    ComponentRecord componentRecord = new ComponentRecord(Guid.Empty, ComponentType.Unknown, file.Name, "", file, (Type)null, new CompilerErrorCollection(new CompilerError[1]
                    {
                        new CompilerError(file.FullName, -1, -1, "fddfs", "trtr")
                    }));
                    StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
                    StrategyComponentManager.H13R1k6g2K(componentRecord);
                }
                foreach (FileInfo fileInfo in list2)
                {
                    StrategyComponentManager.sLsRSGwrU3(fileInfo);
                }
            }
        }
コード例 #15
0
 private static void idbRrwVHpr()
 {
     StrategyComponentManager.faQRIM6nIU(new DirectoryInfo(Framework.Installation.ComponentDir.FullName).GetFiles());
 }
コード例 #16
0
        public static void RegisterDefaultComponent(Type runtimeType)
        {
            ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(runtimeType, (FileInfo)null);

            StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord);
        }
コード例 #17
0
 public static IComponentBase GetComponent(string guid, object issuer)
 {
     return(StrategyComponentManager.GetComponent(new Guid(guid), issuer));
 }
コード例 #18
0
 public static void Init()
 {
     StrategyComponentManager.duERGEeA5M();
     StrategyComponentManager.LoadComponents();
 }
コード例 #19
0
        public static bool RebuildComponent(FileInfo file)
        {
            ComponentRecord[] records = StrategyComponentManager.wcrRFbhwry.FindRecords(file);
            foreach (ComponentRecord componentRecord in records)
            {
                componentRecord.HrjA5j3PaA(new CompilerErrorCollection());
                StrategyComponentManager.gLhRsqD2VZ.Remove((object)componentRecord);
            }
            CompilerResults compilerResults = CompilingService.Compile(file.FullName, false);

            if (compilerResults.Errors.HasErrors)
            {
                foreach (ComponentRecord componentRecord in records)
                {
                    componentRecord.HrjA5j3PaA(compilerResults.Errors);
                    StrategyComponentManager.TXQRKdObj1(componentRecord);
                }
                return(false);
            }
            else
            {
                ArrayList arrayList1 = new ArrayList();
                foreach (Type type in compilerResults.CompiledAssembly.GetTypes())
                {
                    ComponentRecord componentRecord = StrategyComponentManager.cN2R9Xa8LN(type, file);
                    if (componentRecord != null)
                    {
                        arrayList1.Add((object)componentRecord);
                    }
                }
                ArrayList arrayList2 = new ArrayList((ICollection)records);
                foreach (ComponentRecord componentRecord1 in arrayList1)
                {
                    bool flag = false;
                    foreach (ComponentRecord componentRecord2 in arrayList2)
                    {
                        if (componentRecord2.GUID == componentRecord1.GUID)
                        {
                            componentRecord2.lfVAUUDxYN(componentRecord1.Name);
                            componentRecord2.x63AOXlRIK(componentRecord1.Description);
                            componentRecord2.CvyAHpcreG(componentRecord1.ComponentType);
                            componentRecord2.X8yAQiuh7R(componentRecord1.RuntimeType);
                            componentRecord2.VnhAiVxt7S(false);
                            flag = true;
                            arrayList2.Remove((object)componentRecord2);
                            StrategyComponentManager.TXQRKdObj1(componentRecord2);
                            break;
                        }
                    }
                    if (!flag)
                    {
                        StrategyComponentManager.wcrRFbhwry.ROm6C46rfm(componentRecord1);
                        StrategyComponentManager.H13R1k6g2K(componentRecord1);
                    }
                }
                foreach (ComponentRecord componentRecord in arrayList2)
                {
                    if (componentRecord.GUID == Guid.Empty)
                    {
                        StrategyComponentManager.wcrRFbhwry.fc56KRbFEA(componentRecord);
                        StrategyComponentManager.IP7RCltgOJ(componentRecord);
                    }
                }
                return(true);
            }
        }
コード例 #20
0
 public static void AddExistingComponent(FileInfo existingFile)
 {
     StrategyComponentManager.sLsRSGwrU3(existingFile.CopyTo(Framework.Installation.ComponentDir.FullName + existingFile.Name));
 }