Beispiel #1
0
        /// <summary>
        /// connect to API
        /// подсоединиться к апи
        /// </summary>
        public void Connect()
        {
            if (_client == null)
            {
                _client = new HitbtcClient(((ServerParameterString)ServerParameters[0]).Value,
                                           ((ServerParameterPassword)ServerParameters[1]).Value);
                _client.Connected         += _client_Connected;
                _client.Disconnected      += _client_Disconnected;
                _client.NewPairs          += _client_NewPairs;
                _client.NewPortfolio      += _client_NewPortfolio;
                _client.NewMarketDepth    += _client_NewMarketDepth;
                _client.UpdateMarketDepth += _client_UpdateMarketDepth;
                _client.NewTradesEvent    += _client_NewTradesEvent;
                _client.UpdatePortfolio   += _client_UpdatePortfolio;
                _client.MyOrderEvent      += _client_MyOrderEvent;

                // to do

                _client.LogMessageEvent += SendLogMessage;
            }
            _client.Connect();
        }
Beispiel #2
0
        /// <summary>
        /// release API
        /// освободить апи
        /// </summary>
        public void Dispose()
        {
            if (_client != null)
            {
                _client.Dispose();

                _client.Connected         -= _client_Connected;
                _client.Disconnected      -= _client_Disconnected;
                _client.NewPairs          -= _client_NewPairs;
                _client.NewPortfolio      -= _client_NewPortfolio;
                _client.NewMarketDepth    -= _client_NewMarketDepth;
                _client.UpdateMarketDepth -= _client_UpdateMarketDepth;
                _client.NewTradesEvent    -= _client_NewTradesEvent;
                _client.UpdatePortfolio   -= _client_UpdatePortfolio;
                _client.MyOrderEvent      -= _client_MyOrderEvent;

                // to do

                _client.LogMessageEvent -= SendLogMessage;
            }
            _client      = null;
            ServerStatus = ServerConnectStatus.Disconnect;
        }