Example #1
0
        /// <summary>
        /// connect to API
        /// подсоединиться к апи
        /// </summary>
        public void Connect()
        {
            if (_client == null)
            {
                _client                    = new ExmoClient(((ServerParameterString)ServerParameters[0]).Value, ((ServerParameterPassword)ServerParameters[1]).Value);
                _client.Connected         += _client_Connected;
                _client.UpdatePairs       += _client_UpdatePairs;
                _client.Disconnected      += _client_Disconnected;
                _client.UpdatePortfolio   += _client_UpdatePortfolio;
                _client.UpdateMarketDepth += _client_UpdateMarketDepth;
                _client.NewTradesEvent    += _client_NewTradesEvent;
                _client.MyTradeEvent      += _client_MyTradeEvent;
                _client.MyOrderEvent      += _client_MyOrderEvent;
                _client.LogMessageEvent   += SendLogMessage;
            }

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

                _client.Connected         -= _client_Connected;
                _client.UpdatePairs       -= _client_UpdatePairs;
                _client.Disconnected      -= _client_Disconnected;
                _client.UpdatePortfolio   -= _client_UpdatePortfolio;
                _client.UpdateMarketDepth -= _client_UpdateMarketDepth;
                _client.NewTradesEvent    -= _client_NewTradesEvent;
                _client.MyTradeEvent      -= _client_MyTradeEvent;
                _client.MyOrderEvent      -= _client_MyOrderEvent;
                _client.LogMessageEvent   -= SendLogMessage;
            }

            _client      = null;
            ServerStatus = ServerConnectStatus.Disconnect;
        }