Esempio n. 1
0
        /// <summary>
        /// connect to API
        /// подсоединиться к апи
        /// </summary>
        public void Connect()
        {
            if (_client == null)
            {
                _client = new BitMaxProClient(((ServerParameterString)ServerParameters[0]).Value,
                                              ((ServerParameterPassword)ServerParameters[1]).Value);

                _client.Connected              += Client_Connected;
                _client.UpdateSecurities       += ClientReceivedSecurities;
                _client.Disconnected           += Client_Disconnected;
                _client.NewPortfoliosEvent     += ClientPortfoliosEvent;
                _client.NewSpotPortfoliosEvent += ClientOnNewSpotPortfoliosEvent;
                _client.UpdateMarketDepth      += ClientUpdateMarketDepth;
                _client.NewTradesEvent         += ClientNewTradesEvent;
                _client.MyOrderEvent           += ClientMyOrderEvent;
                _client.LogMessageEvent        += SendLogMessage;
            }

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

                _client.Connected              -= Client_Connected;
                _client.UpdateSecurities       -= ClientReceivedSecurities;
                _client.Disconnected           -= Client_Disconnected;
                _client.NewPortfoliosEvent     -= ClientPortfoliosEvent;
                _client.NewSpotPortfoliosEvent -= ClientOnNewSpotPortfoliosEvent;
                _client.UpdateMarketDepth      -= ClientUpdateMarketDepth;
                _client.NewTradesEvent         -= ClientNewTradesEvent;
                _client.MyOrderEvent           -= ClientMyOrderEvent;
                _client.LogMessageEvent        -= SendLogMessage;
            }

            _client      = null;
            ServerStatus = ServerConnectStatus.Disconnect;
        }