Example #1
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.UpdateMarketDepth  -= ClientUpdateMarketDepth;
                _client.NewTradesEvent     -= ClientNewTradesEvent;
                _client.MyOrderEvent       -= ClientMyOrderEvent;
                _client.LogMessageEvent    -= SendLogMessage;
            }

            _client      = null;
            ServerStatus = ServerConnectStatus.Disconnect;
        }
Example #2
0
        /// <summary>
        /// connect to API
        /// подсоединиться к апи
        /// </summary>
        public void Connect()
        {
            if (_client == null)
            {
                _client = new BitMaxClient(((ServerParameterString)ServerParameters[0]).Value,
                                           ((ServerParameterPassword)ServerParameters[1]).Value,
                                           ((ServerParameterBool)ServerParameters[2]).Value);

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

            _client.Connect();
        }