Example #1
0
        /// <summary>
        /// connecto to the exchange
        /// установить соединение с биржей
        /// </summary>
        public void Connect()
        {
            if (_isConnected)
            {
                return;
            }
            try
            {
                _kraken = new KrakenRestApi(publicKey, privateKey);


                if (_kraken.GetServerTime() == null)
                {
                    SendLogMessage(OsLocalization.Market.Label56, LogMessageType.Error);
                    return;
                }

                _isConnected = true;

                if (Connected != null)
                {
                    Connected();
                }
            }
            catch (Exception error)
            {
                SendLogMessage(error.ToString(), LogMessageType.Error);
            }
        }
Example #2
0
        /// <summary>
        /// bring the program to the start. Clear all objects involved in connecting to the server
        /// привести программу к моменту запуска. Очистить все объекты участвующие в подключении к серверу
        /// </summary>
        public void Dispose()
        {
            try
            {
                _kraken.Dispose();
                _kraken = null;
            }
            catch
            {
                // ignore
            }

            if (Disconnected != null)
            {
                Disconnected();
            }

            _isDisposed = true;
        }