public override decimal GetSingleNowPrice(EnumType.CoinType coin, EnumType.CurrencyType currency = EnumType.CurrencyType.USDT) { string Symbol = ConvertSymbolTool.HBConvertSymbol(coin, currency); var result = coinealAPI.SendRequestContent <TicketRequest>(ApiUrlList.API_Ticker, Symbol); if (result == null || result.data.buy <= 0) { return(0); } return(result.data.buy); }
/// <summary> /// 获取单个币种在火币的价格 /// </summary> /// <param name="coin"></param> /// <param name="currency"></param> /// <returns></returns> public override decimal GetSingleNowPrice(CoinType coin, EnumType.CurrencyType currency = EnumType.CurrencyType.USDT) { string Symbol = ConvertSymbolTool.BiAnConvertSymbol(coin, currency); var result = api.SendRequestContent <TicketRequest>(ApiUrlList.API_Ticker, Symbol); if (result == null || result.lastPrice <= 0) { return(0); } return(result.lastPrice); }
public override decimal GetSingleNowPrice(CoinType coin, EnumType.CurrencyType currency = EnumType.CurrencyType.USDT) { string symbol = ConvertSymbolTool.OKConvertSymbol(coin, currency); TicketRequset ticket = OkAPi.SendRequestContent <TicketRequset>(ApiUrlList.API_Ticker, symbol); if (ticket == null || ticket.ticker == null) { Alert("获取价格失败!"); return(0); } return(ticket.ticker.last); }
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); }
public override BasePriceModel GetNowPrice(string coin, string currency) { BasePriceModel basePrice = new BasePriceModel(); string Symbol = ConvertSymbolTool.OKConvertSymbol(coin, currency); var result = OkAPi.SendRequestContent <TicketRequset>(ApiUrlList.API_Ticker, Symbol); if (result == null) { Log.Error("okex数据为空" + coin); return(basePrice); } basePrice.buyPrice = result.ticker.buy; basePrice.sellPice = result.ticker.sell; basePrice.price = result.ticker.last; return(basePrice); }
public override BasePriceModel GetNowPrice(string coin, string currency) { BasePriceModel basePrice = new BasePriceModel(); string Symbol = ConvertSymbolTool.BiAnConvertSymbol(coin, currency); var result = api.SendRequestContent <TicketRequest>(ApiUrlList.API_Ticker, Symbol); if (result == null) { Log.Error("币安数据为空" + coin); return(basePrice); } basePrice.buyPrice = result.bidPrice; basePrice.sellPice = result.askPrice; basePrice.price = result.lastPrice; return(basePrice); }
/// <summary> /// 获取单个币种在火币的价格 /// </summary> /// <param name="coin"></param> /// <param name="currency"></param> /// <returns></returns> public override decimal GetSingleNowPrice(CoinType coin, EnumType.CurrencyType currency = EnumType.CurrencyType.USDT) { try { string Symbol = ConvertSymbolTool.HBConvertSymbol(coin, currency); var result = api.SendRequestContent <TicketRequest>(ApiUrlList.API_Ticker, Symbol); if (result == null || result.tick.ask.Length <= 0) { return(0); } return(decimal.Parse(result.tick.ask[0].ToString("f3"))); } catch { return(0); } }
public override BasePriceModel GetNowPrice(string coin, string currency) { BasePriceModel basePrice = new BasePriceModel(); string Symbol = ConvertSymbolTool.HBConvertSymbol(coin, currency); var result = api.SendRequestContent <TicketRequest>(ApiUrlList.API_Ticker, Symbol); if (result.status != "ok") { return(basePrice); } if (result.tick == null) { Log.Error("HUOBI数据为空" + coin); return(basePrice); } basePrice.buyPrice = result.tick.bid[0]; basePrice.sellPice = result.tick.ask[0]; basePrice.price = result.tick.close; return(basePrice); }
/// <summary> /// 获取市场深度 /// </summary> /// <param name="coin"></param> /// <param name="currency"></param> /// <returns></returns> public override LatePriceModel GetLatestRecord(string coin, string currency) { LatePriceModel latePrice = new LatePriceModel(); string Symbol = ConvertSymbolTool.HBConvertSymbol(coin, currency); Symbol += "&type=step0"; var result = api.SendRequestContent <DepthRequest>(ApiUrlList.Api_Depth, Symbol); if (result == null) { Log.Error("火币数据为空" + coin); return(latePrice); } List <PriceModel> asksList = new List <PriceModel>(); foreach (var asksPrice in result.tick.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.tick.bids) { PriceModel bids = new PriceModel(); bids.price = bidsPrice[0]; bids.amount = bidsPrice[1]; bidsList.Add(bids); } latePrice.Asks = asksList; latePrice.Bids = bidsList; return(latePrice); }
public override LatePriceModel GetLatestRecord(string coin, string currency) { LatePriceModel latePrice = new LatePriceModel(); string Symbol = ConvertSymbolTool.BiAnConvertSymbol(coin, currency); var result = api.SendRequestContent <DepthRequest>(ApiUrlList.API_Depth, Symbol); if (result == null) { Log.Error("币安数据为空" + coin); return(latePrice); } List <PriceModel> asksList = new List <PriceModel>(); foreach (var asksPrice in result.asks) { PriceModel asks = new PriceModel(); asks.price = Convert.ToDecimal(asksPrice[0]); asks.amount = Convert.ToDecimal(asksPrice[1]); asksList.Add(asks); } List <PriceModel> bidsList = new List <PriceModel>(); foreach (var bidsPrice in result.bids) { PriceModel bids = new PriceModel(); bids.price = Convert.ToDecimal(bidsPrice[0]); bids.amount = Convert.ToDecimal(bidsPrice[1]); bidsList.Add(bids); } latePrice.Asks = asksList; latePrice.Bids = bidsList; return(latePrice); }