Esempio n. 1
0
        static void Main(string[] args)
        {
            tickDatas = new Dictionary <string, TickData>();
            HuobiMarket market = new HuobiMarket();

            market.OnMessage    += TickUpdate;
            market.OnConnecteed += HBConnected;
            string url = "wss://api.huobipro.com/ws";

            try
            {
                market.Init(url);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            List <string> symbols = new List <string>()
            {
                "btcusdt", "eosbtc", "eosusdt"
            };

            foreach (var item in symbols)
            {
                tickDatas[item] = new TickData();
                string str = "market." + item + ".depth.step0";
                market.Subscribe(str, "33233011");
            }

            //thread = new Thread(new ThreadStart(RecordeDatas));


            Console.ReadLine();
        }
Esempio n. 2
0
        public void AddSubscribeTest()
        {
            var result = HuobiMarket.Init();
            var topic  = string.Format(HuobiMarket.MARKET_KLINE, "etcbtc", "1day");
            var guid   = Guid.NewGuid().ToString();

            HuobiMarket.Subscribe(topic, guid);
            HuobiMarket.OnMessage += (sender, e) =>
            {
                Console.WriteLine("OnMessage:" + e.Message);
            };
            Thread.Sleep(1000 * 15);
            Assert.IsTrue(result);
        }