コード例 #1
0
        // **********************************************************************

        public static void Deactivate()
        {
            foreach (IConnector connector in connectors)
            {
                IStockProvider sp = connector as IStockProvider;
                if (sp != null)
                {
                    sp.Unsubscribe();
                }

                ITicksProvider tp = connector as ITicksProvider;
                if (tp != null)
                {
                    tp.Unsubscribe();
                }

                ISettingsProvider stp = connector as ISettingsProvider;
                if (stp != null)
                {
                    stp.Unsubscribe();
                }

                ITradesProvider trp = connector as ITradesProvider;
                if (trp != null)
                {
                    trp.Unsubscribe();
                }
            }

            Activated = false;
        }
コード例 #2
0
        // **********************************************************************

        public static void Activate()
        {
            if (!isReplayMode)
            {
                foreach (IConnector connector in connectors)
                {
                    connector.Setup();

                    IStockProvider sp = connector as IStockProvider;
                    if (sp != null)
                    {
                        if (sp == stockProvider)
                        {
                            sp.Subscribe(cfg.u.SecCode);
                        }
                        else
                        {
                            sp.Unsubscribe();
                        }
                    }

                    ITicksProvider tp = connector as ITicksProvider;
                    if (tp != null)
                    {
                        tp.Subscribe();
                    }

                    ISettingsProvider stp = connector as ISettingsProvider;
                    if (stp != null)
                    {
                        stp.Subscribe();
                    }

                    ITradesProvider trp = connector as ITradesProvider;
                    if (trp != null)
                    {
                        trp.Subscribe();
                    }
                }
            }

            Activated = true;
        }
コード例 #3
0
        // **********************************************************************

        public static void SetMode(bool replay, bool nullTader)
        {
            if (isReplayMode != replay)
            {
                if (isReplayMode = replay)
                {
                    foreach (IConnector connector in connectors)
                    {
                        IStockProvider sp = connector as IStockProvider;
                        if (sp != null)
                        {
                            sp.Unsubscribe();
                        }

                        ITicksProvider tp = connector as ITicksProvider;
                        if (tp != null)
                        {
                            tp.Unsubscribe();
                        }

                        ISettingsProvider stp = connector as ISettingsProvider;
                        if (stp != null)
                        {
                            stp.Unsubscribe();
                        }

                        ITradesProvider trp = connector as ITradesProvider;
                        if (trp != null)
                        {
                            trp.Unsubscribe();
                        }
                    }
                }
            }

            isNullTrader = nullTader;

            Activate();
        }