Ejemplo n.º 1
0
 /// <summary>
 /// создать новое подключение
 /// </summary>
 private void CreateNewServer()
 {
     if (_clientBitStamp == null)
     {
         _clientBitStamp                    = new BitstampClient(UserKey, UserPrivateKey, UserId);
         _clientBitStamp.Connected         += Сlient_Connected;
         _clientBitStamp.UpdatePairs       += _clientBitStamp_UpdatePairs;
         _clientBitStamp.Disconnected      += ClientnDisconnected;
         _clientBitStamp.UpdatePortfolio   += UpdatePortfolios;
         _clientBitStamp.UpdateMarketDepth += UpdateMarketDepth;
         _clientBitStamp.NewTradesEvent    += NewTrades;
         _clientBitStamp.MyTradeEvent      += NewMyTrade;
         _clientBitStamp.MyOrderEvent      += BitMex_UpdateOrder;
         _clientBitStamp.LogMessageEvent   += SendLogMessage;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// dispose API
        /// освободить апи
        /// </summary>
        public void Dispose()
        {
            if (_client != null)
            {
                _client.Dispose();

                _client.Connected         -= ClientOnConnected;
                _client.UpdatePairs       -= ClientOnUpdatePairs;
                _client.Disconnected      -= ClientOnDisconnected;
                _client.UpdatePortfolio   -= ClientOnUpdatePortfolio;
                _client.UpdateMarketDepth -= ClientOnUpdateMarketDepth;
                _client.NewTradesEvent    -= ClientOnNewTradesEvent;
                _client.MyTradeEvent      -= ClientOnMyTradeEvent;
                _client.MyOrderEvent      -= ClientOnMyOrderEvent;
                _client.LogMessageEvent   -= ClientOnLogMessageEvent;
            }

            _client      = null;
            ServerStatus = ServerConnectStatus.Disconnect;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// connect to API
        /// подсоединиться к апи
        /// </summary>
        public void Connect()
        {
            if (_client == null)
            {
                _client = new BitstampClient(((ServerParameterString)ServerParameters[1]).Value,
                                             ((ServerParameterPassword)ServerParameters[2]).Value,
                                             ((ServerParameterPassword)ServerParameters[0]).Value);
                _client.Connected         += ClientOnConnected;
                _client.UpdatePairs       += ClientOnUpdatePairs;
                _client.Disconnected      += ClientOnDisconnected;
                _client.UpdatePortfolio   += ClientOnUpdatePortfolio;
                _client.UpdateMarketDepth += ClientOnUpdateMarketDepth;
                _client.NewTradesEvent    += ClientOnNewTradesEvent;
                _client.MyTradeEvent      += ClientOnMyTradeEvent;
                _client.MyOrderEvent      += ClientOnMyOrderEvent;
                _client.LogMessageEvent   += ClientOnLogMessageEvent;
            }

            _client.Connect();
        }