/// <summary> /// connect to API /// подсоединиться к апи /// </summary> public void Connect() { if (_client == null) { _client = new LivecoinClient(((ServerParameterString)ServerParameters[0]).Value, ((ServerParameterPassword)ServerParameters[1]).Value, ServerType.ToString()); _client.Connected += Client_Connected; _client.UpdatePairs += Client_UpdatePairs; _client.Disconnected += Client_Disconnected; _client.NewPortfolio += Client_NewPortfolio; _client.UpdatePortfolio += Client_UpdatePortfolio; _client.NewMarketDepth += Client_NewMarketDepth; _client.UpdateMarketDepth += Client_UpdateMarketDepth; _client.NewTradesEvent += Client_NewTradesEvent; _client.MyTradeEvent += Client_MyTradeEvent; _client.MyOrderEvent += Client_MyOrderEvent; _client.LogMessageEvent += SendLogMessage; } _client.Connect(); }
public void Dispose() { if (_client != null) { _client.Dispose(); _client.Connected -= Client_Connected; _client.UpdatePairs -= Client_UpdatePairs; _client.Disconnected -= Client_Disconnected; _client.NewPortfolio -= Client_NewPortfolio; _client.UpdatePortfolio -= Client_UpdatePortfolio; _client.NewMarketDepth -= Client_NewMarketDepth; _client.UpdateMarketDepth -= Client_UpdateMarketDepth; _client.NewTradesEvent -= Client_NewTradesEvent; _client.MyTradeEvent -= Client_MyTradeEvent; _client.MyOrderEvent -= Client_MyOrderEvent; _client.LogMessageEvent -= SendLogMessage; _client = null; } _depths = null; }