Esempio n. 1
0
        public override decimal GetSingleNowPrice(CoinType coin, EnumType.CurrencyType currency = EnumType.CurrencyType.USDT)
        {
            string Symbol = ConvertSymbolTool.GateConvertSymbol(coin, currency);

            var result = gateAPI.SendRequestContent <TicketRequest>(ApiUrlList.API_Ticker, Symbol);

            if (result.last == 0 || result == null)
            {
                return(0);
            }

            return(result.last);
        }
Esempio n. 2
0
        public override BasePriceModel GetNowPrice(string coin, string currency)
        {
            BasePriceModel basePrice = new BasePriceModel();
            string         Symbol    = ConvertSymbolTool.GateConvertSymbol(coin, currency);
            var            result    = gateAPI.SendRequestContent <TicketRequest>(ApiUrlList.API_Ticker, Symbol);

            if (result == null)
            {
                Log.Error("GATE数据为空" + coin);
                return(basePrice);
            }
            basePrice.buyPrice = result.highestBid;
            basePrice.sellPice = result.lowestAsk;
            basePrice.price    = result.last;
            return(basePrice);
        }
Esempio n. 3
0
        public override LatePriceModel GetLatestRecord(string coin, string currency)
        {
            LatePriceModel latePrice = new LatePriceModel();
            string         Symbol    = ConvertSymbolTool.GateConvertSymbol(coin, currency);
            var            result    = gateAPI.SendRequestContent <DepthRequest>(ApiUrlList.API_OrderBooks, Symbol);

            if (result == null)
            {
                Log.Error("GATE数据为空" + coin);
                return(latePrice);
            }

            List <PriceModel> asksList = new List <PriceModel>();

            foreach (var asksPrice in result.asks)
            {
                PriceModel asks = new PriceModel();
                asks.price  = asksPrice[0];
                asks.amount = asksPrice[1];
                asksList.Add(asks);
            }

            List <PriceModel> bidsList = new List <PriceModel>();

            foreach (var bidsPrice in result.bids)
            {
                PriceModel bids = new PriceModel();
                bids.price  = bidsPrice[0];
                bids.amount = bidsPrice[1];
                bidsList.Add(bids);
            }

            latePrice.Asks = asksList;
            latePrice.Bids = bidsList;
            return(latePrice);
        }