private void GetPairs(string data)
        {
            if (!string.IsNullOrWhiteSpace(data))
            {
                try
                {
                    var     jsonString = data;
                    dynamic entity     = JConverter.JsonConvertDynamic(jsonString);

                    foreach (var symbol in entity.symbols)
                    {
                        if (symbol.status == STATUS_TRADING)
                        {
                            MarketPairs.Add(new MarketPair()
                            {
                                BaseAsset  = symbol.baseAsset,
                                QuoteAsset = symbol.quoteAsset,
                                Pair       = symbol.symbol,
                                Status     = symbol.status
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    // TODO: запись лога в БД
                    throw ex;
                }
            }
            else
            {
                throw new ArgumentException("Value IsNullOrWhiteSpace", "data");
            }
        }
Beispiel #2
0
        private void GetExchangeInfo(ExchangeInfo exchangeInfo, string simbol)
        {
            exchangeSettingsPair = new ExchangeSettingsPair();
            try
            {
                var     jsonString = exchangeInfo.Info;
                dynamic entity     = JConverter.JsonConvertDynamic(jsonString);

                foreach (var symbol in entity.symbols)
                {
                    if (symbol.symbol == simbol)
                    {
                        exchangeSettingsPair.QuotePrecision = symbol.quotePrecision;
                        exchangeSettingsPair.BasePrecision  = symbol.baseAssetPrecision;
                        foreach (var filter in symbol.filters)
                        {
                            if (filter.filterType == "LOT_SIZE")
                            {
                                decimal stepSize;
                                decimal.TryParse(filter.stepSize.ToString(), NumberStyles.Number, new CultureInfo("en-US"), out stepSize);
                                exchangeSettingsPair.LotSizeFilter.StepSize = stepSize;
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /*
         * {
         * "timezone": "UTC",
         * "serverTime": 1508631584636,
         * "rateLimits": [{
         * "rateLimitType": "REQUESTS",
         * "interval": "MINUTE",
         * "limit": 1200
         * },
         * {
         * "rateLimitType": "ORDERS",
         * "interval": "SECOND",
         * "limit": 10
         * },
         * {
         * "rateLimitType": "ORDERS",
         * "interval": "DAY",
         * "limit": 100000
         * }
         * ],
         * "exchangeFilters": [],
         * "symbols": [{
         * "symbol": "ETHBTC",
         * "status": "TRADING",
         * "baseAsset": "ETH",
         * "baseAssetPrecision": 8,
         * "quoteAsset": "BTC",
         * "quotePrecision": 8,
         * "orderTypes": ["LIMIT", "MARKET"],
         * "icebergAllowed": false,
         * "filters": [{
         * "filterType": "PRICE_FILTER",
         * "minPrice": "0.00000100",
         * "maxPrice": "100000.00000000",
         * "tickSize": "0.00000100"
         * }, {
         * "filterType": "LOT_SIZE",
         * "minQty": "0.00100000",
         * "maxQty": "100000.00000000",
         * "stepSize": "0.00100000"
         * }, {
         * "filterType": "MIN_NOTIONAL",
         * "minNotional": "0.00100000"
         * }]
         * }]
         * }
         */
        #endregion
        private void GetExchangeInfo()
        {
            try
            {
                var     jsonString = MainWindow.ExchangeInfo.Info;
                dynamic entity     = JConverter.JsonConvertDynamic(jsonString);

                foreach (var symbol in entity.symbols)
                {
                    if (symbol.symbol == selectedPair)
                    {
                        quotePrecision = symbol.quotePrecision;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
                // TODO: запись лога в БД
            }
        }