Esempio n. 1
0
        public void subscribeInstrument(OkexCoinType commodity, OkexCoinType currency)
        {
            uint id = genID(commodity, currency);

            if (m_stockDataSubjects.ContainsKey(id))
            {
                return;
            }

            m_stockDataSubjects[id] = new OkexStockDataSubject(commodity, currency);

            StockDataUpdater sdu = new StockDataUpdater(commodity, currency);

            m_dataUpdaters.TryAdd(id, sdu);
            sdu.start();
        }
Esempio n. 2
0
        public void unsubscribeInstrument(OkexCoinType commodity, OkexCoinType currency)
        {
            uint id = genID(commodity, currency);

            if (!m_stockDataSubjects.ContainsKey(id))
            {
                return;
            }

            OkexStockDataSubject sbj;

            m_stockDataSubjects.TryRemove(id, out sbj);
            if (m_dataUpdaters.ContainsKey(id))
            {
                StockDataUpdater sdu = m_dataUpdaters[id];
                sdu.stop();
                m_dataUpdaters.TryRemove(id, out sdu);
            }
        }