Beispiel #1
0
        public async Task <bool> TestPublicApiAsync(NetworkProviderContext context)
        {
            var api = ApiProvider.GetApi(context);
            var r   = await api.GetCurrentServerTimeAsync().ConfigureAwait(false);

            return(r != null);
        }
Beispiel #2
0
        public async Task <MarketPrices> GetPricingAsync(PublicPricesContext context)
        {
            var api      = ApiProvider.GetApi(context);
            var pairCode = context.Pair.ToTicker(this);

            var r = await api.GetTickerAsync(pairCode).ConfigureAwait(false);

            var price = new MarketPrice(Network, context.Pair, r.lastPrice)
            {
                PriceStatistics = new PriceStatistics(Network, context.Pair.Asset2, r.ask, r.bid, r.low24h, r.high24h),
                Volume          = new NetworkPairVolume(Network, context.Pair, r.volume24h)
            };

            return(new MarketPrices(price));
        }
Beispiel #3
0
        public async Task <AssetPairs> GetAssetPairsAsync(NetworkProviderContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var rRaw = await api.GetTickersAsync().ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = ParseTicker(rRaw);

            var pairs    = new AssetPairs();
            var krwAsset = Asset.Krw;

            foreach (var kvp in r)
            {
                var pair = kvp.Key.ToAsset(this).ToPair(krwAsset);
                pairs.Add(pair);
            }

            return(pairs);
        }