/// <summary> /// connect to API /// подсоединиться к апи /// </summary> public void Connect() { if (_client == null) { _client = new BinanceClientFutures( ((ServerParameterString)ServerParameters[0]).Value, ((ServerParameterPassword)ServerParameters[1]).Value); _client.Connected += _client_Connected; _client.UpdatePairs += _client_UpdatePairs; _client.Disconnected += _client_Disconnected; _client.NewPortfolio += _client_NewPortfolio; _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(); }
/// <summary> /// connect to API /// подсоединиться к апи /// </summary> public void Connect() { if (_client == null) { _client = new BinanceClientFutures( ((ServerParameterString)ServerParameters[0]).Value, ((ServerParameterPassword)ServerParameters[1]).Value); _client.Connected += _client_Connected; _client.UpdatePairs += _client_UpdatePairs; _client.Disconnected += _client_Disconnected; _client.NewPortfolio += _client_NewPortfolio; _client.UpdatePortfolio += _client_UpdatePortfolio; _client.UpdateMarketDepth += _client_UpdateMarketDepth; _client.NewTradesEvent += _client_NewTradesEvent; _client.MyTradeEvent += _client_MyTradeEvent; _client.MyOrderEvent += _client_MyOrderEvent; _client.LogMessageEvent += SendLogMessage; } if (((ServerParameterEnum)ServerParameters[2]).Value == "USDT-M") { this.futures_type = FuturesType.USDT; _client._baseUrl = "https://fapi.binance.com"; _client.wss_point = "wss://fstream.binance.com"; _client.type_str_selector = "fapi"; } else if (((ServerParameterEnum)ServerParameters[2]).Value == "COIN-M") { this.futures_type = FuturesType.COIN; _client._baseUrl = "https://dapi.binance.com"; _client.wss_point = "wss://dstream.binance.com"; _client.type_str_selector = "dapi"; } _client.futures_type = this.futures_type; _client.HedgeMode = ((ServerParameterBool)ServerParameters[3]).Value; _client.Connect(); }