mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 21:32:27 +01:00
Fix HitBTC again
This commit is contained in:
parent
44896559c6
commit
a249a164f7
@ -24,13 +24,21 @@ namespace BTCPayServer.Rating
|
||||
var jarray = await response.Content.ReadAsAsync<JArray>(cancellationToken);
|
||||
return jarray
|
||||
.Children<JObject>()
|
||||
.Where(p => CurrencyPair.TryParse(p["symbol"].Value<string>(), out _))
|
||||
.Select(p => new PairRate(CurrencyPair.Parse(p["symbol"].Value<string>()), CreateBidAsk(p)))
|
||||
.Select(p =>
|
||||
{
|
||||
CurrencyPair.TryParse(p["symbol"].Value<string>(), out var currency);
|
||||
var bidask = CreateBidAsk(p);
|
||||
return (currency, bidask);
|
||||
})
|
||||
.Where(p => p.currency != null && p.bidask != null)
|
||||
.Select(p => new PairRate(p.currency, p.bidask))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private BidAsk CreateBidAsk(JObject p)
|
||||
{
|
||||
if (p["bid"].Type != JTokenType.String || p["ask"].Type != JTokenType.String)
|
||||
return null;
|
||||
var bid = p["bid"].Value<decimal>();
|
||||
var ask = p["ask"].Value<decimal>();
|
||||
return new BidAsk(bid, ask);
|
||||
|
Loading…
Reference in New Issue
Block a user