/// <summary> /// Get the products. /// </summary> /// <returns></returns> private async Task <GdaxTicker> GetTicker(string productId) { using (HttpResponseMessage response = await this._httpClient.GetAsync(new Uri($"products/{productId}/ticker", UriKind.Relative))) { GdaxTicker ticker = JsonConvert.DeserializeObject <GdaxTicker>(await response.Content.ReadAsStringAsync(), this._serializerSettings); ticker.ProductId = productId; return(ticker); } }
private MarketSummaryDto?CreateMarketSummaryDto(GdaxTicker ticker, ICoinBuilder builder) { // always look at the quoted currency first as if that does not exist, then no point creating doing any more Currency?marketCurrency = builder.Get(ticker.ProductId.Substring(ticker.ProductId.IndexOf(value: '-') + 1)); if (marketCurrency == null) { return(null); } Currency?baseCurrency = builder.Get(ticker.ProductId.Substring(startIndex: 0, ticker.ProductId.IndexOf(value: '-'))); if (baseCurrency == null) { return(null); } return(new MarketSummaryDto(market: this.Name, baseCurrency: baseCurrency, marketCurrency: marketCurrency, volume: ticker.Volume, last: ticker.Price, lastUpdated: ticker.Time)); }