From cff9fbf527b17ae35c87e46c984ddd284dfcb1f1 Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 9 Aug 2022 23:18:42 -0400 Subject: [PATCH 01/12] Forex, Futures, Crypto and Stock updates - Realtime quotes for crypto and stock. - Futures and Forex support for realtime and historical quotes --- .../AdvancedData/IAdvancedDataProvider.cs | 2 + .../Crypto/ICryptoMarketProvider.cs | 11 +- .../Forex/IForexMarketProvider.cs | 16 +++ .../Futures/IFuturesMarketProvider.cs | 14 +++ .../IFinancialModelingPrepApiClient.cs | 13 ++ .../Abstractions/Model/ICurrentQuote.cs | 70 +++++++++++ .../Abstractions/Model/IHistoricalQuote.cs | 33 +++++ .../IStockTimeSeriesProvider.cs | 7 ++ .../Core/AdvancedData/AdvancedDataProvider.cs | 28 ++++- .../CompanyValuationProvider.cs | 14 +-- .../Core/Crypto/CryptoMarketProvider.cs | 31 +++-- .../Core/FinancialModelingPrepApiClient.cs | 13 ++ .../Core/Forex/ForexMarketProvider.cs | 64 ++++++++++ .../Core/Futures/FuturesMarketProvider.cs | 49 ++++++++ .../Http/FinancialModelingPrepHttpClient.cs | 6 +- .../InstitutionalFundProvider.cs | 2 +- .../StockTimeSeriesProvider.cs | 14 +++ .../DependencyInjectionExtensions.cs | 7 ++ .../FinancialModelingPrepApi.csproj | 93 +++++++------- .../Model/AdvancedData/ESGScoreResponse.cs | 8 +- .../AdvancedData/FinancialScoreResponse.cs | 39 ++++++ .../Model/AdvancedData/SharesFloatResponse.cs | 6 +- FinancialModelingPrepApi/Model/ApiResponse.cs | 2 +- .../Calendars/DividendCalendarResponse.cs | 4 +- .../Calendars/EarningsCalendarResponse.cs | 8 +- .../Calendars/EconomicCalendarResponse.cs | 10 +- .../Model/Calendars/IPOCalendarResponse.cs | 2 +- .../Calendars/StockSplitCalendarResponse.cs | 4 +- .../CompanyValuation/BalanceSheetResponse.cs | 88 ++++++------- .../CompanyValuation/CashFlowResponse.cs | 60 ++++----- .../CompanyProfileResponse.cs | 12 +- .../Model/CompanyValuation/DCFResponse.cs | 4 +- .../EnterpriseValueResponse.cs | 10 +- .../CompanyValuation/HistoricalDCFResponse.cs | 4 +- .../HistoricalDailyDCFResponse.cs | 2 +- .../IncomeStatementResponse.cs | 56 ++++----- .../CompanyValuation/KeyMetricsResponse.cs | 114 ++++++++--------- .../CompanyValuation/KeyMetricsTTMResponse.cs | 110 ++++++++--------- .../CompanyValuation/MarketCapResponse.cs | 2 +- .../Model/CompanyValuation/QuoteResponse.cs | 28 ++--- .../CompanyValuation/RatiosTTMResponse.cs | 116 +++++++++--------- .../Model/CompanyValuation/SymbolResponse.cs | 2 +- .../Model/Crypto/CryptoQuoteResponse.cs | 72 +++++++++++ .../Crypto/CyptoHistoricalPriceListings.cs | 29 ++--- .../Model/Forex/ForexBookResponse.cs | 33 +++++ .../Forex/ForexHistoricalQuoteResponse.cs | 30 +++++ .../Model/Forex/ForexQuoteResponse.cs | 72 +++++++++++ .../Model/Fund/ETFStockExposureResponse.cs | 4 +- .../Futures/FuturesHistoricalQuoteResponse.cs | 30 +++++ .../Model/Futures/FuturesQuoteResponse.cs | 72 +++++++++++ .../Model/Statistics/AnalystEstimateItem.cs | 36 +++--- .../StockMarket/StockMarketSymbolResponse.cs | 2 +- .../Model/StockMarket/StockQuoteResponse.cs | 72 +++++++++++ .../StockTimeSeries/HistoricalDividendItem.cs | 4 +- ...storicalPriceForChartWithVolumeResponse.cs | 8 +- .../HistoricalPriceForLineChartResponse.cs | 2 +- .../HistoricalPriceResponse.cs | 28 +++-- .../HistoricalStockSplitItem.cs | 4 +- Tests/AdvancedData/AdvancedDataTests.cs | 9 ++ Tests/Calendars/CalendarsTests.cs | 6 +- Tests/Crypto/CryptoMarketTests.cs | 18 ++- Tests/Forex/ForexMarketTests.cs | 39 ++++++ Tests/Futures/FuturesMarketTests.cs | 40 ++++++ Tests/StockTimeSeries/StockTimeSeriesTests.cs | 35 ++++-- 64 files changed, 1345 insertions(+), 478 deletions(-) create mode 100644 FinancialModelingPrepApi/Abstractions/Forex/IForexMarketProvider.cs create mode 100644 FinancialModelingPrepApi/Abstractions/Futures/IFuturesMarketProvider.cs create mode 100644 FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs create mode 100644 FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs create mode 100644 FinancialModelingPrepApi/Core/Forex/ForexMarketProvider.cs create mode 100644 FinancialModelingPrepApi/Core/Futures/FuturesMarketProvider.cs create mode 100644 FinancialModelingPrepApi/Model/AdvancedData/FinancialScoreResponse.cs create mode 100644 FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs create mode 100644 FinancialModelingPrepApi/Model/Forex/ForexBookResponse.cs create mode 100644 FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs create mode 100644 FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs create mode 100644 FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs create mode 100644 FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs create mode 100644 FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs create mode 100644 Tests/Forex/ForexMarketTests.cs create mode 100644 Tests/Futures/FuturesMarketTests.cs diff --git a/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs b/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs index abe0bb1..62cdc5a 100644 --- a/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs @@ -25,5 +25,7 @@ public interface IAdvancedDataProvider Task> GetSharesFloatAsync(string symbol); Task>> GetESGScoreAsync(string symbol); + + Task>> GetFinancialScore(string symbol); } } diff --git a/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs b/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs index 9b7dbda..fc0e7d5 100644 --- a/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs @@ -1,17 +1,18 @@ using MatthiWare.FinancialModelingPrep.Model; using MatthiWare.FinancialModelingPrep.Model.Crypto; -using MatthiWare.FinancialModelingPrep.Model.StockMarket; using System.Collections.Generic; using System.Threading.Tasks; -namespace MatthiWare.FinancialModelingPrep.Abstractions.StockMarket +namespace MatthiWare.FinancialModelingPrep.Abstractions.Crypto { public interface ICryptoMarketProvider { - public Task>> GetAvilableCryptocurrencies(); + Task>> GetAvilableCryptocurrenciesAsync(); - public Task>> GetHistoricalPrices(string symbol, HistoricalPricingPeriod period); + Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period); - public Task> GetDailyPrices(string symbol); + Task> GetDailyPricesAsync(string symbol); + + Task>> GetQuoteAsync(string symbol); } } diff --git a/FinancialModelingPrepApi/Abstractions/Forex/IForexMarketProvider.cs b/FinancialModelingPrepApi/Abstractions/Forex/IForexMarketProvider.cs new file mode 100644 index 0000000..99ca6ac --- /dev/null +++ b/FinancialModelingPrepApi/Abstractions/Forex/IForexMarketProvider.cs @@ -0,0 +1,16 @@ +using MatthiWare.FinancialModelingPrep.Model; +using MatthiWare.FinancialModelingPrep.Model.Forex; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Abstractions.Forex +{ + public interface IForexMarketProvider + { + Task>> GetBookAsync(string symbol); + + Task>> GetQuoteAsync(string symbol); + + Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period); + } +} diff --git a/FinancialModelingPrepApi/Abstractions/Futures/IFuturesMarketProvider.cs b/FinancialModelingPrepApi/Abstractions/Futures/IFuturesMarketProvider.cs new file mode 100644 index 0000000..74b7f88 --- /dev/null +++ b/FinancialModelingPrepApi/Abstractions/Futures/IFuturesMarketProvider.cs @@ -0,0 +1,14 @@ +using MatthiWare.FinancialModelingPrep.Model; +using MatthiWare.FinancialModelingPrep.Model.Futures; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Abstractions.Futures +{ + public interface IFuturesMarketProvider + { + Task>> GetQuoteAsync(string symbol); + + Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period); + } +} diff --git a/FinancialModelingPrepApi/Abstractions/IFinancialModelingPrepApiClient.cs b/FinancialModelingPrepApi/Abstractions/IFinancialModelingPrepApiClient.cs index 6db3f66..f0111e0 100644 --- a/FinancialModelingPrepApi/Abstractions/IFinancialModelingPrepApiClient.cs +++ b/FinancialModelingPrepApi/Abstractions/IFinancialModelingPrepApiClient.cs @@ -1,7 +1,10 @@ using MatthiWare.FinancialModelingPrep.Abstractions.AdvancedData; using MatthiWare.FinancialModelingPrep.Abstractions.Calendars; using MatthiWare.FinancialModelingPrep.Abstractions.CompanyValuation; +using MatthiWare.FinancialModelingPrep.Abstractions.Crypto; +using MatthiWare.FinancialModelingPrep.Abstractions.Forex; using MatthiWare.FinancialModelingPrep.Abstractions.Fund; +using MatthiWare.FinancialModelingPrep.Abstractions.Futures; using MatthiWare.FinancialModelingPrep.Abstractions.InstitutionalFund; using MatthiWare.FinancialModelingPrep.Abstractions.MarketIndexes; using MatthiWare.FinancialModelingPrep.Abstractions.Statistics; @@ -61,6 +64,16 @@ public interface IFinancialModelingPrepApiClient /// ICryptoMarketProvider Crypto { get; } + /// + /// Forex related enpoints + /// + IForexMarketProvider Forex { get; } + + /// + /// Futures related enpoints + /// + IFuturesMarketProvider Futures { get; } + /// /// ETF/Mutual Fund related enpoints /// diff --git a/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs new file mode 100644 index 0000000..3d387e3 --- /dev/null +++ b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs @@ -0,0 +1,70 @@ +using System; +using System.Text.Json.Serialization; + +namespace MatthiWare.FinancialModelingPrep.Abstractions.Model +{ + public interface ICurrentQuote + { + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("exchange")] + public string Exchange { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("price")] + public decimal Price { get; set; } + + [JsonPropertyName("previousclose")] + public decimal PreviousClose { get; set; } + + [JsonPropertyName("daylow")] + public decimal DayLow { get; set; } + + [JsonPropertyName("dayhigh")] + public decimal DayHigh { get; set; } + + [JsonPropertyName("yearlow")] + public decimal YearlyLow { get; set; } + + [JsonPropertyName("yearhigh")] + public decimal YearlyHigh { get; set; } + + [JsonPropertyName("priceavg50")] + public decimal PriceAvg50 { get; set; } + + [JsonPropertyName("priceavg200")] + public decimal PriceAvg200 { get; set; } + + [JsonPropertyName("change")] + public decimal Change { get; set; } + + [JsonPropertyName("changespercentage")] + public decimal ChangesPercentage { get; set; } + + [JsonPropertyName("timestamp")] + public long Timestamp { get; set; } + + // Not used by Forex or Futures. + + [JsonPropertyName("eps")] + public decimal? Eps { get; set; } + + [JsonPropertyName("pe")] + public decimal? Pe { get; set; } + + [JsonPropertyName("earningsAnnouncement")] + public string? EarningsAnnouncement { get; set; } + + [JsonPropertyName("sharesOutstanding")] + public long? SharesOutstanding { get; set; } + + [JsonPropertyName("marketCap")] + public decimal? MarketCap { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs new file mode 100644 index 0000000..4739180 --- /dev/null +++ b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Abstractions.Model +{ + public interface IHistoricalQuote + { + [JsonPropertyName("date")] + public string Date { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("high")] + public decimal High { get; set; } + + [JsonPropertyName("low")] + public decimal Low { get; set; } + + [JsonPropertyName("close")] + public decimal Close { get; set; } + + [JsonPropertyName("change")] + public decimal? Change { get; set; } + + [JsonPropertyName("changePercent")] + public decimal? ChangePercent { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs b/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs index 09cdffc..256f422 100644 --- a/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs @@ -1,4 +1,5 @@ using MatthiWare.FinancialModelingPrep.Model; +using MatthiWare.FinancialModelingPrep.Model.StockMarket; using MatthiWare.FinancialModelingPrep.Model.StockTimeSeries; using System.Collections.Generic; using System.Threading.Tasks; @@ -7,6 +8,12 @@ namespace MatthiWare.FinancialModelingPrep.Abstractions.StockTimeSeries { public interface IStockTimeSeriesProvider { + /// + /// Get the latest quote for given stock. + /// + /// + /// + public Task>> GetQuoteAsync(string symbol); /// /// Get Daily Historical Dividends /// diff --git a/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs b/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs index 6ed3729..bf76b2c 100644 --- a/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs +++ b/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs @@ -77,7 +77,29 @@ private async Task> GetSta return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); + } + + public async Task>> GetFinancialScore(string symbol) + { + const string url = "[version]/score"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v4.ToString() } + }; + + var queryString = new QueryStringBuilder(); + queryString.Add("symbol", symbol); + + var result = await client.GetJsonAsync>(url, pathParams, queryString); + + if (result.HasError) + { + return ApiResponse.FromError>(result.Error); + } + + return ApiResponse.FromSuccess(result.Data); } public async Task> GetStockPeersAsync(string symbol) @@ -99,7 +121,7 @@ public async Task> GetStockPeersAsync(string s return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetSectorsPriceEarningsRatioAsync(string date, string exchange) @@ -156,7 +178,7 @@ public async Task> GetSharesFloatAsync(string s return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetESGScoreAsync(string symbol) diff --git a/FinancialModelingPrepApi/Core/CompanyValuation/CompanyValuationProvider.cs b/FinancialModelingPrepApi/Core/CompanyValuation/CompanyValuationProvider.cs index 44d67df..f7701cb 100644 --- a/FinancialModelingPrepApi/Core/CompanyValuation/CompanyValuationProvider.cs +++ b/FinancialModelingPrepApi/Core/CompanyValuation/CompanyValuationProvider.cs @@ -36,7 +36,7 @@ public async Task> GetCompanyProfileAsync(st return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetETFListAsync() @@ -264,7 +264,7 @@ public async Task> GetCompanyRatingAsync(stri return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetHistoricalCompanyRatingAsync(string symbol, int? limit = 140) @@ -304,7 +304,7 @@ public async Task> GetDiscountedCashFlowAsync(string sy return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetHistoricalDiscountedCashFlowAsync(string symbol, Period period = Period.Annual) @@ -364,7 +364,7 @@ public async Task> GetRatiosTTMAsync(string symbo return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public async Task> GetCompanyKeyMetricsTTMAsync(string symbol) @@ -384,7 +384,7 @@ public async Task> GetCompanyKeyMetricsTTMAsy return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetCompanyKeyMetricsAsync(string symbol, Period period = Period.Annual, int? limit = 130) @@ -429,7 +429,7 @@ public async Task> GetQuoteAsync(string symbol) return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetQuotesAsync(IEnumerable symbols) @@ -482,7 +482,7 @@ public async Task> GetMarketCapitalizationAsync(s return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } public Task>> GetHistoricalMarketCapitalizationAsync(string symbol, int? limit = 100) diff --git a/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs b/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs index 0990a98..06adf04 100644 --- a/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs +++ b/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs @@ -1,8 +1,8 @@ -using MatthiWare.FinancialModelingPrep.Abstractions.StockMarket; +using MatthiWare.FinancialModelingPrep.Abstractions.Crypto; +using MatthiWare.FinancialModelingPrep.Abstractions.StockMarket; using MatthiWare.FinancialModelingPrep.Core.Http; using MatthiWare.FinancialModelingPrep.Model; using MatthiWare.FinancialModelingPrep.Model.Crypto; -using MatthiWare.FinancialModelingPrep.Model.StockMarket; using System.Collections.Generic; using System.Collections.Specialized; using System.Threading.Tasks; @@ -18,7 +18,7 @@ public CryptoMarketProvider(FinancialModelingPrepHttpClient client) this.client = client ?? throw new System.ArgumentNullException(nameof(client)); } - public Task>> GetAvilableCryptocurrencies() + public async Task>> GetAvilableCryptocurrenciesAsync() { const string url = "[version]/symbol/available-cryptocurrencies"; @@ -28,10 +28,23 @@ public Task>> GetAvilableCryptocurrencies() { "version", ApiVersion.v3.ToString() } }; - return client.GetJsonAsync>(url, pathParams, null); + return await client.GetJsonAsync>(url, pathParams, null); } - public Task> GetDailyPrices(string symbol) + public async Task>> GetQuoteAsync(string symbol) + { + const string url = "[version]/quote/[symbol]"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + + public async Task> GetDailyPricesAsync(string symbol) { const string url = "[version]/historical-price-full/[symbol]"; @@ -41,10 +54,10 @@ public Task> GetDailyPrices(string s { "symbol", symbol } }; - return client.GetJsonAsync(url, pathParams, null); + return await client.GetJsonAsync(url, pathParams, null); } - public Task>> GetHistoricalPrices(string symbol, HistoricalPricingPeriod period) + public async Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period) { const string url = "[version]/historical-chart/[pricePeriod]/[symbol]"; @@ -57,9 +70,7 @@ public Task>> GetHistorical { "pricePeriod", pricePeriod } }; - var queryString = new QueryStringBuilder(); - - return client.GetJsonAsync>(url, pathParams, queryString); + return await client.GetJsonAsync>(url, pathParams, null); } } } diff --git a/FinancialModelingPrepApi/Core/FinancialModelingPrepApiClient.cs b/FinancialModelingPrepApi/Core/FinancialModelingPrepApiClient.cs index aa9ce52..0566ae7 100644 --- a/FinancialModelingPrepApi/Core/FinancialModelingPrepApiClient.cs +++ b/FinancialModelingPrepApi/Core/FinancialModelingPrepApiClient.cs @@ -1,7 +1,10 @@ using MatthiWare.FinancialModelingPrep.Abstractions.AdvancedData; using MatthiWare.FinancialModelingPrep.Abstractions.Calendars; using MatthiWare.FinancialModelingPrep.Abstractions.CompanyValuation; +using MatthiWare.FinancialModelingPrep.Abstractions.Crypto; +using MatthiWare.FinancialModelingPrep.Abstractions.Forex; using MatthiWare.FinancialModelingPrep.Abstractions.Fund; +using MatthiWare.FinancialModelingPrep.Abstractions.Futures; using MatthiWare.FinancialModelingPrep.Abstractions.InstitutionalFund; using MatthiWare.FinancialModelingPrep.Abstractions.MarketIndexes; using MatthiWare.FinancialModelingPrep.Abstractions.Statistics; @@ -40,6 +43,12 @@ public class FinancialModelingPrepApiClient : IFinancialModelingPrepApiClient /// public ICryptoMarketProvider Crypto { get; } + /// + public IForexMarketProvider Forex { get; } + + /// + public IFuturesMarketProvider Futures { get; } + /// public IFundProvider Fund { get; } @@ -53,6 +62,8 @@ public FinancialModelingPrepApiClient(ICompanyValuationProvider companyValuation IStockMarketProvider stockMarket, IStockStatisticsProvider stockStatistics, ICryptoMarketProvider cryptoMarket, + IForexMarketProvider forexMarket, + IFuturesMarketProvider futuresMarket, IFundProvider fund) { CompanyValuation = companyValuation; @@ -64,6 +75,8 @@ public FinancialModelingPrepApiClient(ICompanyValuationProvider companyValuation StockMarket = stockMarket; StockStatistics = stockStatistics; Crypto = cryptoMarket; + Forex = forexMarket; + Futures = futuresMarket; Fund = fund; } } diff --git a/FinancialModelingPrepApi/Core/Forex/ForexMarketProvider.cs b/FinancialModelingPrepApi/Core/Forex/ForexMarketProvider.cs new file mode 100644 index 0000000..d82bddc --- /dev/null +++ b/FinancialModelingPrepApi/Core/Forex/ForexMarketProvider.cs @@ -0,0 +1,64 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Forex; +using MatthiWare.FinancialModelingPrep.Core.Http; +using MatthiWare.FinancialModelingPrep.Model; +using MatthiWare.FinancialModelingPrep.Model.Forex; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Core.Forex +{ + public class ForexMarketProvider : IForexMarketProvider + { + private readonly FinancialModelingPrepHttpClient client; + + public ForexMarketProvider(FinancialModelingPrepHttpClient client) + { + this.client = client ?? throw new System.ArgumentNullException(nameof(client)); + } + + + public async Task>> GetBookAsync(string symbol) + { + const string url = "[version]/fx/[symbol]"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + + + public async Task>> GetQuoteAsync(string symbol) + { + const string url = "[version]/quote/[symbol]"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + + public async Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period) + { + const string url = "[version]/historical-chart/[pricePeriod]/[symbol]"; + + string pricePeriod = EnumMappings.HistoricalPrices[period]; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + { "pricePeriod", pricePeriod } + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + } +} diff --git a/FinancialModelingPrepApi/Core/Futures/FuturesMarketProvider.cs b/FinancialModelingPrepApi/Core/Futures/FuturesMarketProvider.cs new file mode 100644 index 0000000..a365544 --- /dev/null +++ b/FinancialModelingPrepApi/Core/Futures/FuturesMarketProvider.cs @@ -0,0 +1,49 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Futures; +using MatthiWare.FinancialModelingPrep.Core.Http; +using MatthiWare.FinancialModelingPrep.Model; +using MatthiWare.FinancialModelingPrep.Model.Futures; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Core.Futures +{ + public class FuturesMarketProvider : IFuturesMarketProvider + { + private readonly FinancialModelingPrepHttpClient client; + + public FuturesMarketProvider(FinancialModelingPrepHttpClient client) + { + this.client = client ?? throw new System.ArgumentNullException(nameof(client)); + } + + public async Task>> GetQuoteAsync(string symbol) + { + const string url = "[version]/quote/[symbol]"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + + public async Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period) + { + const string url = "[version]/historical-chart/[pricePeriod]/[symbol]"; + + string pricePeriod = EnumMappings.HistoricalPrices[period]; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + { "pricePeriod", pricePeriod } + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + } +} diff --git a/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs b/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs index 687663c..686529b 100644 --- a/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs +++ b/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs @@ -66,7 +66,7 @@ public async Task> GetStringAsync(string urlPattern, NameVal return ApiResponse.FromError("Invalid parameters"); } - return ApiResponse.FromSucces(response.Data); + return ApiResponse.FromSuccess(response.Data); } finally { @@ -88,7 +88,7 @@ public async Task> GetJsonAsync(string urlPattern, NameValueCo var data = JsonSerializer.Deserialize(response.Data, jsonSerializerOptions); - return ApiResponse.FromSucces(data); + return ApiResponse.FromSuccess(data); } catch (JsonException ex) { @@ -112,7 +112,7 @@ private async Task> CallApiAsync(string urlPattern, NameValu return ApiResponse.FromError($"{response.StatusCode} - {content}"); } - return ApiResponse.FromSucces(content); + return ApiResponse.FromSuccess(content); } private static void PreProcessUrl(ref string url, ref NameValueCollection pathParams, ref QueryStringBuilder qsb) diff --git a/FinancialModelingPrepApi/Core/InstitutionalFund/InstitutionalFundProvider.cs b/FinancialModelingPrepApi/Core/InstitutionalFund/InstitutionalFundProvider.cs index 9662595..5bfe390 100644 --- a/FinancialModelingPrepApi/Core/InstitutionalFund/InstitutionalFundProvider.cs +++ b/FinancialModelingPrepApi/Core/InstitutionalFund/InstitutionalFundProvider.cs @@ -81,7 +81,7 @@ public async Task> MapCusipAsync(string cusip) return ApiResponse.FromError(result.Error); } - return ApiResponse.FromSucces(result.Data.First()); + return ApiResponse.FromSuccess(result.Data.First()); } /// diff --git a/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs b/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs index ebbda8d..d29a212 100644 --- a/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs +++ b/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs @@ -1,6 +1,7 @@ using MatthiWare.FinancialModelingPrep.Abstractions.StockTimeSeries; using MatthiWare.FinancialModelingPrep.Core.Http; using MatthiWare.FinancialModelingPrep.Model; +using MatthiWare.FinancialModelingPrep.Model.StockMarket; using MatthiWare.FinancialModelingPrep.Model.StockTimeSeries; using System; using System.Collections.Generic; @@ -18,6 +19,19 @@ public StockTimeSeriesProvider(FinancialModelingPrepHttpClient client) this.client = client ?? throw new ArgumentNullException(nameof(client)); } + public async Task>> GetQuoteAsync(string symbol) + { + const string url = "[version]/quote/[symbol]"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + /// public Task> GetHistoricalDailyPricesAsync(string symbol) { diff --git a/FinancialModelingPrepApi/DependencyInjectionExtensions.cs b/FinancialModelingPrepApi/DependencyInjectionExtensions.cs index 4311c27..58ab0e2 100644 --- a/FinancialModelingPrepApi/DependencyInjectionExtensions.cs +++ b/FinancialModelingPrepApi/DependencyInjectionExtensions.cs @@ -1,7 +1,10 @@ using MatthiWare.FinancialModelingPrep.Abstractions.AdvancedData; using MatthiWare.FinancialModelingPrep.Abstractions.Calendars; using MatthiWare.FinancialModelingPrep.Abstractions.CompanyValuation; +using MatthiWare.FinancialModelingPrep.Abstractions.Crypto; +using MatthiWare.FinancialModelingPrep.Abstractions.Forex; using MatthiWare.FinancialModelingPrep.Abstractions.Fund; +using MatthiWare.FinancialModelingPrep.Abstractions.Futures; using MatthiWare.FinancialModelingPrep.Abstractions.Http; using MatthiWare.FinancialModelingPrep.Abstractions.InstitutionalFund; using MatthiWare.FinancialModelingPrep.Abstractions.MarketIndexes; @@ -12,7 +15,9 @@ using MatthiWare.FinancialModelingPrep.Core.AdvancedData; using MatthiWare.FinancialModelingPrep.Core.Calendars; using MatthiWare.FinancialModelingPrep.Core.CompanyValuation; +using MatthiWare.FinancialModelingPrep.Core.Forex; using MatthiWare.FinancialModelingPrep.Core.Fund; +using MatthiWare.FinancialModelingPrep.Core.Futures; using MatthiWare.FinancialModelingPrep.Core.Http; using MatthiWare.FinancialModelingPrep.Core.InstitutionalFund; using MatthiWare.FinancialModelingPrep.Core.MarketIndexes; @@ -52,6 +57,8 @@ public static void AddFinancialModelingPrepApiClient(this IServiceCollection ser services.TryAddTransient(); services.TryAddTransient(); services.TryAddTransient(); + services.TryAddTransient(); + services.TryAddTransient(); services.TryAddTransient(); services.TryAddTransient(); } diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index bcea8f6..ac59e4b 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -1,54 +1,55 @@  - - net5.0 - MatthiWare.FinancialModelingPrep - False - True - MatthiWare - MatthiWare.FinancialModelingPrep - FinancialModelingPrep API Client written in .NET 5 - Copyright Matthias Beerens 2021 - FinancialModelingPrep API Client - Matthias Beerens - LICENSE - https://github.com/MatthiWare/FinancialModelingPrep.NET - git - FinancialModelingPrep stock quote finance-api - https://github.com/MatthiWare/FinancialModelingPrep.NET - - - GetEnterpriseValueAsync Type fixed - - FinancialModelingPrep - + + net5.0 + MatthiWare.FinancialModelingPrep + true + true + 0.1.12.0 + 0.1.12.0 + MatthiWare + MatthiWare.FinancialModelingPrep + 0.1.12 + FinancialModelingPrep API Client written in .NET 5 + Copyright Matthias Beerens 2021 + FinancialModelingPrep API Client + Matthias Beerens + LICENSE + https://github.com/MatthiWare/FinancialModelingPrep.NET + git + FinancialModelingPrep stock quote finance-api + https://github.com/MatthiWare/FinancialModelingPrep.NET + + - GetEnterpriseValueAsync Type fixed + + FinancialModelingPrep + AnyCPU;x86;x64 + - - D:\Source\Repos\FinancialModelingPrep.NET\FinancialModelingPrepApi\FinancialModelingPrepApi.xml - + + D:\Source\Repos\FinancialModelingPrep.NET\FinancialModelingPrepApi\FinancialModelingPrepApi.xml + - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + D:\Source\Repos\FinancialModelingPrep.NET\FinancialModelingPrepApi\FinancialModelingPrepApi.xml + - - true - v - true - normal - + + D:\Source\Repos\FinancialModelingPrep.NET\FinancialModelingPrepApi\FinancialModelingPrepApi.xml + - - - True - - - + + + + + + + + + + True + + + diff --git a/FinancialModelingPrepApi/Model/AdvancedData/ESGScoreResponse.cs b/FinancialModelingPrepApi/Model/AdvancedData/ESGScoreResponse.cs index ad919ad..304f2d7 100644 --- a/FinancialModelingPrepApi/Model/AdvancedData/ESGScoreResponse.cs +++ b/FinancialModelingPrepApi/Model/AdvancedData/ESGScoreResponse.cs @@ -23,16 +23,16 @@ public class ESGScoreResponse public string Date { get; set; } [JsonPropertyName("environmentalScore")] - public double EnvironmentalScore { get; set; } + public decimal EnvironmentalScore { get; set; } [JsonPropertyName("socialScore")] - public double SocialScore { get; set; } + public decimal SocialScore { get; set; } [JsonPropertyName("governanceScore")] - public double GovernanceScore { get; set; } + public decimal GovernanceScore { get; set; } [JsonPropertyName("ESGScore")] - public double ESGScore { get; set; } + public decimal ESGScore { get; set; } [JsonPropertyName("url")] public string Url { get; set; } diff --git a/FinancialModelingPrepApi/Model/AdvancedData/FinancialScoreResponse.cs b/FinancialModelingPrepApi/Model/AdvancedData/FinancialScoreResponse.cs new file mode 100644 index 0000000..40d3702 --- /dev/null +++ b/FinancialModelingPrepApi/Model/AdvancedData/FinancialScoreResponse.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Model.AdvancedData +{ + public class FinancialScoreResponse + { + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("altmanZScore")] + public decimal AltmanZScore { get; set; } + + [JsonPropertyName("piotroskiScore")] + public decimal PiotroskiScore { get; set; } + + [JsonPropertyName("workingCapital")] + public decimal WorkingCapital { get; set; } + + [JsonPropertyName("totalAssets")] + public decimal TotalAssets { get; set; } + + [JsonPropertyName("retainedEarnings")] + public decimal RetainedEarnings { get; set; } + + [JsonPropertyName("ebit")] + public decimal Ebit { get; set; } + + [JsonPropertyName("totalLiabilities")] + public decimal TotalLiabilities { get; set; } + + [JsonPropertyName("revenue")] + public decimal Revenue { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/AdvancedData/SharesFloatResponse.cs b/FinancialModelingPrepApi/Model/AdvancedData/SharesFloatResponse.cs index f6be94b..b0a04ae 100644 --- a/FinancialModelingPrepApi/Model/AdvancedData/SharesFloatResponse.cs +++ b/FinancialModelingPrepApi/Model/AdvancedData/SharesFloatResponse.cs @@ -11,13 +11,13 @@ public class SharesFloatResponse public string Date { get; set; } [JsonPropertyName("freeFloat")] - public double FreeFloat { get; set; } + public decimal FreeFloat { get; set; } [JsonPropertyName("floatShares")] - public double FloatShares { get; set; } + public decimal FloatShares { get; set; } [JsonPropertyName("outstandingShares")] - public double OutstandingShares { get; set; } + public decimal OutstandingShares { get; set; } [JsonPropertyName("source")] public string Source { get; set; } diff --git a/FinancialModelingPrepApi/Model/ApiResponse.cs b/FinancialModelingPrepApi/Model/ApiResponse.cs index be7e012..1e1aa59 100644 --- a/FinancialModelingPrepApi/Model/ApiResponse.cs +++ b/FinancialModelingPrepApi/Model/ApiResponse.cs @@ -8,7 +8,7 @@ public static ApiResponse FromError(string error) where TRetur Error = error }; - public static ApiResponse FromSucces(TReturn data) where TReturn : class + public static ApiResponse FromSuccess(TReturn data) where TReturn : class => new() { Data = data diff --git a/FinancialModelingPrepApi/Model/Calendars/DividendCalendarResponse.cs b/FinancialModelingPrepApi/Model/Calendars/DividendCalendarResponse.cs index fc71be2..ed7eab2 100644 --- a/FinancialModelingPrepApi/Model/Calendars/DividendCalendarResponse.cs +++ b/FinancialModelingPrepApi/Model/Calendars/DividendCalendarResponse.cs @@ -11,13 +11,13 @@ public class DividendCalendarResponse public string Label { get; set; } [JsonPropertyName("adjDividend")] - public double AdjDividend { get; set; } + public decimal AdjDividend { get; set; } [JsonPropertyName("symbol")] public string Symbol { get; set; } [JsonPropertyName("dividend")] - public double? Dividend { get; set; } + public decimal? Dividend { get; set; } [JsonPropertyName("recordDate")] public string RecordDate { get; set; } diff --git a/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs b/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs index 01b33a8..b71f3d6 100644 --- a/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs +++ b/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs @@ -11,18 +11,18 @@ public class EarningsCalendarResponse public string Symbol { get; set; } [JsonPropertyName("eps")] - public double? Eps { get; set; } + public decimal? Eps { get; set; } [JsonPropertyName("epsEstimated")] - public double? EpsEstimated { get; set; } + public decimal? EpsEstimated { get; set; } [JsonPropertyName("time")] public string Time { get; set; } [JsonPropertyName("revenue")] - public double? Revenue { get; set; } + public decimal? Revenue { get; set; } [JsonPropertyName("revenueEstimated")] - public double? RevenueEstimated { get; set; } + public decimal? RevenueEstimated { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs b/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs index 45c3bfc..b80916c 100644 --- a/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs +++ b/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs @@ -14,18 +14,18 @@ public class EconomicCalendarResponse public string Country { get; set; } [JsonPropertyName("actual")] - public double? Actual { get; set; } + public decimal? Actual { get; set; } [JsonPropertyName("previous")] - public double? Previous { get; set; } + public decimal? Previous { get; set; } [JsonPropertyName("change")] - public double? Change { get; set; } + public decimal? Change { get; set; } [JsonPropertyName("changePercentage")] - public double? ChangePercentage { get; set; } + public decimal? ChangePercentage { get; set; } [JsonPropertyName("estimate")] - public double? Estimate { get; set; } + public decimal? Estimate { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Calendars/IPOCalendarResponse.cs b/FinancialModelingPrepApi/Model/Calendars/IPOCalendarResponse.cs index 6cfed4f..d51e571 100644 --- a/FinancialModelingPrepApi/Model/Calendars/IPOCalendarResponse.cs +++ b/FinancialModelingPrepApi/Model/Calendars/IPOCalendarResponse.cs @@ -26,6 +26,6 @@ public class IPOCalendarResponse public string PriceRange { get; set; } [JsonPropertyName("marketCap")] - public double? MarketCap { get; set; } + public decimal? MarketCap { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Calendars/StockSplitCalendarResponse.cs b/FinancialModelingPrepApi/Model/Calendars/StockSplitCalendarResponse.cs index d5d7d59..f4551a9 100644 --- a/FinancialModelingPrepApi/Model/Calendars/StockSplitCalendarResponse.cs +++ b/FinancialModelingPrepApi/Model/Calendars/StockSplitCalendarResponse.cs @@ -14,9 +14,9 @@ public class StockSplitCalendarResponse public string Symbol { get; set; } [JsonPropertyName("numerator")] - public double Numerator { get; set; } + public decimal Numerator { get; set; } [JsonPropertyName("denominator")] - public double Denominator { get; set; } + public decimal Denominator { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/BalanceSheetResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/BalanceSheetResponse.cs index 7027fd7..aa1a3a6 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/BalanceSheetResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/BalanceSheetResponse.cs @@ -29,136 +29,136 @@ public class BalanceSheetResponse public string Period { get; set; } [JsonPropertyName("cashAndCashEquivalents")] - public double CashAndCashEquivalents { get; set; } + public decimal CashAndCashEquivalents { get; set; } [JsonPropertyName("shortTermInvestments")] - public double ShortTermInvestments { get; set; } + public decimal ShortTermInvestments { get; set; } [JsonPropertyName("cashAndShortTermInvestments")] - public double CashAndShortTermInvestments { get; set; } + public decimal CashAndShortTermInvestments { get; set; } [JsonPropertyName("netReceivables")] - public double NetReceivables { get; set; } + public decimal NetReceivables { get; set; } [JsonPropertyName("inventory")] - public double Inventory { get; set; } + public decimal Inventory { get; set; } [JsonPropertyName("otherCurrentAssets")] - public double OtherCurrentAssets { get; set; } + public decimal OtherCurrentAssets { get; set; } [JsonPropertyName("totalCurrentAssets")] - public double TotalCurrentAssets { get; set; } + public decimal TotalCurrentAssets { get; set; } [JsonPropertyName("propertyPlantEquipmentNet")] - public double PropertyPlantEquipmentNet { get; set; } + public decimal PropertyPlantEquipmentNet { get; set; } [JsonPropertyName("goodwill")] - public double Goodwill { get; set; } + public decimal Goodwill { get; set; } [JsonPropertyName("intangibleAssets")] - public double IntangibleAssets { get; set; } + public decimal IntangibleAssets { get; set; } [JsonPropertyName("goodwillAndIntangibleAssets")] - public double GoodwillAndIntangibleAssets { get; set; } + public decimal GoodwillAndIntangibleAssets { get; set; } [JsonPropertyName("longTermInvestments")] - public double LongTermInvestments { get; set; } + public decimal LongTermInvestments { get; set; } [JsonPropertyName("taxAssets")] - public double TaxAssets { get; set; } + public decimal TaxAssets { get; set; } [JsonPropertyName("otherNonCurrentAssets")] - public double OtherNonCurrentAssets { get; set; } + public decimal OtherNonCurrentAssets { get; set; } [JsonPropertyName("totalNonCurrentAssets")] - public double TotalNonCurrentAssets { get; set; } + public decimal TotalNonCurrentAssets { get; set; } [JsonPropertyName("otherAssets")] - public double OtherAssets { get; set; } + public decimal OtherAssets { get; set; } [JsonPropertyName("totalAssets")] - public double TotalAssets { get; set; } + public decimal TotalAssets { get; set; } [JsonPropertyName("accountPayables")] - public double AccountPayables { get; set; } + public decimal AccountPayables { get; set; } [JsonPropertyName("shortTermDebt")] - public double ShortTermDebt { get; set; } + public decimal ShortTermDebt { get; set; } [JsonPropertyName("taxPayables")] - public double TaxPayables { get; set; } + public decimal TaxPayables { get; set; } [JsonPropertyName("deferredRevenue")] - public double DeferredRevenue { get; set; } + public decimal DeferredRevenue { get; set; } [JsonPropertyName("otherCurrentLiabilities")] - public double OtherCurrentLiabilities { get; set; } + public decimal OtherCurrentLiabilities { get; set; } [JsonPropertyName("totalCurrentLiabilities")] - public double TotalCurrentLiabilities { get; set; } + public decimal TotalCurrentLiabilities { get; set; } [JsonPropertyName("longTermDebt")] - public double LongTermDebt { get; set; } + public decimal LongTermDebt { get; set; } [JsonPropertyName("deferredRevenueNonCurrent")] - public double DeferredRevenueNonCurrent { get; set; } + public decimal DeferredRevenueNonCurrent { get; set; } [JsonPropertyName("deferredTaxLiabilitiesNonCurrent")] - public double DeferredTaxLiabilitiesNonCurrent { get; set; } + public decimal DeferredTaxLiabilitiesNonCurrent { get; set; } [JsonPropertyName("otherNonCurrentLiabilities")] - public double OtherNonCurrentLiabilities { get; set; } + public decimal OtherNonCurrentLiabilities { get; set; } [JsonPropertyName("totalNonCurrentLiabilities")] - public double TotalNonCurrentLiabilities { get; set; } + public decimal TotalNonCurrentLiabilities { get; set; } [JsonPropertyName("otherLiabilities")] - public double OtherLiabilities { get; set; } + public decimal OtherLiabilities { get; set; } [JsonPropertyName("capitalLeaseObligations")] - public double CapitalLeaseObligations { get; set; } + public decimal CapitalLeaseObligations { get; set; } [JsonPropertyName("totalLiabilities")] - public double TotalLiabilities { get; set; } + public decimal TotalLiabilities { get; set; } [JsonPropertyName("preferredStock")] - public double PreferredStock { get; set; } + public decimal PreferredStock { get; set; } [JsonPropertyName("commonStock")] - public double CommonStock { get; set; } + public decimal CommonStock { get; set; } [JsonPropertyName("retainedEarnings")] - public double RetainedEarnings { get; set; } + public decimal RetainedEarnings { get; set; } [JsonPropertyName("accumulatedOtherComprehensiveIncomeLoss")] - public double AccumulatedOtherComprehensiveIncomeLoss { get; set; } + public decimal AccumulatedOtherComprehensiveIncomeLoss { get; set; } [JsonPropertyName("othertotalStockholdersEquity")] - public double OthertotalStockholdersEquity { get; set; } + public decimal OthertotalStockholdersEquity { get; set; } [JsonPropertyName("totalStockholdersEquity")] - public double TotalStockholdersEquity { get; set; } + public decimal TotalStockholdersEquity { get; set; } [JsonPropertyName("totalLiabilitiesAndStockholdersEquity")] - public double TotalLiabilitiesAndStockholdersEquity { get; set; } + public decimal TotalLiabilitiesAndStockholdersEquity { get; set; } [JsonPropertyName("minorityInterest")] - public double MinorityInterest { get; set; } + public decimal MinorityInterest { get; set; } [JsonPropertyName("totalEquity")] - public double TotalEquity { get; set; } + public decimal TotalEquity { get; set; } [JsonPropertyName("totalLiabilitiesAndTotalEquity")] - public double TotalLiabilitiesAndTotalEquity { get; set; } + public decimal TotalLiabilitiesAndTotalEquity { get; set; } [JsonPropertyName("totalInvestments")] - public double TotalInvestments { get; set; } + public decimal TotalInvestments { get; set; } [JsonPropertyName("totalDebt")] - public double TotalDebt { get; set; } + public decimal TotalDebt { get; set; } [JsonPropertyName("netDebt")] - public double NetDebt { get; set; } + public decimal NetDebt { get; set; } [JsonPropertyName("link")] public string Link { get; set; } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/CashFlowResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/CashFlowResponse.cs index 85cde0d..52ad41f 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/CashFlowResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/CashFlowResponse.cs @@ -29,94 +29,94 @@ public class CashFlowResponse public string Period { get; set; } [JsonPropertyName("netIncome")] - public double NetIncome { get; set; } + public decimal NetIncome { get; set; } [JsonPropertyName("depreciationAndAmortization")] - public double DepreciationAndAmortization { get; set; } + public decimal DepreciationAndAmortization { get; set; } [JsonPropertyName("deferredIncomeTax")] - public double DeferredIncomeTax { get; set; } + public decimal DeferredIncomeTax { get; set; } [JsonPropertyName("stockBasedCompensation")] - public double StockBasedCompensation { get; set; } + public decimal StockBasedCompensation { get; set; } [JsonPropertyName("changeInWorkingCapital")] - public double ChangeInWorkingCapital { get; set; } + public decimal ChangeInWorkingCapital { get; set; } [JsonPropertyName("accountsReceivables")] - public double AccountsReceivables { get; set; } + public decimal AccountsReceivables { get; set; } [JsonPropertyName("inventory")] - public double Inventory { get; set; } + public decimal Inventory { get; set; } [JsonPropertyName("accountsPayables")] - public double AccountsPayables { get; set; } + public decimal AccountsPayables { get; set; } [JsonPropertyName("otherWorkingCapital")] - public double OtherWorkingCapital { get; set; } + public decimal OtherWorkingCapital { get; set; } [JsonPropertyName("otherNonCashItems")] - public double OtherNonCashItems { get; set; } + public decimal OtherNonCashItems { get; set; } [JsonPropertyName("netCashProvidedByOperatingActivities")] - public double NetCashProvidedByOperatingActivities { get; set; } + public decimal NetCashProvidedByOperatingActivities { get; set; } [JsonPropertyName("investmentsInPropertyPlantAndEquipment")] - public double InvestmentsInPropertyPlantAndEquipment { get; set; } + public decimal InvestmentsInPropertyPlantAndEquipment { get; set; } [JsonPropertyName("acquisitionsNet")] - public double AcquisitionsNet { get; set; } + public decimal AcquisitionsNet { get; set; } [JsonPropertyName("purchasesOfInvestments")] - public double PurchasesOfInvestments { get; set; } + public decimal PurchasesOfInvestments { get; set; } [JsonPropertyName("salesMaturitiesOfInvestments")] - public double SalesMaturitiesOfInvestments { get; set; } + public decimal SalesMaturitiesOfInvestments { get; set; } [JsonPropertyName("otherInvestingActivites")] - public double OtherInvestingActivites { get; set; } + public decimal OtherInvestingActivites { get; set; } [JsonPropertyName("netCashUsedForInvestingActivites")] - public double NetCashUsedForInvestingActivites { get; set; } + public decimal NetCashUsedForInvestingActivites { get; set; } [JsonPropertyName("debtRepayment")] - public double DebtRepayment { get; set; } + public decimal DebtRepayment { get; set; } [JsonPropertyName("commonStockIssued")] - public double CommonStockIssued { get; set; } + public decimal CommonStockIssued { get; set; } [JsonPropertyName("commonStockRepurchased")] - public double CommonStockRepurchased { get; set; } + public decimal CommonStockRepurchased { get; set; } [JsonPropertyName("dividendsPaid")] - public double DividendsPaid { get; set; } + public decimal DividendsPaid { get; set; } [JsonPropertyName("otherFinancingActivites")] - public double OtherFinancingActivites { get; set; } + public decimal OtherFinancingActivites { get; set; } [JsonPropertyName("netCashUsedProvidedByFinancingActivities")] - public double NetCashUsedProvidedByFinancingActivities { get; set; } + public decimal NetCashUsedProvidedByFinancingActivities { get; set; } [JsonPropertyName("effectOfForexChangesOnCash")] - public double EffectOfForexChangesOnCash { get; set; } + public decimal EffectOfForexChangesOnCash { get; set; } [JsonPropertyName("netChangeInCash")] - public double NetChangeInCash { get; set; } + public decimal NetChangeInCash { get; set; } [JsonPropertyName("cashAtEndOfPeriod")] - public double CashAtEndOfPeriod { get; set; } + public decimal CashAtEndOfPeriod { get; set; } [JsonPropertyName("cashAtBeginningOfPeriod")] - public double CashAtBeginningOfPeriod { get; set; } + public decimal CashAtBeginningOfPeriod { get; set; } [JsonPropertyName("operatingCashFlow")] - public double OperatingCashFlow { get; set; } + public decimal OperatingCashFlow { get; set; } [JsonPropertyName("capitalExpenditure")] - public double CapitalExpenditure { get; set; } + public decimal CapitalExpenditure { get; set; } [JsonPropertyName("freeCashFlow")] - public double FreeCashFlow { get; set; } + public decimal FreeCashFlow { get; set; } [JsonPropertyName("link")] public string Link { get; set; } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/CompanyProfileResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/CompanyProfileResponse.cs index a175e4a..159ec3e 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/CompanyProfileResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/CompanyProfileResponse.cs @@ -8,10 +8,10 @@ public class CompanyProfileResponse public string Symbol { get; set; } [JsonPropertyName("price")] - public double Price { get; set; } + public decimal Price { get; set; } [JsonPropertyName("beta")] - public double Beta { get; set; } + public decimal Beta { get; set; } [JsonPropertyName("volAvg")] public int VolAvg { get; set; } @@ -20,13 +20,13 @@ public class CompanyProfileResponse public long MktCap { get; set; } [JsonPropertyName("lastDiv")] - public double LastDiv { get; set; } + public decimal LastDiv { get; set; } [JsonPropertyName("range")] public string Range { get; set; } [JsonPropertyName("changes")] - public double Changes { get; set; } + public decimal Changes { get; set; } [JsonPropertyName("companyName")] public string CompanyName { get; set; } @@ -86,10 +86,10 @@ public class CompanyProfileResponse public string Zip { get; set; } [JsonPropertyName("dcfDiff")] - public double? DcfDiff { get; set; } + public decimal? DcfDiff { get; set; } [JsonPropertyName("dcf")] - public double? Dcf { get; set; } + public decimal? Dcf { get; set; } [JsonPropertyName("image")] public string Image { get; set; } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/DCFResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/DCFResponse.cs index 3977a8e..179775b 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/DCFResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/DCFResponse.cs @@ -11,9 +11,9 @@ public class DCFResponse public string Date { get; set; } [JsonPropertyName("dcf")] - public double Dcf { get; set; } + public decimal Dcf { get; set; } [JsonPropertyName("StockPrice")] - public double StockPrice { get; set; } + public decimal StockPrice { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/EnterpriseValueResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/EnterpriseValueResponse.cs index 38dc0b9..3862b40 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/EnterpriseValueResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/EnterpriseValueResponse.cs @@ -11,21 +11,21 @@ public class EnterpriseValueResponse public string Date { get; set; } [JsonPropertyName("stockPrice")] - public double StockPrice { get; set; } + public decimal StockPrice { get; set; } [JsonPropertyName("numberOfShares")] public long NumberOfShares { get; set; } [JsonPropertyName("marketCapitalization")] - public double MarketCapitalization { get; set; } + public decimal MarketCapitalization { get; set; } [JsonPropertyName("minusCashAndCashEquivalents")] - public double MinusCashAndCashEquivalents { get; set; } + public decimal MinusCashAndCashEquivalents { get; set; } [JsonPropertyName("addTotalDebt")] - public double AddTotalDebt { get; set; } + public decimal AddTotalDebt { get; set; } [JsonPropertyName("enterpriseValue")] - public double EnterpriseValue { get; set; } + public decimal EnterpriseValue { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDCFResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDCFResponse.cs index 4220533..b3de217 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDCFResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDCFResponse.cs @@ -12,9 +12,9 @@ public class HistoricalDCFResponse public string Date { get; set; } [JsonPropertyName("price")] - public double Price { get; set; } + public decimal Price { get; set; } [JsonPropertyName("dcf")] - public double? Dcf { get; set; } + public decimal? Dcf { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDailyDCFResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDailyDCFResponse.cs index f8c3e05..aab8ced 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDailyDCFResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/HistoricalDailyDCFResponse.cs @@ -11,6 +11,6 @@ public class HistoricalDailyDCFResponse public string Date { get; set; } [JsonPropertyName("dcf")] - public double Dcf { get; set; } + public decimal Dcf { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/IncomeStatementResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/IncomeStatementResponse.cs index e14db52..e16529a 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/IncomeStatementResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/IncomeStatementResponse.cs @@ -29,88 +29,88 @@ public class IncomeStatementResponse public string Period { get; set; } [JsonPropertyName("revenue")] - public double Revenue { get; set; } + public decimal Revenue { get; set; } [JsonPropertyName("costOfRevenue")] - public double CostOfRevenue { get; set; } + public decimal CostOfRevenue { get; set; } [JsonPropertyName("grossProfit")] - public double GrossProfit { get; set; } + public decimal GrossProfit { get; set; } [JsonPropertyName("grossProfitRatio")] - public double GrossProfitRatio { get; set; } + public decimal GrossProfitRatio { get; set; } [JsonPropertyName("researchAndDevelopmentExpenses")] - public double ResearchAndDevelopmentExpenses { get; set; } + public decimal ResearchAndDevelopmentExpenses { get; set; } [JsonPropertyName("generalAndAdministrativeExpenses")] - public double GeneralAndAdministrativeExpenses { get; set; } + public decimal GeneralAndAdministrativeExpenses { get; set; } [JsonPropertyName("sellingAndMarketingExpenses")] - public double SellingAndMarketingExpenses { get; set; } + public decimal SellingAndMarketingExpenses { get; set; } [JsonPropertyName("sellingGeneralAndAdministrativeExpenses")] - public double SellingGeneralAndAdministrativeExpenses { get; set; } + public decimal SellingGeneralAndAdministrativeExpenses { get; set; } [JsonPropertyName("otherExpenses")] - public double OtherExpenses { get; set; } + public decimal OtherExpenses { get; set; } [JsonPropertyName("operatingExpenses")] - public double OperatingExpenses { get; set; } + public decimal OperatingExpenses { get; set; } [JsonPropertyName("costAndExpenses")] - public double CostAndExpenses { get; set; } + public decimal CostAndExpenses { get; set; } [JsonPropertyName("interestIncome")] - public double InterestIncome { get; set; } + public decimal InterestIncome { get; set; } [JsonPropertyName("interestExpense")] - public double InterestExpense { get; set; } + public decimal InterestExpense { get; set; } [JsonPropertyName("depreciationAndAmortization")] - public double DepreciationAndAmortization { get; set; } + public decimal DepreciationAndAmortization { get; set; } [JsonPropertyName("ebitda")] - public double Ebitda { get; set; } + public decimal Ebitda { get; set; } [JsonPropertyName("ebitdaratio")] - public double Ebitdaratio { get; set; } + public decimal Ebitdaratio { get; set; } [JsonPropertyName("operatingIncome")] - public double OperatingIncome { get; set; } + public decimal OperatingIncome { get; set; } [JsonPropertyName("operatingIncomeRatio")] - public double OperatingIncomeRatio { get; set; } + public decimal OperatingIncomeRatio { get; set; } [JsonPropertyName("totalOtherIncomeExpensesNet")] - public double TotalOtherIncomeExpensesNet { get; set; } + public decimal TotalOtherIncomeExpensesNet { get; set; } [JsonPropertyName("incomeBeforeTax")] - public double IncomeBeforeTax { get; set; } + public decimal IncomeBeforeTax { get; set; } [JsonPropertyName("incomeBeforeTaxRatio")] - public double IncomeBeforeTaxRatio { get; set; } + public decimal IncomeBeforeTaxRatio { get; set; } [JsonPropertyName("incomeTaxExpense")] - public double IncomeTaxExpense { get; set; } + public decimal IncomeTaxExpense { get; set; } [JsonPropertyName("netIncome")] - public double NetIncome { get; set; } + public decimal NetIncome { get; set; } [JsonPropertyName("netIncomeRatio")] - public double NetIncomeRatio { get; set; } + public decimal NetIncomeRatio { get; set; } [JsonPropertyName("eps")] - public double Eps { get; set; } + public decimal Eps { get; set; } [JsonPropertyName("epsdiluted")] - public double Epsdiluted { get; set; } + public decimal Epsdiluted { get; set; } [JsonPropertyName("weightedAverageShsOut")] - public double WeightedAverageShsOut { get; set; } + public decimal WeightedAverageShsOut { get; set; } [JsonPropertyName("weightedAverageShsOutDil")] - public double WeightedAverageShsOutDil { get; set; } + public decimal WeightedAverageShsOutDil { get; set; } [JsonPropertyName("link")] public string Link { get; set; } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsResponse.cs index 5d3e13b..befb579 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsResponse.cs @@ -14,174 +14,174 @@ public class KeyMetricsResponse public string Period { get; set; } [JsonPropertyName("revenuePerShare")] - public double? RevenuePerShare { get; set; } + public decimal? RevenuePerShare { get; set; } [JsonPropertyName("netIncomePerShare")] - public double? NetIncomePerShare { get; set; } + public decimal? NetIncomePerShare { get; set; } [JsonPropertyName("operatingCashFlowPerShare")] - public double? OperatingCashFlowPerShare { get; set; } + public decimal? OperatingCashFlowPerShare { get; set; } [JsonPropertyName("freeCashFlowPerShare")] - public double? FreeCashFlowPerShare { get; set; } + public decimal? FreeCashFlowPerShare { get; set; } [JsonPropertyName("cashPerShare")] - public double? CashPerShare { get; set; } + public decimal? CashPerShare { get; set; } [JsonPropertyName("bookValuePerShare")] - public double? BookValuePerShare { get; set; } + public decimal? BookValuePerShare { get; set; } [JsonPropertyName("tangibleBookValuePerShare")] - public double? TangibleBookValuePerShare { get; set; } + public decimal? TangibleBookValuePerShare { get; set; } [JsonPropertyName("shareholdersEquityPerShare")] - public double? ShareholdersEquityPerShare { get; set; } + public decimal? ShareholdersEquityPerShare { get; set; } [JsonPropertyName("interestDebtPerShare")] - public double? InterestDebtPerShare { get; set; } + public decimal? InterestDebtPerShare { get; set; } [JsonPropertyName("marketCap")] - public double? MarketCap { get; set; } + public decimal? MarketCap { get; set; } [JsonPropertyName("enterpriseValue")] - public double? EnterpriseValue { get; set; } + public decimal? EnterpriseValue { get; set; } [JsonPropertyName("peRatio")] - public double? PeRatio { get; set; } + public decimal? PeRatio { get; set; } [JsonPropertyName("priceToSalesRatio")] - public double? PriceToSalesRatio { get; set; } + public decimal? PriceToSalesRatio { get; set; } [JsonPropertyName("pocfratio")] - public double? Pocfratio { get; set; } + public decimal? Pocfratio { get; set; } [JsonPropertyName("pfcfRatio")] - public double? PfcfRatio { get; set; } + public decimal? PfcfRatio { get; set; } [JsonPropertyName("pbRatio")] - public double? PbRatio { get; set; } + public decimal? PbRatio { get; set; } [JsonPropertyName("ptbRatio")] - public double? PtbRatio { get; set; } + public decimal? PtbRatio { get; set; } [JsonPropertyName("evToSales")] - public double? EvToSales { get; set; } + public decimal? EvToSales { get; set; } [JsonPropertyName("enterpriseValueOverEBITDA")] - public double? EnterpriseValueOverEBITDA { get; set; } + public decimal? EnterpriseValueOverEBITDA { get; set; } [JsonPropertyName("evToOperatingCashFlow")] - public double? EvToOperatingCashFlow { get; set; } + public decimal? EvToOperatingCashFlow { get; set; } [JsonPropertyName("evToFreeCashFlow")] - public double? EvToFreeCashFlow { get; set; } + public decimal? EvToFreeCashFlow { get; set; } [JsonPropertyName("earningsYield")] - public double? EarningsYield { get; set; } + public decimal? EarningsYield { get; set; } [JsonPropertyName("freeCashFlowYield")] - public double? FreeCashFlowYield { get; set; } + public decimal? FreeCashFlowYield { get; set; } [JsonPropertyName("debtToEquity")] - public double? DebtToEquity { get; set; } + public decimal? DebtToEquity { get; set; } [JsonPropertyName("debtToAssets")] - public double? DebtToAssets { get; set; } + public decimal? DebtToAssets { get; set; } [JsonPropertyName("netDebtToEBITDA")] - public double? NetDebtToEBITDA { get; set; } + public decimal? NetDebtToEBITDA { get; set; } [JsonPropertyName("currentRatio")] - public double? CurrentRatio { get; set; } + public decimal? CurrentRatio { get; set; } [JsonPropertyName("interestCoverage")] - public double? InterestCoverage { get; set; } + public decimal? InterestCoverage { get; set; } [JsonPropertyName("incomeQuality")] - public double? IncomeQuality { get; set; } + public decimal? IncomeQuality { get; set; } [JsonPropertyName("dividendYield")] - public double? DividendYield { get; set; } + public decimal? DividendYield { get; set; } [JsonPropertyName("payoutRatio")] - public double? PayoutRatio { get; set; } + public decimal? PayoutRatio { get; set; } [JsonPropertyName("salesGeneralAndAdministrativeToRevenue")] - public double? SalesGeneralAndAdministrativeToRevenue { get; set; } + public decimal? SalesGeneralAndAdministrativeToRevenue { get; set; } [JsonPropertyName("researchAndDdevelopementToRevenue")] - public double? ResearchAndDdevelopementToRevenue { get; set; } + public decimal? ResearchAndDdevelopementToRevenue { get; set; } [JsonPropertyName("intangiblesToTotalAssets")] - public double? IntangiblesToTotalAssets { get; set; } + public decimal? IntangiblesToTotalAssets { get; set; } [JsonPropertyName("capexToOperatingCashFlow")] - public double? CapexToOperatingCashFlow { get; set; } + public decimal? CapexToOperatingCashFlow { get; set; } [JsonPropertyName("capexToRevenue")] - public double? CapexToRevenue { get; set; } + public decimal? CapexToRevenue { get; set; } [JsonPropertyName("capexToDepreciation")] - public double? CapexToDepreciation { get; set; } + public decimal? CapexToDepreciation { get; set; } [JsonPropertyName("stockBasedCompensationToRevenue")] - public double? StockBasedCompensationToRevenue { get; set; } + public decimal? StockBasedCompensationToRevenue { get; set; } [JsonPropertyName("grahamNumber")] - public double? GrahamNumber { get; set; } + public decimal? GrahamNumber { get; set; } [JsonPropertyName("roic")] - public double? Roic { get; set; } + public decimal? Roic { get; set; } [JsonPropertyName("returnOnTangibleAssets")] - public double? ReturnOnTangibleAssets { get; set; } + public decimal? ReturnOnTangibleAssets { get; set; } [JsonPropertyName("grahamNetNet")] - public double? GrahamNetNet { get; set; } + public decimal? GrahamNetNet { get; set; } [JsonPropertyName("workingCapital")] - public double? WorkingCapital { get; set; } + public decimal? WorkingCapital { get; set; } [JsonPropertyName("tangibleAssetValue")] - public double? TangibleAssetValue { get; set; } + public decimal? TangibleAssetValue { get; set; } [JsonPropertyName("netCurrentAssetValue")] - public double? NetCurrentAssetValue { get; set; } + public decimal? NetCurrentAssetValue { get; set; } [JsonPropertyName("investedCapital")] - public double? InvestedCapital { get; set; } + public decimal? InvestedCapital { get; set; } [JsonPropertyName("averageReceivables")] - public double? AverageReceivables { get; set; } + public decimal? AverageReceivables { get; set; } [JsonPropertyName("averagePayables")] - public double? AveragePayables { get; set; } + public decimal? AveragePayables { get; set; } [JsonPropertyName("averageInventory")] - public double? AverageInventory { get; set; } + public decimal? AverageInventory { get; set; } [JsonPropertyName("daysSalesOutstanding")] - public double? DaysSalesOutstanding { get; set; } + public decimal? DaysSalesOutstanding { get; set; } [JsonPropertyName("daysPayablesOutstanding")] - public double? DaysPayablesOutstanding { get; set; } + public decimal? DaysPayablesOutstanding { get; set; } [JsonPropertyName("daysOfInventoryOnHand")] - public double? DaysOfInventoryOnHand { get; set; } + public decimal? DaysOfInventoryOnHand { get; set; } [JsonPropertyName("receivablesTurnover")] - public double? ReceivablesTurnover { get; set; } + public decimal? ReceivablesTurnover { get; set; } [JsonPropertyName("payablesTurnover")] - public double? PayablesTurnover { get; set; } + public decimal? PayablesTurnover { get; set; } [JsonPropertyName("inventoryTurnover")] - public double? InventoryTurnover { get; set; } + public decimal? InventoryTurnover { get; set; } [JsonPropertyName("roe")] - public double? Roe { get; set; } + public decimal? Roe { get; set; } [JsonPropertyName("capexPerShare")] - public double? CapexPerShare { get; set; } + public decimal? CapexPerShare { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsTTMResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsTTMResponse.cs index 7736503..a5c44f5 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsTTMResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/KeyMetricsTTMResponse.cs @@ -5,136 +5,136 @@ namespace MatthiWare.FinancialModelingPrep.Model.CompanyValuation public class KeyMetricsTTMResponse { [JsonPropertyName("revenuePerShareTTM")] - public double? RevenuePerShareTTM { get; set; } + public decimal? RevenuePerShareTTM { get; set; } [JsonPropertyName("netIncomePerShareTTM")] - public double? NetIncomePerShareTTM { get; set; } + public decimal? NetIncomePerShareTTM { get; set; } [JsonPropertyName("operatingCashFlowPerShareTTM")] - public double? OperatingCashFlowPerShareTTM { get; set; } + public decimal? OperatingCashFlowPerShareTTM { get; set; } [JsonPropertyName("freeCashFlowPerShareTTM")] - public double? FreeCashFlowPerShareTTM { get; set; } + public decimal? FreeCashFlowPerShareTTM { get; set; } [JsonPropertyName("cashPerShareTTM")] - public double? CashPerShareTTM { get; set; } + public decimal? CashPerShareTTM { get; set; } [JsonPropertyName("bookValuePerShareTTM")] - public double? BookValuePerShareTTM { get; set; } + public decimal? BookValuePerShareTTM { get; set; } [JsonPropertyName("tangibleBookValuePerShareTTM")] - public double? TangibleBookValuePerShareTTM { get; set; } + public decimal? TangibleBookValuePerShareTTM { get; set; } [JsonPropertyName("shareholdersEquityPerShareTTM")] - public double? ShareholdersEquityPerShareTTM { get; set; } + public decimal? ShareholdersEquityPerShareTTM { get; set; } [JsonPropertyName("interestDebtPerShareTTM")] - public double? InterestDebtPerShareTTM { get; set; } + public decimal? InterestDebtPerShareTTM { get; set; } [JsonPropertyName("marketCapTTM")] - public double? MarketCapTTM { get; set; } + public decimal? MarketCapTTM { get; set; } [JsonPropertyName("enterpriseValueTTM")] - public double? EnterpriseValueTTM { get; set; } + public decimal? EnterpriseValueTTM { get; set; } [JsonPropertyName("peRatioTTM")] - public double? PeRatioTTM { get; set; } + public decimal? PeRatioTTM { get; set; } [JsonPropertyName("priceToSalesRatioTTM")] - public double? PriceToSalesRatioTTM { get; set; } + public decimal? PriceToSalesRatioTTM { get; set; } [JsonPropertyName("pocfratioTTM")] - public double? PocfratioTTM { get; set; } + public decimal? PocfratioTTM { get; set; } [JsonPropertyName("pfcfRatioTTM")] - public double? PfcfRatioTTM { get; set; } + public decimal? PfcfRatioTTM { get; set; } [JsonPropertyName("pbRatioTTM")] - public double? PbRatioTTM { get; set; } + public decimal? PbRatioTTM { get; set; } [JsonPropertyName("ptbRatioTTM")] - public double? PtbRatioTTM { get; set; } + public decimal? PtbRatioTTM { get; set; } [JsonPropertyName("evToSalesTTM")] - public double? EvToSalesTTM { get; set; } + public decimal? EvToSalesTTM { get; set; } [JsonPropertyName("enterpriseValueOverEBITDATTM")] - public double? EnterpriseValueOverEBITDATTM { get; set; } + public decimal? EnterpriseValueOverEBITDATTM { get; set; } [JsonPropertyName("evToOperatingCashFlowTTM")] - public double? EvToOperatingCashFlowTTM { get; set; } + public decimal? EvToOperatingCashFlowTTM { get; set; } [JsonPropertyName("evToFreeCashFlowTTM")] - public double? EvToFreeCashFlowTTM { get; set; } + public decimal? EvToFreeCashFlowTTM { get; set; } [JsonPropertyName("earningsYieldTTM")] - public double? EarningsYieldTTM { get; set; } + public decimal? EarningsYieldTTM { get; set; } [JsonPropertyName("freeCashFlowYieldTTM")] - public double? FreeCashFlowYieldTTM { get; set; } + public decimal? FreeCashFlowYieldTTM { get; set; } [JsonPropertyName("debtToEquityTTM")] - public double? DebtToEquityTTM { get; set; } + public decimal? DebtToEquityTTM { get; set; } [JsonPropertyName("debtToAssetsTTM")] - public double? DebtToAssetsTTM { get; set; } + public decimal? DebtToAssetsTTM { get; set; } [JsonPropertyName("debtToMarketCapTTM")] - public double? DebtToMarketCapTTM { get; set; } + public decimal? DebtToMarketCapTTM { get; set; } [JsonPropertyName("netDebtToEBITDATTM")] - public double? NetDebtToEBITDATTM { get; set; } + public decimal? NetDebtToEBITDATTM { get; set; } [JsonPropertyName("currentRatioTTM")] - public double? CurrentRatioTTM { get; set; } + public decimal? CurrentRatioTTM { get; set; } [JsonPropertyName("interestCoverageTTM")] - public double? InterestCoverageTTM { get; set; } + public decimal? InterestCoverageTTM { get; set; } [JsonPropertyName("incomeQualityTTM")] - public double? IncomeQualityTTM { get; set; } + public decimal? IncomeQualityTTM { get; set; } [JsonPropertyName("dividendYieldTTM")] - public double? DividendYieldTTM { get; set; } + public decimal? DividendYieldTTM { get; set; } [JsonPropertyName("dividendYieldPercentageTTM")] - public double? DividendYieldPercentageTTM { get; set; } + public decimal? DividendYieldPercentageTTM { get; set; } [JsonPropertyName("payoutRatioTTM")] - public double? PayoutRatioTTM { get; set; } + public decimal? PayoutRatioTTM { get; set; } [JsonPropertyName("salesGeneralAndAdministrativeToRevenueTTM")] - public double? SalesGeneralAndAdministrativeToRevenueTTM { get; set; } + public decimal? SalesGeneralAndAdministrativeToRevenueTTM { get; set; } [JsonPropertyName("researchAndDevelopementToRevenueTTM")] - public double? ResearchAndDevelopementToRevenueTTM { get; set; } + public decimal? ResearchAndDevelopementToRevenueTTM { get; set; } [JsonPropertyName("intangiblesToTotalAssetsTTM")] - public double? IntangiblesToTotalAssetsTTM { get; set; } + public decimal? IntangiblesToTotalAssetsTTM { get; set; } [JsonPropertyName("capexToOperatingCashFlowTTM")] - public double? CapexToOperatingCashFlowTTM { get; set; } + public decimal? CapexToOperatingCashFlowTTM { get; set; } [JsonPropertyName("capexToRevenueTTM")] - public double? CapexToRevenueTTM { get; set; } + public decimal? CapexToRevenueTTM { get; set; } [JsonPropertyName("capexToDepreciationTTM")] - public double? CapexToDepreciationTTM { get; set; } + public decimal? CapexToDepreciationTTM { get; set; } [JsonPropertyName("stockBasedCompensationToRevenueTTM")] - public double? StockBasedCompensationToRevenueTTM { get; set; } + public decimal? StockBasedCompensationToRevenueTTM { get; set; } [JsonPropertyName("grahamNumberTTM")] - public double? GrahamNumberTTM { get; set; } + public decimal? GrahamNumberTTM { get; set; } [JsonPropertyName("roicTTM")] - public double? RoicTTM { get; set; } + public decimal? RoicTTM { get; set; } [JsonPropertyName("returnOnTangibleAssetsTTM")] - public double? ReturnOnTangibleAssetsTTM { get; set; } + public decimal? ReturnOnTangibleAssetsTTM { get; set; } [JsonPropertyName("grahamNetNetTTM")] - public double? GrahamNetNetTTM { get; set; } + public decimal? GrahamNetNetTTM { get; set; } [JsonPropertyName("workingCapitalTTM")] public long? WorkingCapitalTTM { get; set; } @@ -143,10 +143,10 @@ public class KeyMetricsTTMResponse public object TangibleAssetValueTTM { get; set; } [JsonPropertyName("netCurrentAssetValueTTM")] - public double? NetCurrentAssetValueTTM { get; set; } + public decimal? NetCurrentAssetValueTTM { get; set; } [JsonPropertyName("investedCapitalTTM")] - public double? InvestedCapitalTTM { get; set; } + public decimal? InvestedCapitalTTM { get; set; } [JsonPropertyName("averageReceivablesTTM")] public long? AverageReceivablesTTM { get; set; } @@ -158,30 +158,30 @@ public class KeyMetricsTTMResponse public long? AverageInventoryTTM { get; set; } [JsonPropertyName("daysSalesOutstandingTTM")] - public double? DaysSalesOutstandingTTM { get; set; } + public decimal? DaysSalesOutstandingTTM { get; set; } [JsonPropertyName("daysPayablesOutstandingTTM")] - public double? DaysPayablesOutstandingTTM { get; set; } + public decimal? DaysPayablesOutstandingTTM { get; set; } [JsonPropertyName("daysOfInventoryOnHandTTM")] - public double? DaysOfInventoryOnHandTTM { get; set; } + public decimal? DaysOfInventoryOnHandTTM { get; set; } [JsonPropertyName("receivablesTurnoverTTM")] - public double? ReceivablesTurnoverTTM { get; set; } + public decimal? ReceivablesTurnoverTTM { get; set; } [JsonPropertyName("payablesTurnoverTTM")] - public double? PayablesTurnoverTTM { get; set; } + public decimal? PayablesTurnoverTTM { get; set; } [JsonPropertyName("inventoryTurnoverTTM")] - public double? InventoryTurnoverTTM { get; set; } + public decimal? InventoryTurnoverTTM { get; set; } [JsonPropertyName("roeTTM")] - public double? RoeTTM { get; set; } + public decimal? RoeTTM { get; set; } [JsonPropertyName("capexPerShareTTM")] - public double? CapexPerShareTTM { get; set; } + public decimal? CapexPerShareTTM { get; set; } [JsonPropertyName("dividendPerShareTTM")] - public double? DividendPerShareTTM { get; set; } + public decimal? DividendPerShareTTM { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/MarketCapResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/MarketCapResponse.cs index b209dcd..d2bedd1 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/MarketCapResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/MarketCapResponse.cs @@ -11,6 +11,6 @@ public class MarketCapResponse public string Date { get; set; } [JsonPropertyName("marketCap")] - public double MarketCap { get; set; } + public decimal MarketCap { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/QuoteResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/QuoteResponse.cs index cf9035a..8e38f6f 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/QuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/QuoteResponse.cs @@ -12,34 +12,34 @@ public class QuoteResponse public string Name { get; set; } [JsonPropertyName("price")] - public double? Price { get; set; } + public decimal? Price { get; set; } [JsonPropertyName("changesPercentage")] - public double? ChangesPercentage { get; set; } + public decimal? ChangesPercentage { get; set; } [JsonPropertyName("change")] - public double? Change { get; set; } + public decimal? Change { get; set; } [JsonPropertyName("dayLow")] - public double? DayLow { get; set; } + public decimal? DayLow { get; set; } [JsonPropertyName("dayHigh")] - public double? DayHigh { get; set; } + public decimal? DayHigh { get; set; } [JsonPropertyName("yearHigh")] - public double? YearHigh { get; set; } + public decimal? YearHigh { get; set; } [JsonPropertyName("yearLow")] - public double? YearLow { get; set; } + public decimal? YearLow { get; set; } [JsonPropertyName("marketCap")] - public double? MarketCap { get; set; } + public decimal? MarketCap { get; set; } [JsonPropertyName("priceAvg50")] - public double? PriceAvg50 { get; set; } + public decimal? PriceAvg50 { get; set; } [JsonPropertyName("priceAvg200")] - public double? PriceAvg200 { get; set; } + public decimal? PriceAvg200 { get; set; } [JsonPropertyName("volume")] public long? Volume { get; set; } @@ -51,16 +51,16 @@ public class QuoteResponse public string Exchange { get; set; } [JsonPropertyName("open")] - public double? Open { get; set; } + public decimal? Open { get; set; } [JsonPropertyName("previousClose")] - public double? PreviousClose { get; set; } + public decimal? PreviousClose { get; set; } [JsonPropertyName("eps")] - public double? Eps { get; set; } + public decimal? Eps { get; set; } [JsonPropertyName("pe")] - public double? Pe { get; set; } + public decimal? Pe { get; set; } [JsonPropertyName("earningsAnnouncement")] public string EarningsAnnouncement { get; set; } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/RatiosTTMResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/RatiosTTMResponse.cs index cb92575..44ebb7e 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/RatiosTTMResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/RatiosTTMResponse.cs @@ -5,177 +5,177 @@ namespace MatthiWare.FinancialModelingPrep.Model.CompanyValuation public class RatiosTTMResponse { [JsonPropertyName("dividendYielTTM")] - public double? DividendYielTTM { get; set; } + public decimal? DividendYielTTM { get; set; } [JsonPropertyName("dividendYielPercentageTTM")] - public double? DividendYielPercentageTTM { get; set; } + public decimal? DividendYielPercentageTTM { get; set; } [JsonPropertyName("peRatioTTM")] - public double? PeRatioTTM { get; set; } + public decimal? PeRatioTTM { get; set; } [JsonPropertyName("pegRatioTTM")] - public double? PegRatioTTM { get; set; } + public decimal? PegRatioTTM { get; set; } [JsonPropertyName("payoutRatioTTM")] - public double? PayoutRatioTTM { get; set; } + public decimal? PayoutRatioTTM { get; set; } [JsonPropertyName("currentRatioTTM")] - public double? CurrentRatioTTM { get; set; } + public decimal? CurrentRatioTTM { get; set; } [JsonPropertyName("quickRatioTTM")] - public double? QuickRatioTTM { get; set; } + public decimal? QuickRatioTTM { get; set; } [JsonPropertyName("cashRatioTTM")] - public double? CashRatioTTM { get; set; } + public decimal? CashRatioTTM { get; set; } [JsonPropertyName("daysOfSalesOutstandingTTM")] - public double? DaysOfSalesOutstandingTTM { get; set; } + public decimal? DaysOfSalesOutstandingTTM { get; set; } [JsonPropertyName("daysOfInventoryOutstandingTTM")] - public double? DaysOfInventoryOutstandingTTM { get; set; } + public decimal? DaysOfInventoryOutstandingTTM { get; set; } [JsonPropertyName("operatingCycleTTM")] - public double? OperatingCycleTTM { get; set; } + public decimal? OperatingCycleTTM { get; set; } [JsonPropertyName("daysOfPayablesOutstandingTTM")] - public double? DaysOfPayablesOutstandingTTM { get; set; } + public decimal? DaysOfPayablesOutstandingTTM { get; set; } [JsonPropertyName("cashConversionCycleTTM")] - public double? CashConversionCycleTTM { get; set; } + public decimal? CashConversionCycleTTM { get; set; } [JsonPropertyName("grossProfitMarginTTM")] - public double? GrossProfitMarginTTM { get; set; } + public decimal? GrossProfitMarginTTM { get; set; } [JsonPropertyName("operatingProfitMarginTTM")] - public double? OperatingProfitMarginTTM { get; set; } + public decimal? OperatingProfitMarginTTM { get; set; } [JsonPropertyName("pretaxProfitMarginTTM")] - public double? PretaxProfitMarginTTM { get; set; } + public decimal? PretaxProfitMarginTTM { get; set; } [JsonPropertyName("netProfitMarginTTM")] - public double? NetProfitMarginTTM { get; set; } + public decimal? NetProfitMarginTTM { get; set; } [JsonPropertyName("effectiveTaxRateTTM")] - public double? EffectiveTaxRateTTM { get; set; } + public decimal? EffectiveTaxRateTTM { get; set; } [JsonPropertyName("returnOnAssetsTTM")] - public double? ReturnOnAssetsTTM { get; set; } + public decimal? ReturnOnAssetsTTM { get; set; } [JsonPropertyName("returnOnEquityTTM")] - public double? ReturnOnEquityTTM { get; set; } + public decimal? ReturnOnEquityTTM { get; set; } [JsonPropertyName("returnOnCapitalEmployedTTM")] - public double? ReturnOnCapitalEmployedTTM { get; set; } + public decimal? ReturnOnCapitalEmployedTTM { get; set; } [JsonPropertyName("netIncomePerEBTTTM")] - public double? NetIncomePerEBTTTM { get; set; } + public decimal? NetIncomePerEBTTTM { get; set; } [JsonPropertyName("ebtPerEbitTTM")] - public double? EbtPerEbitTTM { get; set; } + public decimal? EbtPerEbitTTM { get; set; } [JsonPropertyName("ebitPerRevenueTTM")] - public double? EbitPerRevenueTTM { get; set; } + public decimal? EbitPerRevenueTTM { get; set; } [JsonPropertyName("debtRatioTTM")] - public double? DebtRatioTTM { get; set; } + public decimal? DebtRatioTTM { get; set; } [JsonPropertyName("debtEquityRatioTTM")] - public double? DebtEquityRatioTTM { get; set; } + public decimal? DebtEquityRatioTTM { get; set; } [JsonPropertyName("longTermDebtToCapitalizationTTM")] - public double? LongTermDebtToCapitalizationTTM { get; set; } + public decimal? LongTermDebtToCapitalizationTTM { get; set; } [JsonPropertyName("totalDebtToCapitalizationTTM")] - public double? TotalDebtToCapitalizationTTM { get; set; } + public decimal? TotalDebtToCapitalizationTTM { get; set; } [JsonPropertyName("interestCoverageTTM")] - public double? InterestCoverageTTM { get; set; } + public decimal? InterestCoverageTTM { get; set; } [JsonPropertyName("cashFlowToDebtRatioTTM")] - public double? CashFlowToDebtRatioTTM { get; set; } + public decimal? CashFlowToDebtRatioTTM { get; set; } [JsonPropertyName("companyEquityMultiplierTTM")] - public double? CompanyEquityMultiplierTTM { get; set; } + public decimal? CompanyEquityMultiplierTTM { get; set; } [JsonPropertyName("receivablesTurnoverTTM")] - public double? ReceivablesTurnoverTTM { get; set; } + public decimal? ReceivablesTurnoverTTM { get; set; } [JsonPropertyName("payablesTurnoverTTM")] - public double? PayablesTurnoverTTM { get; set; } + public decimal? PayablesTurnoverTTM { get; set; } [JsonPropertyName("inventoryTurnoverTTM")] - public double? InventoryTurnoverTTM { get; set; } + public decimal? InventoryTurnoverTTM { get; set; } [JsonPropertyName("fixedAssetTurnoverTTM")] - public double? FixedAssetTurnoverTTM { get; set; } + public decimal? FixedAssetTurnoverTTM { get; set; } [JsonPropertyName("assetTurnoverTTM")] - public double? AssetTurnoverTTM { get; set; } + public decimal? AssetTurnoverTTM { get; set; } [JsonPropertyName("operatingCashFlowPerShareTTM")] - public double? OperatingCashFlowPerShareTTM { get; set; } + public decimal? OperatingCashFlowPerShareTTM { get; set; } [JsonPropertyName("freeCashFlowPerShareTTM")] - public double? FreeCashFlowPerShareTTM { get; set; } + public decimal? FreeCashFlowPerShareTTM { get; set; } [JsonPropertyName("cashPerShareTTM")] - public double? CashPerShareTTM { get; set; } + public decimal? CashPerShareTTM { get; set; } [JsonPropertyName("operatingCashFlowSalesRatioTTM")] - public double? OperatingCashFlowSalesRatioTTM { get; set; } + public decimal? OperatingCashFlowSalesRatioTTM { get; set; } [JsonPropertyName("freeCashFlowOperatingCashFlowRatioTTM")] - public double? FreeCashFlowOperatingCashFlowRatioTTM { get; set; } + public decimal? FreeCashFlowOperatingCashFlowRatioTTM { get; set; } [JsonPropertyName("cashFlowCoverageRatiosTTM")] - public double? CashFlowCoverageRatiosTTM { get; set; } + public decimal? CashFlowCoverageRatiosTTM { get; set; } [JsonPropertyName("shortTermCoverageRatiosTTM")] - public double? ShortTermCoverageRatiosTTM { get; set; } + public decimal? ShortTermCoverageRatiosTTM { get; set; } [JsonPropertyName("capitalExpenditureCoverageRatioTTM")] - public double? CapitalExpenditureCoverageRatioTTM { get; set; } + public decimal? CapitalExpenditureCoverageRatioTTM { get; set; } [JsonPropertyName("dividendPaidAndCapexCoverageRatioTTM")] - public double? DividendPaidAndCapexCoverageRatioTTM { get; set; } + public decimal? DividendPaidAndCapexCoverageRatioTTM { get; set; } [JsonPropertyName("priceBookValueRatioTTM")] - public double? PriceBookValueRatioTTM { get; set; } + public decimal? PriceBookValueRatioTTM { get; set; } [JsonPropertyName("priceToBookRatioTTM")] - public double? PriceToBookRatioTTM { get; set; } + public decimal? PriceToBookRatioTTM { get; set; } [JsonPropertyName("priceToSalesRatioTTM")] - public double? PriceToSalesRatioTTM { get; set; } + public decimal? PriceToSalesRatioTTM { get; set; } [JsonPropertyName("priceEarningsRatioTTM")] - public double? PriceEarningsRatioTTM { get; set; } + public decimal? PriceEarningsRatioTTM { get; set; } [JsonPropertyName("priceToFreeCashFlowsRatioTTM")] - public double? PriceToFreeCashFlowsRatioTTM { get; set; } + public decimal? PriceToFreeCashFlowsRatioTTM { get; set; } [JsonPropertyName("priceToOperatingCashFlowsRatioTTM")] - public double? PriceToOperatingCashFlowsRatioTTM { get; set; } + public decimal? PriceToOperatingCashFlowsRatioTTM { get; set; } [JsonPropertyName("priceCashFlowRatioTTM")] - public double? PriceCashFlowRatioTTM { get; set; } + public decimal? PriceCashFlowRatioTTM { get; set; } [JsonPropertyName("priceEarningsToGrowthRatioTTM")] - public double? PriceEarningsToGrowthRatioTTM { get; set; } + public decimal? PriceEarningsToGrowthRatioTTM { get; set; } [JsonPropertyName("priceSalesRatioTTM")] - public double? PriceSalesRatioTTM { get; set; } + public decimal? PriceSalesRatioTTM { get; set; } [JsonPropertyName("dividendYieldTTM")] - public double? DividendYieldTTM { get; set; } + public decimal? DividendYieldTTM { get; set; } [JsonPropertyName("enterpriseValueMultipleTTM")] - public double? EnterpriseValueMultipleTTM { get; set; } + public decimal? EnterpriseValueMultipleTTM { get; set; } [JsonPropertyName("priceFairValueTTM")] - public double? PriceFairValueTTM { get; set; } + public decimal? PriceFairValueTTM { get; set; } [JsonPropertyName("dividendPerShareTTM")] - public double? DividendPerShareTTM { get; set; } + public decimal? DividendPerShareTTM { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/CompanyValuation/SymbolResponse.cs b/FinancialModelingPrepApi/Model/CompanyValuation/SymbolResponse.cs index bc59b9b..95de3d1 100644 --- a/FinancialModelingPrepApi/Model/CompanyValuation/SymbolResponse.cs +++ b/FinancialModelingPrepApi/Model/CompanyValuation/SymbolResponse.cs @@ -11,7 +11,7 @@ public class SymbolResponse public string Name { get; set; } [JsonPropertyName("price")] - public double Price { get; set; } + public decimal Price { get; set; } [JsonPropertyName("exchange")] public string Exchange { get; set; } diff --git a/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs new file mode 100644 index 0000000..a5a7a15 --- /dev/null +++ b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs @@ -0,0 +1,72 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; +using System.Text.Json.Serialization; + +namespace MatthiWare.FinancialModelingPrep.Model.Crypto +{ + public class CryptoQuoteResponse : ICurrentQuote + { + // Crypto + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("exchange")] + public string Exchange { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("price")] + public decimal Price { get; set; } + + [JsonPropertyName("previousclose")] + public decimal PreviousClose { get; set; } + + [JsonPropertyName("daylow")] + public decimal DayLow { get; set; } + + [JsonPropertyName("dayhigh")] + public decimal DayHigh { get; set; } + + [JsonPropertyName("yearlow")] + public decimal YearlyLow { get; set; } + + [JsonPropertyName("yearhigh")] + public decimal YearlyHigh { get; set; } + + [JsonPropertyName("priceavg50")] + public decimal PriceAvg50 { get; set; } + + [JsonPropertyName("priceavg200")] + public decimal PriceAvg200 { get; set; } + + [JsonPropertyName("change")] + public decimal Change { get; set; } + + [JsonPropertyName("changespercentage")] + public decimal ChangesPercentage { get; set; } + + [JsonPropertyName("timestamp")] + public long Timestamp { get; set; } + + // Not used by Forex or Futures. + + [JsonPropertyName("eps")] + public decimal? Eps { get; set; } + + [JsonPropertyName("pe")] + public decimal? Pe { get; set; } + + [JsonPropertyName("earningsAnnouncement")] + public string? EarningsAnnouncement { get; set; } + + [JsonPropertyName("sharesOutstanding")] + public long? SharesOutstanding { get; set; } + + [JsonPropertyName("marketCap")] + public decimal? MarketCap { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs index 6c4fa56..5fb22d6 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs @@ -1,4 +1,5 @@ -using System; +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -28,10 +29,10 @@ public class CryptoHistoricalPricePeriodListing public long Volume { get; set; } } - public class CyptoHistoricalPriceDailyListing + public class CyptoHistoricalPriceDailyListing : IHistoricalQuote { [JsonPropertyName("date")] - public DateTime Date { get; set; } + public string Date { get; set; } [JsonPropertyName("open")] public decimal Open { get; set; } @@ -45,20 +46,20 @@ public class CyptoHistoricalPriceDailyListing [JsonPropertyName("close")] public decimal Close { get; set; } - [JsonPropertyName("adjClose")] - public decimal AdjClose { get; set; } + [JsonPropertyName("change")] + public decimal? Change { get; set; } - [JsonPropertyName("volume")] - public double Volume { get; set; } + [JsonPropertyName("changePercent")] + public decimal? ChangePercent { get; set; } - [JsonPropertyName("unadjustedVolume")] - public double UnadjustedVolume { get; set; } + [JsonPropertyName("volume")] + public decimal Volume { get; set; } - [JsonPropertyName("change")] - public decimal Change { get; set; } + [JsonPropertyName("adjClose")] + public decimal AdjClose { get; set; } - [JsonPropertyName("changePercent")] - public decimal ChangePercent { get; set; } + [JsonPropertyName("unadjustedVolume")] + public decimal UnadjustedVolume { get; set; } [JsonPropertyName("vwap")] public decimal VWAP { get; set; } @@ -67,6 +68,6 @@ public class CyptoHistoricalPriceDailyListing public string Label { get; set; } [JsonPropertyName("changeOvertime")] - public double ChangeOvertime { get; set; } + public decimal ChangeOvertime { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Forex/ForexBookResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexBookResponse.cs new file mode 100644 index 0000000..fe63246 --- /dev/null +++ b/FinancialModelingPrepApi/Model/Forex/ForexBookResponse.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Model.Forex +{ + public class ForexBookResponse + { + [JsonPropertyName("ticker")] + public string Ticker { get; set; } + + [JsonPropertyName("bid")] + public decimal Bid { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("low")] + public decimal Low { get; set; } + + [JsonPropertyName("high")] + public decimal High { get; set; } + + [JsonPropertyName("changes")] + public decimal Changes { get; set; } + + [JsonPropertyName("date")] + public DateTime Date { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs new file mode 100644 index 0000000..b399f98 --- /dev/null +++ b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs @@ -0,0 +1,30 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; +using System.Text.Json.Serialization; + +namespace MatthiWare.FinancialModelingPrep.Model.Forex +{ + public class ForexHistoricalQuoteResponse : IHistoricalQuote + { + [JsonPropertyName("date")] + public string Date { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("high")] + public decimal High { get; set; } + + [JsonPropertyName("low")] + public decimal Low { get; set; } + + [JsonPropertyName("close")] + public decimal Close { get; set; } + + [JsonPropertyName("change")] + public decimal? Change { get; set; } + + [JsonPropertyName("changePercent")] + public decimal? ChangePercent { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs new file mode 100644 index 0000000..9446369 --- /dev/null +++ b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs @@ -0,0 +1,72 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; +using System.Text.Json.Serialization; + +namespace MatthiWare.FinancialModelingPrep.Model.Forex +{ + public class ForexQuoteResponse : ICurrentQuote + { + // FX + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("exchange")] + public string Exchange { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("price")] + public decimal Price { get; set; } + + [JsonPropertyName("previousclose")] + public decimal PreviousClose { get; set; } + + [JsonPropertyName("daylow")] + public decimal DayLow { get; set; } + + [JsonPropertyName("dayhigh")] + public decimal DayHigh { get; set; } + + [JsonPropertyName("yearlow")] + public decimal YearlyLow { get; set; } + + [JsonPropertyName("yearhigh")] + public decimal YearlyHigh { get; set; } + + [JsonPropertyName("priceavg50")] + public decimal PriceAvg50 { get; set; } + + [JsonPropertyName("priceavg200")] + public decimal PriceAvg200 { get; set; } + + [JsonPropertyName("change")] + public decimal Change { get; set; } + + [JsonPropertyName("changespercentage")] + public decimal ChangesPercentage { get; set; } + + [JsonPropertyName("timestamp")] + public long Timestamp { get; set; } + + // Not used by Forex or Futures. + + [JsonPropertyName("eps")] + public decimal? Eps { get; set; } + + [JsonPropertyName("pe")] + public decimal? Pe { get; set; } + + [JsonPropertyName("earningsAnnouncement")] + public string? EarningsAnnouncement { get; set; } + + [JsonPropertyName("sharesOutstanding")] + public long? SharesOutstanding { get; set; } + + [JsonPropertyName("marketCap")] + public decimal? MarketCap { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/Fund/ETFStockExposureResponse.cs b/FinancialModelingPrepApi/Model/Fund/ETFStockExposureResponse.cs index 2bb656e..a8b12f1 100644 --- a/FinancialModelingPrepApi/Model/Fund/ETFStockExposureResponse.cs +++ b/FinancialModelingPrepApi/Model/Fund/ETFStockExposureResponse.cs @@ -14,9 +14,9 @@ public class ETFStockExposureResponse public int SharesNumber { get; set; } [JsonPropertyName("weightPercentage")] - public double WeightPercentage { get; set; } + public decimal WeightPercentage { get; set; } [JsonPropertyName("marketValue")] - public double MarketValue { get; set; } + public decimal MarketValue { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs new file mode 100644 index 0000000..70b1164 --- /dev/null +++ b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs @@ -0,0 +1,30 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; +using System.Text.Json.Serialization; + +namespace MatthiWare.FinancialModelingPrep.Model.Futures +{ + public class FuturesHistoricalQuoteResponse : IHistoricalQuote + { + [JsonPropertyName("date")] + public string Date { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("high")] + public decimal High { get; set; } + + [JsonPropertyName("low")] + public decimal Low { get; set; } + + [JsonPropertyName("close")] + public decimal Close { get; set; } + + [JsonPropertyName("change")] + public decimal? Change { get; set; } + + [JsonPropertyName("changePercent")] + public decimal? ChangePercent { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs new file mode 100644 index 0000000..8334c9f --- /dev/null +++ b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs @@ -0,0 +1,72 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; +using System.Text.Json.Serialization; + +namespace MatthiWare.FinancialModelingPrep.Model.Futures +{ + public class FuturesQuoteResponse : ICurrentQuote + { + // Futures + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("exchange")] + public string Exchange { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("price")] + public decimal Price { get; set; } + + [JsonPropertyName("previousclose")] + public decimal PreviousClose { get; set; } + + [JsonPropertyName("daylow")] + public decimal DayLow { get; set; } + + [JsonPropertyName("dayhigh")] + public decimal DayHigh { get; set; } + + [JsonPropertyName("yearlow")] + public decimal YearlyLow { get; set; } + + [JsonPropertyName("yearhigh")] + public decimal YearlyHigh { get; set; } + + [JsonPropertyName("priceavg50")] + public decimal PriceAvg50 { get; set; } + + [JsonPropertyName("priceavg200")] + public decimal PriceAvg200 { get; set; } + + [JsonPropertyName("change")] + public decimal Change { get; set; } + + [JsonPropertyName("changespercentage")] + public decimal ChangesPercentage { get; set; } + + [JsonPropertyName("timestamp")] + public long Timestamp { get; set; } + + // Not used by Forex or Futures. + + [JsonPropertyName("eps")] + public decimal? Eps { get; set; } + + [JsonPropertyName("pe")] + public decimal? Pe { get; set; } + + [JsonPropertyName("earningsAnnouncement")] + public string? EarningsAnnouncement { get; set; } + + [JsonPropertyName("sharesOutstanding")] + public long? SharesOutstanding { get; set; } + + [JsonPropertyName("marketCap")] + public decimal? MarketCap { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/Statistics/AnalystEstimateItem.cs b/FinancialModelingPrepApi/Model/Statistics/AnalystEstimateItem.cs index 77b0ff5..3778ed8 100644 --- a/FinancialModelingPrepApi/Model/Statistics/AnalystEstimateItem.cs +++ b/FinancialModelingPrepApi/Model/Statistics/AnalystEstimateItem.cs @@ -11,58 +11,58 @@ public class AnalystEstimateItem public string Date { get; set; } [JsonPropertyName("estimatedRevenueLow")] - public double EstimatedRevenueLow { get; set; } + public decimal EstimatedRevenueLow { get; set; } [JsonPropertyName("estimatedRevenueHigh")] - public double EstimatedRevenueHigh { get; set; } + public decimal EstimatedRevenueHigh { get; set; } [JsonPropertyName("estimatedRevenueAvg")] - public double EstimatedRevenueAvg { get; set; } + public decimal EstimatedRevenueAvg { get; set; } [JsonPropertyName("estimatedEbitdaLow")] - public double EstimatedEbitdaLow { get; set; } + public decimal EstimatedEbitdaLow { get; set; } [JsonPropertyName("estimatedEbitdaHigh")] - public double EstimatedEbitdaHigh { get; set; } + public decimal EstimatedEbitdaHigh { get; set; } [JsonPropertyName("estimatedEbitdaAvg")] - public double EstimatedEbitdaAvg { get; set; } + public decimal EstimatedEbitdaAvg { get; set; } [JsonPropertyName("estimatedEbitLow")] - public double EstimatedEbitLow { get; set; } + public decimal EstimatedEbitLow { get; set; } [JsonPropertyName("estimatedEbitHigh")] - public double EstimatedEbitHigh { get; set; } + public decimal EstimatedEbitHigh { get; set; } [JsonPropertyName("estimatedEbitAvg")] - public double EstimatedEbitAvg { get; set; } + public decimal EstimatedEbitAvg { get; set; } [JsonPropertyName("estimatedNetIncomeLow")] - public double EstimatedNetIncomeLow { get; set; } + public decimal EstimatedNetIncomeLow { get; set; } [JsonPropertyName("estimatedNetIncomeHigh")] - public double EstimatedNetIncomeHigh { get; set; } + public decimal EstimatedNetIncomeHigh { get; set; } [JsonPropertyName("estimatedNetIncomeAvg")] - public double EstimatedNetIncomeAvg { get; set; } + public decimal EstimatedNetIncomeAvg { get; set; } [JsonPropertyName("estimatedSgaExpenseLow")] - public double EstimatedSgaExpenseLow { get; set; } + public decimal EstimatedSgaExpenseLow { get; set; } [JsonPropertyName("estimatedSgaExpenseHigh")] - public double EstimatedSgaExpenseHigh { get; set; } + public decimal EstimatedSgaExpenseHigh { get; set; } [JsonPropertyName("estimatedSgaExpenseAvg")] - public double EstimatedSgaExpenseAvg { get; set; } + public decimal EstimatedSgaExpenseAvg { get; set; } [JsonPropertyName("estimatedEpsAvg")] - public double EstimatedEpsAvg { get; set; } + public decimal EstimatedEpsAvg { get; set; } [JsonPropertyName("estimatedEpsHigh")] - public double EstimatedEpsHigh { get; set; } + public decimal EstimatedEpsHigh { get; set; } [JsonPropertyName("estimatedEpsLow")] - public double EstimatedEpsLow { get; set; } + public decimal EstimatedEpsLow { get; set; } [JsonPropertyName("numberAnalystEstimatedRevenue")] public int NumberAnalystEstimatedRevenue { get; set; } diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockMarketSymbolResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockMarketSymbolResponse.cs index 58ce5cf..c9ffb04 100644 --- a/FinancialModelingPrepApi/Model/StockMarket/StockMarketSymbolResponse.cs +++ b/FinancialModelingPrepApi/Model/StockMarket/StockMarketSymbolResponse.cs @@ -8,7 +8,7 @@ public class StockMarketSymbolResponse public string Ticker { get; set; } [JsonPropertyName("changes")] - public double Changes { get; set; } + public decimal Changes { get; set; } [JsonPropertyName("price")] public string Price { get; set; } diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs new file mode 100644 index 0000000..43c58fa --- /dev/null +++ b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs @@ -0,0 +1,72 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; +using System.Text.Json.Serialization; + +namespace MatthiWare.FinancialModelingPrep.Model.StockMarket +{ + public class StockQuoteResponse : ICurrentQuote + { + // Stock + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("exchange")] + public string Exchange { get; set; } + + [JsonPropertyName("open")] + public decimal Open { get; set; } + + [JsonPropertyName("price")] + public decimal Price { get; set; } + + [JsonPropertyName("previousclose")] + public decimal PreviousClose { get; set; } + + [JsonPropertyName("daylow")] + public decimal DayLow { get; set; } + + [JsonPropertyName("dayhigh")] + public decimal DayHigh { get; set; } + + [JsonPropertyName("yearlow")] + public decimal YearlyLow { get; set; } + + [JsonPropertyName("yearhigh")] + public decimal YearlyHigh { get; set; } + + [JsonPropertyName("priceavg50")] + public decimal PriceAvg50 { get; set; } + + [JsonPropertyName("priceavg200")] + public decimal PriceAvg200 { get; set; } + + [JsonPropertyName("change")] + public decimal Change { get; set; } + + [JsonPropertyName("changespercentage")] + public decimal ChangesPercentage { get; set; } + + [JsonPropertyName("timestamp")] + public long Timestamp { get; set; } + + // Not used by Forex or Futures. + + [JsonPropertyName("eps")] + public decimal? Eps { get; set; } + + [JsonPropertyName("pe")] + public decimal? Pe { get; set; } + + [JsonPropertyName("earningsAnnouncement")] + public string? EarningsAnnouncement { get; set; } + + [JsonPropertyName("sharesOutstanding")] + public long? SharesOutstanding { get; set; } + + [JsonPropertyName("marketCap")] + public decimal? MarketCap { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalDividendItem.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalDividendItem.cs index b674522..97bff9f 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalDividendItem.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalDividendItem.cs @@ -11,10 +11,10 @@ public class HistoricalDividendItem public string Label { get; set; } [JsonPropertyName("adjDividend")] - public double AdjDividend { get; set; } + public decimal AdjDividend { get; set; } [JsonPropertyName("dividend")] - public double Dividend { get; set; } + public decimal Dividend { get; set; } [JsonPropertyName("recordDate")] public string RecordDate { get; set; } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs index 1079851..f20c898 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs @@ -8,16 +8,16 @@ public class HistoricalPriceForChartWithVolumeResponse public string Date { get; set; } [JsonPropertyName("open")] - public double Open { get; set; } + public decimal Open { get; set; } [JsonPropertyName("low")] - public double Low { get; set; } + public decimal Low { get; set; } [JsonPropertyName("high")] - public double High { get; set; } + public decimal High { get; set; } [JsonPropertyName("close")] - public double Close { get; set; } + public decimal Close { get; set; } [JsonPropertyName("volume")] public int Volume { get; set; } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForLineChartResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForLineChartResponse.cs index d3ffc26..083425a 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForLineChartResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForLineChartResponse.cs @@ -18,6 +18,6 @@ public class HistoricalPriceForLineChartItem public string Date { get; set; } [JsonPropertyName("close")] - public double Close { get; set; } + public decimal Close { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs index 21ee31f..5ce750b 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System; +using System.Collections.Generic; using System.Text.Json.Serialization; namespace MatthiWare.FinancialModelingPrep.Model.StockTimeSeries @@ -12,45 +14,45 @@ public class HistoricalPriceResponse public List Historical { get; set; } } - public class HistoricalPriceItem + public class HistoricalPriceItem : IHistoricalQuote { [JsonPropertyName("date")] public string Date { get; set; } [JsonPropertyName("open")] - public double Open { get; set; } + public decimal Open { get; set; } [JsonPropertyName("high")] - public double High { get; set; } + public decimal High { get; set; } [JsonPropertyName("low")] - public double Low { get; set; } + public decimal Low { get; set; } [JsonPropertyName("close")] - public double Close { get; set; } + public decimal Close { get; set; } [JsonPropertyName("adjClose")] - public double AdjClose { get; set; } + public decimal AdjClose { get; set; } [JsonPropertyName("volume")] - public double Volume { get; set; } + public decimal Volume { get; set; } [JsonPropertyName("unadjustedVolume")] - public double UnadjustedVolume { get; set; } + public decimal UnadjustedVolume { get; set; } [JsonPropertyName("change")] - public double Change { get; set; } + public decimal? Change { get; set; } [JsonPropertyName("changePercent")] - public double ChangePercent { get; set; } + public decimal? ChangePercent { get; set; } [JsonPropertyName("vwap")] - public double Vwap { get; set; } + public decimal Vwap { get; set; } [JsonPropertyName("label")] public string Label { get; set; } [JsonPropertyName("changeOverTime")] - public double ChangeOverTime { get; set; } + public decimal ChangeOverTime { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalStockSplitItem.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalStockSplitItem.cs index 94eea24..21a56a6 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalStockSplitItem.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalStockSplitItem.cs @@ -11,9 +11,9 @@ public class HistoricalStockSplitItem public string Label { get; set; } [JsonPropertyName("numerator")] - public double Numerator { get; set; } + public decimal Numerator { get; set; } [JsonPropertyName("denominator")] - public double Denominator { get; set; } + public decimal Denominator { get; set; } } } diff --git a/Tests/AdvancedData/AdvancedDataTests.cs b/Tests/AdvancedData/AdvancedDataTests.cs index 1bba551..0970146 100644 --- a/Tests/AdvancedData/AdvancedDataTests.cs +++ b/Tests/AdvancedData/AdvancedDataTests.cs @@ -28,6 +28,15 @@ public async Task GetFinancialReportAnnualAsync() Assert.Contains("AAPL", result.Data); } + [Fact] + public async Task GetFinancialScoreAsync() + { + var result = await api.GetFinancialScore("AAPL"); + + result.AssertNoErrors(); + Assert.Equal("AAPL", result.Data[0].Symbol); + } + [Fact] public async Task GetFinancialReportQuarterAsync() { diff --git a/Tests/Calendars/CalendarsTests.cs b/Tests/Calendars/CalendarsTests.cs index 075a3b3..330cc03 100644 --- a/Tests/Calendars/CalendarsTests.cs +++ b/Tests/Calendars/CalendarsTests.cs @@ -102,8 +102,8 @@ public async Task GetDividendCalendarAsync() var firstResult = result.Data.First(_ => _.Symbol == "BRO"); Assert.Equal("BRO", firstResult.Symbol); - Assert.Equal(0.0925, firstResult.Dividend.Value, 4); - Assert.Equal(0.0925, firstResult.AdjDividend, 4); + Assert.Equal(0.0925m, firstResult.Dividend.Value, 4); + Assert.Equal(0.0925m, firstResult.AdjDividend, 4); Assert.Equal("2020-11-04", firstResult.RecordDate); Assert.Equal("2020-11-18", firstResult.PaymentDate); Assert.Equal("2020-10-20", firstResult.DeclarationDate); @@ -131,7 +131,7 @@ public async Task GetEconomicCalendarAsync() Assert.Equal(85, firstResult.Actual); Assert.Equal(83, firstResult.Previous); Assert.Equal(2, firstResult.Change); - Assert.Equal(0.0241, firstResult.ChangePercentage); + Assert.Equal(0.0241m, firstResult.ChangePercentage); Assert.Equal(83, firstResult.Estimate); } diff --git a/Tests/Crypto/CryptoMarketTests.cs b/Tests/Crypto/CryptoMarketTests.cs index 070cec8..0a0499e 100644 --- a/Tests/Crypto/CryptoMarketTests.cs +++ b/Tests/Crypto/CryptoMarketTests.cs @@ -1,4 +1,4 @@ -using MatthiWare.FinancialModelingPrep.Abstractions.StockMarket; +using MatthiWare.FinancialModelingPrep.Abstractions.Crypto; using Microsoft.Extensions.DependencyInjection; using System.Threading.Tasks; using Xunit; @@ -15,10 +15,20 @@ public CryptoMarketTests(ITestOutputHelper testOutput) : base(testOutput) api = ServiceProvider.GetRequiredService(); } + [Fact] + public async Task GetCryptocurrencyRealtime() + { + var result = await api.GetQuoteAsync("BTCUSD"); + + result.AssertNoErrors(); + Assert.NotNull(result.Data); + Assert.Equal("BTCUSD", result.Data[0].Symbol); + } + [Fact] public async Task GetAvailableCryptocurrencies() { - var result = await api.GetAvilableCryptocurrencies(); + var result = await api.GetAvilableCryptocurrenciesAsync(); result.AssertNoErrors(); Assert.NotEmpty(result.Data); @@ -27,7 +37,7 @@ public async Task GetAvailableCryptocurrencies() [Fact] public async Task GetDailyPrice() { - var result = await api.GetDailyPrices("BTCUSD"); + var result = await api.GetDailyPricesAsync("BTCUSD"); result.AssertNoErrors(); Assert.NotEmpty(result.Data.HistoricalPrices); @@ -36,7 +46,7 @@ public async Task GetDailyPrice() [Fact] public async Task GetPeriodPriceData() { - var result = await api.GetHistoricalPrices("BTCUSD", MatthiWare.FinancialModelingPrep.Model.HistoricalPricingPeriod.OneHour); + var result = await api.GetHistoricalQuoteAsync("BTCUSD", MatthiWare.FinancialModelingPrep.Model.HistoricalPricingPeriod.OneHour); result.AssertNoErrors(); Assert.NotEmpty(result.Data); diff --git a/Tests/Forex/ForexMarketTests.cs b/Tests/Forex/ForexMarketTests.cs new file mode 100644 index 0000000..5e7abc8 --- /dev/null +++ b/Tests/Forex/ForexMarketTests.cs @@ -0,0 +1,39 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Forex; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace Tests.Forex +{ + public class ForexMarketTests : TestingBase + { + private readonly IForexMarketProvider api; + + public ForexMarketTests(ITestOutputHelper testOutput) : base(testOutput) + { + api = ServiceProvider.GetRequiredService(); + } + + [Fact] + public async Task GetCurrencyPairRealtime() + { + var result = await api.GetQuoteAsync("USDJPY"); + + result.AssertNoErrors(); + Assert.NotNull(result.Data); + Assert.Equal("USDJPY", result.Data[0].Symbol); + } + + [Fact] + public async Task GetCurrencyPairHistorical() + { + var result = await api.GetHistoricalQuoteAsync("USDJPY", MatthiWare.FinancialModelingPrep.Model.HistoricalPricingPeriod.OneMinute); + + result.AssertNoErrors(); + Assert.NotNull(result.Data); + Assert.NotNull(result.Data[0].Date); + } + } +} diff --git a/Tests/Futures/FuturesMarketTests.cs b/Tests/Futures/FuturesMarketTests.cs new file mode 100644 index 0000000..81bb735 --- /dev/null +++ b/Tests/Futures/FuturesMarketTests.cs @@ -0,0 +1,40 @@ +using MatthiWare.FinancialModelingPrep.Abstractions.Futures; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace Tests.Futures +{ + public class FuturesMarketTests : TestingBase + { + private readonly IFuturesMarketProvider api; + + public FuturesMarketTests(ITestOutputHelper testOutput) : base(testOutput) + { + api = ServiceProvider.GetRequiredService(); + } + + [Fact] + public async Task GetCommodityRealtime() + { + var result = await api.GetQuoteAsync("LC=F"); + + result.AssertNoErrors(); + Assert.NotNull(result.Data); + // Commodity tickers are painful. + Assert.Equal("LCUSX", result.Data[0].Symbol); + } + + [Fact] + public async Task GetCurrencyPairHistorical() + { + var result = await api.GetHistoricalQuoteAsync("LC=F", MatthiWare.FinancialModelingPrep.Model.HistoricalPricingPeriod.OneMinute); + + result.AssertNoErrors(); + Assert.NotNull(result.Data); + Assert.NotNull(result.Data[0].Date); + } + } +} diff --git a/Tests/StockTimeSeries/StockTimeSeriesTests.cs b/Tests/StockTimeSeries/StockTimeSeriesTests.cs index 36a582e..4f40fd4 100644 --- a/Tests/StockTimeSeries/StockTimeSeriesTests.cs +++ b/Tests/StockTimeSeries/StockTimeSeriesTests.cs @@ -18,6 +18,15 @@ public StockTimeSeriesTests(ITestOutputHelper testOutput) : base(testOutput) api = ServiceProvider.GetRequiredService(); } + [Fact] + public async Task GetStockQuote() + { + var result = await api.GetQuoteAsync("AAPL"); + + result.AssertNoErrors(); + Assert.Equal("AAPL", result.Data[0].Symbol); + } + [Fact] public async Task GetHistoricalDividendsAsync() { @@ -27,7 +36,7 @@ public async Task GetHistoricalDividendsAsync() var dividend = result.Data.Historical.First(data => data.Date == "2021-05-07"); - Assert.Equal(0.22, dividend.Dividend); + Assert.Equal(0.22m, dividend.Dividend); Assert.Equal("2021-05-10", dividend.RecordDate); Assert.Equal("2021-05-13", dividend.PaymentDate); Assert.Equal("2021-04-28", dividend.DeclarationDate); @@ -42,8 +51,8 @@ public async Task GetHistoricalStockSplitsAsync() var split = result.Data.Historical.First(data => data.Date == "2020-08-31"); - Assert.Equal(4.0, split.Numerator); - Assert.Equal(1.0, split.Denominator); + Assert.Equal(4.0m, split.Numerator); + Assert.Equal(1.0m, split.Denominator); } [Fact] @@ -55,10 +64,10 @@ public async Task GetHistoricalDailyPricesAsync() var split = result.Data.Historical.First(data => data.Date == "2021-06-04"); - Assert.Equal(125.89, split.Close, 2); - Assert.Equal(124.07, split.Open, 2); - Assert.Equal(126.16, split.High, 2); - Assert.Equal(123.85, split.Low, 2); + Assert.Equal(125.89m, split.Close, 2); + Assert.Equal(124.07m, split.Open, 2); + Assert.Equal(126.16m, split.High, 2); + Assert.Equal(123.85m, split.Low, 2); } [Fact] @@ -72,10 +81,10 @@ public async Task GetHistoricalDailyPricesUsingFromToAsync() var split = result.Data.Historical.First(data => data.Date == "2021-06-04"); - Assert.Equal(125.89, split.Close, 2); - Assert.Equal(124.07, split.Open, 2); - Assert.Equal(126.16, split.High, 2); - Assert.Equal(123.85, split.Low, 2); + Assert.Equal(125.89m, split.Close, 2); + Assert.Equal(124.07m, split.Open, 2); + Assert.Equal(126.16m, split.High, 2); + Assert.Equal(123.85m, split.Low, 2); } [Fact] @@ -87,7 +96,7 @@ public async Task GetHistoricalDailyPricesForLineChartAsync() var split = result.Data.Historical.First(data => data.Date == "2021-06-04"); - Assert.Equal(125.89, split.Close, 2); + Assert.Equal(125.89m, split.Close, 2); } [Theory] @@ -123,7 +132,7 @@ public async Task GetHistoricalDailyPricesForLineChartUsingFromToAsync() var split = result.Data.Historical.First(data => data.Date == "2021-06-04"); - Assert.Equal(125.89, split.Close, 2); + Assert.Equal(125.89m, split.Close, 2); } public static IEnumerable AvailableHistoricalChartSeries From dad880e26bc0b18a98f2a4e56d66541867090c5e Mon Sep 17 00:00:00 2001 From: mike Date: Sun, 11 Sep 2022 03:12:06 -0400 Subject: [PATCH 02/12] update --- .../Crypto/ICryptoMarketProvider.cs | 6 ++-- .../Abstractions/Model/ICurrentQuote.cs | 8 ++--- .../Abstractions/Model/IHistoricalQuote.cs | 4 +-- .../StockTimeSeries/HistoricalChartSeries.cs | 12 ------- .../IStockTimeSeriesProvider.cs | 2 +- .../Core/Crypto/CryptoMarketProvider.cs | 21 ++++++++++- .../StockTimeSeriesProvider.cs | 20 +++-------- .../Crypto/CryptoHistoricalPricePeriodItem.cs | 2 +- .../Model/Crypto/CryptoQuoteResponse.cs | 8 ++--- .../Crypto/CyptoHistoricalPriceListings.cs | 4 +-- .../Forex/ForexHistoricalQuoteResponse.cs | 4 +-- .../Model/Forex/ForexQuoteResponse.cs | 8 ++--- .../Futures/FuturesHistoricalQuoteResponse.cs | 4 +-- .../Model/Futures/FuturesQuoteResponse.cs | 8 ++--- FinancialModelingPrepApi/Model/Period.cs | 5 ++- .../Model/StockMarket/StockQuoteResponse.cs | 8 ++--- ...storicalPriceForChartWithVolumeResponse.cs | 36 +++++++++++++++---- .../HistoricalPriceResponse.cs | 4 +-- 18 files changed, 93 insertions(+), 71 deletions(-) delete mode 100644 FinancialModelingPrepApi/Abstractions/StockTimeSeries/HistoricalChartSeries.cs diff --git a/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs b/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs index fc0e7d5..e4767bc 100644 --- a/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs @@ -9,9 +9,11 @@ public interface ICryptoMarketProvider { Task>> GetAvilableCryptocurrenciesAsync(); - Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period); + Task> GetHistoricalQuoteAsync(string symbol); - Task> GetDailyPricesAsync(string symbol); + Task> GetHistoricalQuoteAsync(string symbol, string from, string to); + + Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period); Task>> GetQuoteAsync(string symbol); } diff --git a/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs index 3d387e3..48414b6 100644 --- a/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs +++ b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs @@ -30,16 +30,16 @@ public interface ICurrentQuote public decimal DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal YearlyLow { get; set; } + public decimal? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal YearlyHigh { get; set; } + public decimal? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal PriceAvg50 { get; set; } + public decimal? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal PriceAvg200 { get; set; } + public decimal? PriceAvg200 { get; set; } [JsonPropertyName("change")] public decimal Change { get; set; } diff --git a/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs index 4739180..07302d5 100644 --- a/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs +++ b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs @@ -16,10 +16,10 @@ public interface IHistoricalQuote public decimal Open { get; set; } [JsonPropertyName("high")] - public decimal High { get; set; } + public decimal? High { get; set; } [JsonPropertyName("low")] - public decimal Low { get; set; } + public decimal? Low { get; set; } [JsonPropertyName("close")] public decimal Close { get; set; } diff --git a/FinancialModelingPrepApi/Abstractions/StockTimeSeries/HistoricalChartSeries.cs b/FinancialModelingPrepApi/Abstractions/StockTimeSeries/HistoricalChartSeries.cs deleted file mode 100644 index a3b38f9..0000000 --- a/FinancialModelingPrepApi/Abstractions/StockTimeSeries/HistoricalChartSeries.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace MatthiWare.FinancialModelingPrep.Abstractions.StockTimeSeries -{ - public enum HistoricalChartSeries - { - OneMinute, - FiveMinutes, - FifteenMinutes, - ThirtyMinutes, - Hourly, - FourHours - } -} diff --git a/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs b/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs index 256f422..5c27a12 100644 --- a/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/StockTimeSeries/IStockTimeSeriesProvider.cs @@ -68,6 +68,6 @@ public interface IStockTimeSeriesProvider /// Ticker symbol /// Time series /// - Task>> GetHistoricalPricesForChartWithVolume(string symbol, HistoricalChartSeries series); + Task>> GetHistoricalPricesForChartWithVolume(string symbol, HistoricalPricingPeriod series); } } diff --git a/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs b/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs index 06adf04..1d54e6d 100644 --- a/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs +++ b/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs @@ -44,7 +44,7 @@ public async Task>> GetQuoteAsync(string s return await client.GetJsonAsync>(url, pathParams, null); } - public async Task> GetDailyPricesAsync(string symbol) + public async Task> GetHistoricalQuoteAsync(string symbol) { const string url = "[version]/historical-price-full/[symbol]"; @@ -57,6 +57,25 @@ public async Task> GetDailyPricesAsy return await client.GetJsonAsync(url, pathParams, null); } + + public async Task> GetHistoricalQuoteAsync(string symbol, string from, string to) + { + const string url = "[version]/historical-price-full/[symbol]"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol } + }; + + QueryStringBuilder queryString = new QueryStringBuilder(); + + queryString.Add("from", from); + queryString.Add("to", to); + + return await client.GetJsonAsync(url, pathParams, queryString); + } + public async Task>> GetHistoricalQuoteAsync(string symbol, HistoricalPricingPeriod period) { const string url = "[version]/historical-chart/[pricePeriod]/[symbol]"; diff --git a/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs b/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs index d29a212..bbf3189 100644 --- a/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs +++ b/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs @@ -117,14 +117,16 @@ public Task> GetHistoricalDividendsAsyn } /// - public Task>> GetHistoricalPricesForChartWithVolume(string symbol, HistoricalChartSeries series) + public Task>> GetHistoricalPricesForChartWithVolume(string symbol, HistoricalPricingPeriod series) { const string url = "[version]/historical-chart/[series]/[symbol]"; + string seriesPeriod = EnumMappings.HistoricalPrices[series]; + var pathParams = new NameValueCollection() { { "version", ApiVersion.v3.ToString() }, - { "series", HistoricalChartSeriesToString(series) }, + { "series", seriesPeriod }, { "symbol", symbol } }; @@ -144,19 +146,5 @@ public Task> GetHistoricalStockSplitsA return client.GetJsonAsync(url, pathParams, null); } - - private static string HistoricalChartSeriesToString(HistoricalChartSeries series) - { - return series switch - { - HistoricalChartSeries.OneMinute => "1min", - HistoricalChartSeries.FiveMinutes => "5min", - HistoricalChartSeries.FifteenMinutes => "15min", - HistoricalChartSeries.ThirtyMinutes => "30min", - HistoricalChartSeries.Hourly => "1hour", - HistoricalChartSeries.FourHours => "4hour", - _ => throw new NotImplementedException(), - }; - } } } diff --git a/FinancialModelingPrepApi/Model/Crypto/CryptoHistoricalPricePeriodItem.cs b/FinancialModelingPrepApi/Model/Crypto/CryptoHistoricalPricePeriodItem.cs index 2783856..fc83e0c 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CryptoHistoricalPricePeriodItem.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CryptoHistoricalPricePeriodItem.cs @@ -13,6 +13,6 @@ public class CryptoHistoricalPriceDailyItem public string Symbol { get; set; } [JsonPropertyName("historical")] - public List HistoricalPrices { get; set; } + public List Historical { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs index a5a7a15..672fc54 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs @@ -32,16 +32,16 @@ public class CryptoQuoteResponse : ICurrentQuote public decimal DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal YearlyLow { get; set; } + public decimal? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal YearlyHigh { get; set; } + public decimal? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal PriceAvg50 { get; set; } + public decimal? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal PriceAvg200 { get; set; } + public decimal? PriceAvg200 { get; set; } [JsonPropertyName("change")] public decimal Change { get; set; } diff --git a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs index 5fb22d6..013bdbd 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs @@ -38,10 +38,10 @@ public class CyptoHistoricalPriceDailyListing : IHistoricalQuote public decimal Open { get; set; } [JsonPropertyName("high")] - public decimal High { get; set; } + public decimal? High { get; set; } [JsonPropertyName("low")] - public decimal Low { get; set; } + public decimal? Low { get; set; } [JsonPropertyName("close")] public decimal Close { get; set; } diff --git a/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs index b399f98..c0ca29a 100644 --- a/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs @@ -13,10 +13,10 @@ public class ForexHistoricalQuoteResponse : IHistoricalQuote public decimal Open { get; set; } [JsonPropertyName("high")] - public decimal High { get; set; } + public decimal? High { get; set; } [JsonPropertyName("low")] - public decimal Low { get; set; } + public decimal? Low { get; set; } [JsonPropertyName("close")] public decimal Close { get; set; } diff --git a/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs index 9446369..931f356 100644 --- a/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs @@ -32,16 +32,16 @@ public class ForexQuoteResponse : ICurrentQuote public decimal DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal YearlyLow { get; set; } + public decimal? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal YearlyHigh { get; set; } + public decimal? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal PriceAvg50 { get; set; } + public decimal? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal PriceAvg200 { get; set; } + public decimal? PriceAvg200 { get; set; } [JsonPropertyName("change")] public decimal Change { get; set; } diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs index 70b1164..42d05c4 100644 --- a/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs @@ -13,10 +13,10 @@ public class FuturesHistoricalQuoteResponse : IHistoricalQuote public decimal Open { get; set; } [JsonPropertyName("high")] - public decimal High { get; set; } + public decimal? High { get; set; } [JsonPropertyName("low")] - public decimal Low { get; set; } + public decimal? Low { get; set; } [JsonPropertyName("close")] public decimal Close { get; set; } diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs index 8334c9f..43b408a 100644 --- a/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs @@ -32,16 +32,16 @@ public class FuturesQuoteResponse : ICurrentQuote public decimal DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal YearlyLow { get; set; } + public decimal? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal YearlyHigh { get; set; } + public decimal? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal PriceAvg50 { get; set; } + public decimal? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal PriceAvg200 { get; set; } + public decimal? PriceAvg200 { get; set; } [JsonPropertyName("change")] public decimal Change { get; set; } diff --git a/FinancialModelingPrepApi/Model/Period.cs b/FinancialModelingPrepApi/Model/Period.cs index 8c2a1e2..d64bb13 100644 --- a/FinancialModelingPrepApi/Model/Period.cs +++ b/FinancialModelingPrepApi/Model/Period.cs @@ -13,6 +13,9 @@ public enum HistoricalPricingPeriod FifteenMinute, ThirtyMinute, OneHour, - FourHour + FourHour, + Day, + Week, + Month } } diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs index 43c58fa..3c2a149 100644 --- a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs @@ -32,16 +32,16 @@ public class StockQuoteResponse : ICurrentQuote public decimal DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal YearlyLow { get; set; } + public decimal? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal YearlyHigh { get; set; } + public decimal? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal PriceAvg50 { get; set; } + public decimal? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal PriceAvg200 { get; set; } + public decimal? PriceAvg200 { get; set; } [JsonPropertyName("change")] public decimal Change { get; set; } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs index f20c898..57b0935 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs @@ -1,8 +1,9 @@ -using System.Text.Json.Serialization; +using MatthiWare.FinancialModelingPrep.Abstractions.Model; +using System.Text.Json.Serialization; namespace MatthiWare.FinancialModelingPrep.Model.StockTimeSeries { - public class HistoricalPriceForChartWithVolumeResponse + public class HistoricalPriceForChartWithVolumeResponse : IHistoricalQuote { [JsonPropertyName("date")] public string Date { get; set; } @@ -10,16 +11,37 @@ public class HistoricalPriceForChartWithVolumeResponse [JsonPropertyName("open")] public decimal Open { get; set; } - [JsonPropertyName("low")] - public decimal Low { get; set; } - [JsonPropertyName("high")] - public decimal High { get; set; } + public decimal? High { get; set; } + + [JsonPropertyName("low")] + public decimal? Low { get; set; } [JsonPropertyName("close")] public decimal Close { get; set; } + [JsonPropertyName("change")] + public decimal? Change { get; set; } + + [JsonPropertyName("changePercent")] + public decimal? ChangePercent { get; set; } + [JsonPropertyName("volume")] - public int Volume { get; set; } + public decimal Volume { get; set; } + + [JsonPropertyName("adjClose")] + public decimal AdjClose { get; set; } + + [JsonPropertyName("unadjustedVolume")] + public decimal UnadjustedVolume { get; set; } + + [JsonPropertyName("vwap")] + public decimal VWAP { get; set; } + + [JsonPropertyName("label")] + public string Label { get; set; } + + [JsonPropertyName("changeOvertime")] + public decimal ChangeOvertime { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs index 5ce750b..1527230 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs @@ -23,10 +23,10 @@ public class HistoricalPriceItem : IHistoricalQuote public decimal Open { get; set; } [JsonPropertyName("high")] - public decimal High { get; set; } + public decimal? High { get; set; } [JsonPropertyName("low")] - public decimal Low { get; set; } + public decimal? Low { get; set; } [JsonPropertyName("close")] public decimal Close { get; set; } From eb419ffb720d510ff63c6fb070cd60424c17660f Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 17 Apr 2023 23:14:11 -0400 Subject: [PATCH 03/12] Don't remember. --- .../Abstractions/Model/ICurrentQuote.cs | 4 ++ .../Abstractions/Model/IHistoricalQuote.cs | 4 +- .../StockMarket/IStockMarketProvider.cs | 3 ++ .../Http/FinancialModelingPrepHttpClient.cs | 2 +- .../Core/StockMarket/StockMarketProvider.cs | 38 +++++++++++++++++++ .../StockTimeSeriesProvider.cs | 5 ++- .../Model/Crypto/CryptoQuoteResponse.cs | 4 ++ .../Crypto/CyptoHistoricalPriceListings.cs | 2 +- .../Forex/ForexHistoricalQuoteResponse.cs | 4 +- .../Model/Forex/ForexQuoteResponse.cs | 4 ++ .../Futures/FuturesHistoricalQuoteResponse.cs | 4 +- .../Model/Futures/FuturesQuoteResponse.cs | 4 ++ .../StockHistoricalDividendResponse.cs | 36 ++++++++++++++++++ .../Model/StockMarket/StockQuoteResponse.cs | 20 ++++++---- .../StockSP500ConstituentResponse.cs | 30 +++++++++++++++ ...storicalPriceForChartWithVolumeResponse.cs | 2 +- .../HistoricalPriceResponse.cs | 2 +- 17 files changed, 151 insertions(+), 17 deletions(-) create mode 100644 FinancialModelingPrepApi/Model/StockMarket/StockHistoricalDividendResponse.cs create mode 100644 FinancialModelingPrepApi/Model/StockMarket/StockSP500ConstituentResponse.cs diff --git a/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs index 48414b6..67498aa 100644 --- a/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs +++ b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs @@ -49,6 +49,10 @@ public interface ICurrentQuote [JsonPropertyName("timestamp")] public long Timestamp { get; set; } + [JsonPropertyName("volume")] + public ulong Volume { get; set; } + [JsonPropertyName("avgVolume")] + public ulong AvgVolume { get; set; } // Not used by Forex or Futures. diff --git a/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs index 07302d5..d078826 100644 --- a/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs +++ b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs @@ -13,7 +13,7 @@ public interface IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public decimal? Open { get; set; } [JsonPropertyName("high")] public decimal? High { get; set; } @@ -26,6 +26,8 @@ public interface IHistoricalQuote [JsonPropertyName("change")] public decimal? Change { get; set; } + [JsonPropertyName("volume")] + public decimal Volume { get; set; } [JsonPropertyName("changePercent")] public decimal? ChangePercent { get; set; } diff --git a/FinancialModelingPrepApi/Abstractions/StockMarket/IStockMarketProvider.cs b/FinancialModelingPrepApi/Abstractions/StockMarket/IStockMarketProvider.cs index 9a8a620..9f52a3a 100644 --- a/FinancialModelingPrepApi/Abstractions/StockMarket/IStockMarketProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/StockMarket/IStockMarketProvider.cs @@ -7,9 +7,12 @@ namespace MatthiWare.FinancialModelingPrep.Abstractions.StockMarket { public interface IStockMarketProvider { + public Task>> GetNasdaqConstituents(); + public Task>> GetSP500Constituents(); public Task>> GetMostActiveStocksAsync(); public Task>> GetBiggestGainerStocksAsync(); public Task>> GetBiggestLoserStocksAsync(); + public Task> GetStockHistoricalDividends(string symbol); public Task>> StockScreener(int? marketCapMoreThan = null, int? marketCapLowerThan = null, decimal? priceMoreThan = null, decimal? priceLowerThan = null, decimal? betaMoreThan = null, decimal? betaLowerThan = null, int? volumeMoreThan = null, int? volumeLowerThan = null, bool? isEtf = null, bool? isActivelyTraded = null, Sector? sector = null, Industry? industry = null, Country? country = null, Exchange? exchange = null, int? limit = 30); diff --git a/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs b/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs index 686529b..2d1c18f 100644 --- a/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs +++ b/FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs @@ -104,7 +104,7 @@ private async Task> CallApiAsync(string urlPattern, NameValu var requestUrl = $"{urlPattern}{queryString}"; - using var response = await client.GetAsync(requestUrl); + using var response = await client.GetAsync(requestUrl).ConfigureAwait(false); var content = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode) diff --git a/FinancialModelingPrepApi/Core/StockMarket/StockMarketProvider.cs b/FinancialModelingPrepApi/Core/StockMarket/StockMarketProvider.cs index b8435dd..376a16c 100644 --- a/FinancialModelingPrepApi/Core/StockMarket/StockMarketProvider.cs +++ b/FinancialModelingPrepApi/Core/StockMarket/StockMarketProvider.cs @@ -4,6 +4,7 @@ using MatthiWare.FinancialModelingPrep.Model.StockMarket; using System.Collections.Generic; using System.Collections.Specialized; +using System.Net; using System.Threading.Tasks; namespace MatthiWare.FinancialModelingPrep.Core.StockMarket @@ -101,6 +102,43 @@ public Task>> StockScreener(int? marketCapMo return client.GetJsonAsync>(url, pathParams, queryString); } + public Task>> GetSP500Constituents() + { + const string url = "[version]/sp500_constituent"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() } + }; + + return client.GetJsonAsync>(url, pathParams, null); + } + + public Task>> GetNasdaqConstituents() + { + const string url = "[version]/nasdaq_constituent"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() } + }; + + return client.GetJsonAsync>(url, pathParams, null); + } + + public Task> GetStockHistoricalDividends(string symbol) + { + const string url = "[version]/[symbol]"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() }, + { "symbol", symbol }, + }; + + return client.GetJsonAsync(url, pathParams, null); + } + public Task>> GetBiggestGainerStocksAsync() => GetStockMarketData(GainersEndpoint); diff --git a/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs b/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs index bbf3189..ff199b4 100644 --- a/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs +++ b/FinancialModelingPrepApi/Core/StockTimeSeries/StockTimeSeriesProvider.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; +using System.Linq; using System.Threading.Tasks; namespace MatthiWare.FinancialModelingPrep.Core.StockTimeSeries @@ -47,7 +48,7 @@ public Task> GetHistoricalDailyPricesAsync( } /// - public Task> GetHistoricalDailyPricesAsync(string symbol, string from, string to) + public async Task> GetHistoricalDailyPricesAsync(string symbol, string from, string to) { const string url = "[version]/historical-price-full/[symbol]"; @@ -61,7 +62,7 @@ public Task> GetHistoricalDailyPricesAsync( queryString.Add("from", from); queryString.Add("to", to); - return client.GetJsonAsync(url, pathParams, queryString); + return await client.GetJsonAsync(url, pathParams, queryString); } /// diff --git a/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs index 672fc54..343abc4 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs @@ -51,6 +51,10 @@ public class CryptoQuoteResponse : ICurrentQuote [JsonPropertyName("timestamp")] public long Timestamp { get; set; } + [JsonPropertyName("volume")] + public ulong Volume { get; set; } + [JsonPropertyName("avgVolume")] + public ulong AvgVolume { get; set; } // Not used by Forex or Futures. diff --git a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs index 013bdbd..b7b7fcb 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs @@ -35,7 +35,7 @@ public class CyptoHistoricalPriceDailyListing : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public decimal? Open { get; set; } [JsonPropertyName("high")] public decimal? High { get; set; } diff --git a/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs index c0ca29a..3da30f0 100644 --- a/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs @@ -10,7 +10,7 @@ public class ForexHistoricalQuoteResponse : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public decimal? Open { get; set; } [JsonPropertyName("high")] public decimal? High { get; set; } @@ -23,6 +23,8 @@ public class ForexHistoricalQuoteResponse : IHistoricalQuote [JsonPropertyName("change")] public decimal? Change { get; set; } + [JsonPropertyName("volume")] + public decimal Volume { get; set; } [JsonPropertyName("changePercent")] public decimal? ChangePercent { get; set; } diff --git a/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs index 931f356..d876465 100644 --- a/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs @@ -51,6 +51,10 @@ public class ForexQuoteResponse : ICurrentQuote [JsonPropertyName("timestamp")] public long Timestamp { get; set; } + [JsonPropertyName("volume")] + public ulong Volume { get; set; } + [JsonPropertyName("avgVolume")] + public ulong AvgVolume { get; set; } // Not used by Forex or Futures. diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs index 42d05c4..c427e11 100644 --- a/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs @@ -10,7 +10,7 @@ public class FuturesHistoricalQuoteResponse : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public decimal? Open { get; set; } [JsonPropertyName("high")] public decimal? High { get; set; } @@ -26,5 +26,7 @@ public class FuturesHistoricalQuoteResponse : IHistoricalQuote [JsonPropertyName("changePercent")] public decimal? ChangePercent { get; set; } + [JsonPropertyName("volume")] + public decimal Volume { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs index 43b408a..79d3b5e 100644 --- a/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs @@ -52,6 +52,10 @@ public class FuturesQuoteResponse : ICurrentQuote [JsonPropertyName("timestamp")] public long Timestamp { get; set; } + [JsonPropertyName("volume")] + public ulong Volume { get; set; } + [JsonPropertyName("avgVolume")] + public ulong AvgVolume { get; set; } // Not used by Forex or Futures. [JsonPropertyName("eps")] diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockHistoricalDividendResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockHistoricalDividendResponse.cs new file mode 100644 index 0000000..d4888f5 --- /dev/null +++ b/FinancialModelingPrepApi/Model/StockMarket/StockHistoricalDividendResponse.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Model.StockMarket +{ + public class StockDividendResponse + { + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("historical")] + public List HistoricalDividends { get; set; } + } + + public class StockHistoricalDividendResponse + { + [JsonPropertyName("date")] + public string Date { get; set; } + [JsonPropertyName("label")] + public string Label { get; set; } + [JsonPropertyName("adjDividend")] + public string AdjDividend { get; set; } + [JsonPropertyName("dividend")] + public string Dividend { get; set; } + [JsonPropertyName("recordDate")] + public string RecordDate { get; set; } + [JsonPropertyName("paymentDate")] + public string PaymentDate { get; set; } + [JsonPropertyName("declarationDate")] + public string DeclarationDate { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs index 3c2a149..2c6e03d 100644 --- a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs @@ -22,35 +22,39 @@ public class StockQuoteResponse : ICurrentQuote [JsonPropertyName("price")] public decimal Price { get; set; } - [JsonPropertyName("previousclose")] + [JsonPropertyName("previousClose")] public decimal PreviousClose { get; set; } - [JsonPropertyName("daylow")] + [JsonPropertyName("dayLow")] public decimal DayLow { get; set; } - [JsonPropertyName("dayhigh")] + [JsonPropertyName("dayHigh")] public decimal DayHigh { get; set; } - [JsonPropertyName("yearlow")] + [JsonPropertyName("yearLow")] public decimal? YearlyLow { get; set; } - [JsonPropertyName("yearhigh")] + [JsonPropertyName("yearHigh")] public decimal? YearlyHigh { get; set; } - [JsonPropertyName("priceavg50")] + [JsonPropertyName("priceAvg50")] public decimal? PriceAvg50 { get; set; } - [JsonPropertyName("priceavg200")] + [JsonPropertyName("priceAvg200")] public decimal? PriceAvg200 { get; set; } [JsonPropertyName("change")] public decimal Change { get; set; } - [JsonPropertyName("changespercentage")] + [JsonPropertyName("changesPercentage")] public decimal ChangesPercentage { get; set; } [JsonPropertyName("timestamp")] public long Timestamp { get; set; } + [JsonPropertyName("volume")] + public ulong Volume { get; set; } + [JsonPropertyName("avgVolume")] + public ulong AvgVolume { get; set; } // Not used by Forex or Futures. diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockSP500ConstituentResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockSP500ConstituentResponse.cs new file mode 100644 index 0000000..f16a17e --- /dev/null +++ b/FinancialModelingPrepApi/Model/StockMarket/StockSP500ConstituentResponse.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Model.StockMarket +{ + public class IndexConstituentResponse + { + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + [JsonPropertyName("sector")] + public string Sector { get; set; } + [JsonPropertyName("subSector")] + public string Subsector { get; set; } + [JsonPropertyName("headQuarter")] + public string Headquarter { get; set; } + [JsonPropertyName("dateFirstAdded")] + public string DateFirstAdded { get; set; } + [JsonPropertyName("cik")] + public string Cik { get; set; } + [JsonPropertyName("founded")] + public string Founded { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs index 57b0935..61245c2 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs @@ -9,7 +9,7 @@ public class HistoricalPriceForChartWithVolumeResponse : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public decimal? Open { get; set; } [JsonPropertyName("high")] public decimal? High { get; set; } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs index 1527230..61c9317 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs @@ -20,7 +20,7 @@ public class HistoricalPriceItem : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public decimal? Open { get; set; } [JsonPropertyName("high")] public decimal? High { get; set; } From 665662b91daf8fb56e8972ce8296e43871f5d63c Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 29 Aug 2023 20:27:34 -0400 Subject: [PATCH 04/12] changes --- .../Crypto/ICryptoMarketProvider.cs | 1 + .../Abstractions/Model/ICurrentQuote.cs | 36 +++++++++---------- .../Abstractions/Model/IHistoricalQuote.cs | 14 ++++---- .../Core/Crypto/CryptoMarketProvider.cs | 13 ++++++- .../Calendars/EarningsCalendarResponse.cs | 8 ++--- .../Model/Crypto/CryptoQuoteResponse.cs | 36 +++++++++---------- .../Crypto/CyptoHistoricalPriceListings.cs | 22 ++++++------ .../Forex/ForexHistoricalQuoteResponse.cs | 14 ++++---- .../Model/Forex/ForexQuoteResponse.cs | 36 +++++++++---------- .../Futures/FuturesHistoricalQuoteResponse.cs | 14 ++++---- .../Model/Futures/FuturesQuoteResponse.cs | 36 +++++++++---------- .../Model/StockMarket/StockQuoteResponse.cs | 36 +++++++++---------- ...storicalPriceForChartWithVolumeResponse.cs | 22 ++++++------ .../HistoricalPriceResponse.cs | 22 ++++++------ 14 files changed, 161 insertions(+), 149 deletions(-) diff --git a/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs b/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs index e4767bc..a7bffb1 100644 --- a/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/Crypto/ICryptoMarketProvider.cs @@ -8,6 +8,7 @@ namespace MatthiWare.FinancialModelingPrep.Abstractions.Crypto public interface ICryptoMarketProvider { Task>> GetAvilableCryptocurrenciesAsync(); + Task>> GetDailyQuotes(); Task> GetHistoricalQuoteAsync(string symbol); diff --git a/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs index 67498aa..75d1ca5 100644 --- a/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs +++ b/FinancialModelingPrepApi/Abstractions/Model/ICurrentQuote.cs @@ -15,60 +15,60 @@ public interface ICurrentQuote public string Exchange { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("price")] - public decimal Price { get; set; } + public double? Price { get; set; } [JsonPropertyName("previousclose")] - public decimal PreviousClose { get; set; } + public double? PreviousClose { get; set; } [JsonPropertyName("daylow")] - public decimal DayLow { get; set; } + public double? DayLow { get; set; } [JsonPropertyName("dayhigh")] - public decimal DayHigh { get; set; } + public double? DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal? YearlyLow { get; set; } + public double? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal? YearlyHigh { get; set; } + public double? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal? PriceAvg50 { get; set; } + public double? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal? PriceAvg200 { get; set; } + public double? PriceAvg200 { get; set; } [JsonPropertyName("change")] - public decimal Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changespercentage")] - public decimal ChangesPercentage { get; set; } + public double? ChangesPercentage { get; set; } [JsonPropertyName("timestamp")] - public long Timestamp { get; set; } + public long? Timestamp { get; set; } [JsonPropertyName("volume")] - public ulong Volume { get; set; } + public double? Volume { get; set; } [JsonPropertyName("avgVolume")] - public ulong AvgVolume { get; set; } + public double? AvgVolume { get; set; } // Not used by Forex or Futures. [JsonPropertyName("eps")] - public decimal? Eps { get; set; } + public double? Eps { get; set; } [JsonPropertyName("pe")] - public decimal? Pe { get; set; } + public double? Pe { get; set; } [JsonPropertyName("earningsAnnouncement")] public string? EarningsAnnouncement { get; set; } [JsonPropertyName("sharesOutstanding")] - public long? SharesOutstanding { get; set; } + public double? SharesOutstanding { get; set; } [JsonPropertyName("marketCap")] - public decimal? MarketCap { get; set; } + public double? MarketCap { get; set; } } } diff --git a/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs index d078826..b1a15ab 100644 --- a/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs +++ b/FinancialModelingPrepApi/Abstractions/Model/IHistoricalQuote.cs @@ -13,23 +13,23 @@ public interface IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal? Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("high")] - public decimal? High { get; set; } + public double? High { get; set; } [JsonPropertyName("low")] - public decimal? Low { get; set; } + public double? Low { get; set; } [JsonPropertyName("close")] - public decimal Close { get; set; } + public double Close { get; set; } [JsonPropertyName("change")] - public decimal? Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("volume")] - public decimal Volume { get; set; } + public double Volume { get; set; } [JsonPropertyName("changePercent")] - public decimal? ChangePercent { get; set; } + public double? ChangePercent { get; set; } } } diff --git a/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs b/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs index 1d54e6d..829a7b4 100644 --- a/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs +++ b/FinancialModelingPrepApi/Core/Crypto/CryptoMarketProvider.cs @@ -20,7 +20,6 @@ public CryptoMarketProvider(FinancialModelingPrepHttpClient client) public async Task>> GetAvilableCryptocurrenciesAsync() { - const string url = "[version]/symbol/available-cryptocurrencies"; var pathParams = new NameValueCollection() @@ -31,6 +30,18 @@ public async Task>> GetAvilableCryptocurrenciesAsyn return await client.GetJsonAsync>(url, pathParams, null); } + public async Task>> GetDailyQuotes() + { + const string url = "[version]/quotes/crypto"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v3.ToString() } + }; + + return await client.GetJsonAsync>(url, pathParams, null); + } + public async Task>> GetQuoteAsync(string symbol) { const string url = "[version]/quote/[symbol]"; diff --git a/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs b/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs index b71f3d6..01b33a8 100644 --- a/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs +++ b/FinancialModelingPrepApi/Model/Calendars/EarningsCalendarResponse.cs @@ -11,18 +11,18 @@ public class EarningsCalendarResponse public string Symbol { get; set; } [JsonPropertyName("eps")] - public decimal? Eps { get; set; } + public double? Eps { get; set; } [JsonPropertyName("epsEstimated")] - public decimal? EpsEstimated { get; set; } + public double? EpsEstimated { get; set; } [JsonPropertyName("time")] public string Time { get; set; } [JsonPropertyName("revenue")] - public decimal? Revenue { get; set; } + public double? Revenue { get; set; } [JsonPropertyName("revenueEstimated")] - public decimal? RevenueEstimated { get; set; } + public double? RevenueEstimated { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs index 343abc4..bf9be1a 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CryptoQuoteResponse.cs @@ -17,60 +17,60 @@ public class CryptoQuoteResponse : ICurrentQuote public string Exchange { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("price")] - public decimal Price { get; set; } + public double? Price { get; set; } [JsonPropertyName("previousclose")] - public decimal PreviousClose { get; set; } + public double? PreviousClose { get; set; } [JsonPropertyName("daylow")] - public decimal DayLow { get; set; } + public double? DayLow { get; set; } [JsonPropertyName("dayhigh")] - public decimal DayHigh { get; set; } + public double? DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal? YearlyLow { get; set; } + public double? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal? YearlyHigh { get; set; } + public double? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal? PriceAvg50 { get; set; } + public double? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal? PriceAvg200 { get; set; } + public double? PriceAvg200 { get; set; } [JsonPropertyName("change")] - public decimal Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changespercentage")] - public decimal ChangesPercentage { get; set; } + public double? ChangesPercentage { get; set; } [JsonPropertyName("timestamp")] - public long Timestamp { get; set; } + public long? Timestamp { get; set; } [JsonPropertyName("volume")] - public ulong Volume { get; set; } + public double? Volume { get; set; } [JsonPropertyName("avgVolume")] - public ulong AvgVolume { get; set; } + public double? AvgVolume { get; set; } // Not used by Forex or Futures. [JsonPropertyName("eps")] - public decimal? Eps { get; set; } + public double? Eps { get; set; } [JsonPropertyName("pe")] - public decimal? Pe { get; set; } + public double? Pe { get; set; } [JsonPropertyName("earningsAnnouncement")] public string? EarningsAnnouncement { get; set; } [JsonPropertyName("sharesOutstanding")] - public long? SharesOutstanding { get; set; } + public double? SharesOutstanding { get; set; } [JsonPropertyName("marketCap")] - public decimal? MarketCap { get; set; } + public double? MarketCap { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs index b7b7fcb..0cc882f 100644 --- a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs +++ b/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs @@ -35,39 +35,39 @@ public class CyptoHistoricalPriceDailyListing : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal? Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("high")] - public decimal? High { get; set; } + public double? High { get; set; } [JsonPropertyName("low")] - public decimal? Low { get; set; } + public double? Low { get; set; } [JsonPropertyName("close")] - public decimal Close { get; set; } + public double Close { get; set; } [JsonPropertyName("change")] - public decimal? Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changePercent")] - public decimal? ChangePercent { get; set; } + public double? ChangePercent { get; set; } [JsonPropertyName("volume")] - public decimal Volume { get; set; } + public double Volume { get; set; } [JsonPropertyName("adjClose")] - public decimal AdjClose { get; set; } + public double AdjClose { get; set; } [JsonPropertyName("unadjustedVolume")] - public decimal UnadjustedVolume { get; set; } + public double UnadjustedVolume { get; set; } [JsonPropertyName("vwap")] - public decimal VWAP { get; set; } + public double VWAP { get; set; } [JsonPropertyName("label")] public string Label { get; set; } [JsonPropertyName("changeOvertime")] - public decimal ChangeOvertime { get; set; } + public double ChangeOvertime { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs index 3da30f0..93410b4 100644 --- a/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Forex/ForexHistoricalQuoteResponse.cs @@ -10,23 +10,23 @@ public class ForexHistoricalQuoteResponse : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal? Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("high")] - public decimal? High { get; set; } + public double? High { get; set; } [JsonPropertyName("low")] - public decimal? Low { get; set; } + public double? Low { get; set; } [JsonPropertyName("close")] - public decimal Close { get; set; } + public double Close { get; set; } [JsonPropertyName("change")] - public decimal? Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("volume")] - public decimal Volume { get; set; } + public double Volume { get; set; } [JsonPropertyName("changePercent")] - public decimal? ChangePercent { get; set; } + public double? ChangePercent { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs index d876465..5347d7c 100644 --- a/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Forex/ForexQuoteResponse.cs @@ -17,60 +17,60 @@ public class ForexQuoteResponse : ICurrentQuote public string Exchange { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("price")] - public decimal Price { get; set; } + public double? Price { get; set; } [JsonPropertyName("previousclose")] - public decimal PreviousClose { get; set; } + public double? PreviousClose { get; set; } [JsonPropertyName("daylow")] - public decimal DayLow { get; set; } + public double? DayLow { get; set; } [JsonPropertyName("dayhigh")] - public decimal DayHigh { get; set; } + public double? DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal? YearlyLow { get; set; } + public double? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal? YearlyHigh { get; set; } + public double? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal? PriceAvg50 { get; set; } + public double? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal? PriceAvg200 { get; set; } + public double? PriceAvg200 { get; set; } [JsonPropertyName("change")] - public decimal Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changespercentage")] - public decimal ChangesPercentage { get; set; } + public double? ChangesPercentage { get; set; } [JsonPropertyName("timestamp")] - public long Timestamp { get; set; } + public long? Timestamp { get; set; } [JsonPropertyName("volume")] - public ulong Volume { get; set; } + public double? Volume { get; set; } [JsonPropertyName("avgVolume")] - public ulong AvgVolume { get; set; } + public double? AvgVolume { get; set; } // Not used by Forex or Futures. [JsonPropertyName("eps")] - public decimal? Eps { get; set; } + public double? Eps { get; set; } [JsonPropertyName("pe")] - public decimal? Pe { get; set; } + public double? Pe { get; set; } [JsonPropertyName("earningsAnnouncement")] public string? EarningsAnnouncement { get; set; } [JsonPropertyName("sharesOutstanding")] - public long? SharesOutstanding { get; set; } + public double? SharesOutstanding { get; set; } [JsonPropertyName("marketCap")] - public decimal? MarketCap { get; set; } + public double? MarketCap { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs index c427e11..ef9554a 100644 --- a/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Futures/FuturesHistoricalQuoteResponse.cs @@ -10,23 +10,23 @@ public class FuturesHistoricalQuoteResponse : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal? Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("high")] - public decimal? High { get; set; } + public double? High { get; set; } [JsonPropertyName("low")] - public decimal? Low { get; set; } + public double? Low { get; set; } [JsonPropertyName("close")] - public decimal Close { get; set; } + public double Close { get; set; } [JsonPropertyName("change")] - public decimal? Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changePercent")] - public decimal? ChangePercent { get; set; } + public double? ChangePercent { get; set; } [JsonPropertyName("volume")] - public decimal Volume { get; set; } + public double Volume { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs index 79d3b5e..d429148 100644 --- a/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/Futures/FuturesQuoteResponse.cs @@ -17,60 +17,60 @@ public class FuturesQuoteResponse : ICurrentQuote public string Exchange { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("price")] - public decimal Price { get; set; } + public double? Price { get; set; } [JsonPropertyName("previousclose")] - public decimal PreviousClose { get; set; } + public double? PreviousClose { get; set; } [JsonPropertyName("daylow")] - public decimal DayLow { get; set; } + public double? DayLow { get; set; } [JsonPropertyName("dayhigh")] - public decimal DayHigh { get; set; } + public double? DayHigh { get; set; } [JsonPropertyName("yearlow")] - public decimal? YearlyLow { get; set; } + public double? YearlyLow { get; set; } [JsonPropertyName("yearhigh")] - public decimal? YearlyHigh { get; set; } + public double? YearlyHigh { get; set; } [JsonPropertyName("priceavg50")] - public decimal? PriceAvg50 { get; set; } + public double? PriceAvg50 { get; set; } [JsonPropertyName("priceavg200")] - public decimal? PriceAvg200 { get; set; } + public double? PriceAvg200 { get; set; } [JsonPropertyName("change")] - public decimal Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changespercentage")] - public decimal ChangesPercentage { get; set; } + public double? ChangesPercentage { get; set; } [JsonPropertyName("timestamp")] - public long Timestamp { get; set; } + public long? Timestamp { get; set; } [JsonPropertyName("volume")] - public ulong Volume { get; set; } + public double? Volume { get; set; } [JsonPropertyName("avgVolume")] - public ulong AvgVolume { get; set; } + public double? AvgVolume { get; set; } // Not used by Forex or Futures. [JsonPropertyName("eps")] - public decimal? Eps { get; set; } + public double? Eps { get; set; } [JsonPropertyName("pe")] - public decimal? Pe { get; set; } + public double? Pe { get; set; } [JsonPropertyName("earningsAnnouncement")] public string? EarningsAnnouncement { get; set; } [JsonPropertyName("sharesOutstanding")] - public long? SharesOutstanding { get; set; } + public double? SharesOutstanding { get; set; } [JsonPropertyName("marketCap")] - public decimal? MarketCap { get; set; } + public double? MarketCap { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs index 2c6e03d..76318af 100644 --- a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs @@ -17,60 +17,60 @@ public class StockQuoteResponse : ICurrentQuote public string Exchange { get; set; } [JsonPropertyName("open")] - public decimal Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("price")] - public decimal Price { get; set; } + public double? Price { get; set; } [JsonPropertyName("previousClose")] - public decimal PreviousClose { get; set; } + public double? PreviousClose { get; set; } [JsonPropertyName("dayLow")] - public decimal DayLow { get; set; } + public double? DayLow { get; set; } [JsonPropertyName("dayHigh")] - public decimal DayHigh { get; set; } + public double? DayHigh { get; set; } [JsonPropertyName("yearLow")] - public decimal? YearlyLow { get; set; } + public double? YearlyLow { get; set; } [JsonPropertyName("yearHigh")] - public decimal? YearlyHigh { get; set; } + public double? YearlyHigh { get; set; } [JsonPropertyName("priceAvg50")] - public decimal? PriceAvg50 { get; set; } + public double? PriceAvg50 { get; set; } [JsonPropertyName("priceAvg200")] - public decimal? PriceAvg200 { get; set; } + public double? PriceAvg200 { get; set; } [JsonPropertyName("change")] - public decimal Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changesPercentage")] - public decimal ChangesPercentage { get; set; } + public double? ChangesPercentage { get; set; } [JsonPropertyName("timestamp")] - public long Timestamp { get; set; } + public long? Timestamp { get; set; } [JsonPropertyName("volume")] - public ulong Volume { get; set; } + public double? Volume { get; set; } [JsonPropertyName("avgVolume")] - public ulong AvgVolume { get; set; } + public double? AvgVolume { get; set; } // Not used by Forex or Futures. [JsonPropertyName("eps")] - public decimal? Eps { get; set; } + public double? Eps { get; set; } [JsonPropertyName("pe")] - public decimal? Pe { get; set; } + public double? Pe { get; set; } [JsonPropertyName("earningsAnnouncement")] public string? EarningsAnnouncement { get; set; } [JsonPropertyName("sharesOutstanding")] - public long? SharesOutstanding { get; set; } + public double? SharesOutstanding { get; set; } [JsonPropertyName("marketCap")] - public decimal? MarketCap { get; set; } + public double? MarketCap { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs index 61245c2..67b213d 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceForChartWithVolumeResponse.cs @@ -9,39 +9,39 @@ public class HistoricalPriceForChartWithVolumeResponse : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal? Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("high")] - public decimal? High { get; set; } + public double? High { get; set; } [JsonPropertyName("low")] - public decimal? Low { get; set; } + public double? Low { get; set; } [JsonPropertyName("close")] - public decimal Close { get; set; } + public double Close { get; set; } [JsonPropertyName("change")] - public decimal? Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changePercent")] - public decimal? ChangePercent { get; set; } + public double? ChangePercent { get; set; } [JsonPropertyName("volume")] - public decimal Volume { get; set; } + public double Volume { get; set; } [JsonPropertyName("adjClose")] - public decimal AdjClose { get; set; } + public double AdjClose { get; set; } [JsonPropertyName("unadjustedVolume")] - public decimal UnadjustedVolume { get; set; } + public double UnadjustedVolume { get; set; } [JsonPropertyName("vwap")] - public decimal VWAP { get; set; } + public double VWAP { get; set; } [JsonPropertyName("label")] public string Label { get; set; } [JsonPropertyName("changeOvertime")] - public decimal ChangeOvertime { get; set; } + public double ChangeOvertime { get; set; } } } diff --git a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs index 61c9317..b7060c1 100644 --- a/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs +++ b/FinancialModelingPrepApi/Model/StockTimeSeries/HistoricalPriceResponse.cs @@ -20,39 +20,39 @@ public class HistoricalPriceItem : IHistoricalQuote public string Date { get; set; } [JsonPropertyName("open")] - public decimal? Open { get; set; } + public double? Open { get; set; } [JsonPropertyName("high")] - public decimal? High { get; set; } + public double? High { get; set; } [JsonPropertyName("low")] - public decimal? Low { get; set; } + public double? Low { get; set; } [JsonPropertyName("close")] - public decimal Close { get; set; } + public double Close { get; set; } [JsonPropertyName("adjClose")] - public decimal AdjClose { get; set; } + public double AdjClose { get; set; } [JsonPropertyName("volume")] - public decimal Volume { get; set; } + public double Volume { get; set; } [JsonPropertyName("unadjustedVolume")] - public decimal UnadjustedVolume { get; set; } + public double UnadjustedVolume { get; set; } [JsonPropertyName("change")] - public decimal? Change { get; set; } + public double? Change { get; set; } [JsonPropertyName("changePercent")] - public decimal? ChangePercent { get; set; } + public double? ChangePercent { get; set; } [JsonPropertyName("vwap")] - public decimal Vwap { get; set; } + public double? Vwap { get; set; } [JsonPropertyName("label")] public string Label { get; set; } [JsonPropertyName("changeOverTime")] - public decimal ChangeOverTime { get; set; } + public double ChangeOverTime { get; set; } } } From 1cf5e3b5ead4714720d825f6282c7574fd8d83de Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 6 Dec 2023 20:30:53 -0600 Subject: [PATCH 05/12] new stuff --- FinancialModelingPrepApi/FinancialModelingPrepApi.csproj | 1 + FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index ac59e4b..5b4a076 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -24,6 +24,7 @@ FinancialModelingPrep AnyCPU;x86;x64 + Debug;Release;multi-launch diff --git a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs index 76318af..bfd363f 100644 --- a/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs +++ b/FinancialModelingPrepApi/Model/StockMarket/StockQuoteResponse.cs @@ -1,5 +1,4 @@ using MatthiWare.FinancialModelingPrep.Abstractions.Model; -using System; using System.Text.Json.Serialization; namespace MatthiWare.FinancialModelingPrep.Model.StockMarket From 889351eac9730c4e09ecaa67c17622ae419f8a45 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 18 Dec 2023 19:13:25 -0600 Subject: [PATCH 06/12] Upgrade to .NET 8. --- FinancialModelingPrepApi/FinancialModelingPrepApi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index 5b4a076..6c7dea5 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -1,7 +1,7 @@  - net5.0 + net8.0 MatthiWare.FinancialModelingPrep true true From e0fdeb8fc45ea80e7e602005eacc73b719074f11 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 18 Dec 2023 19:27:26 -0600 Subject: [PATCH 07/12] Fixed .xml file hard path. --- .../FinancialModelingPrepApi.xml | 423 ++++++++++++++++++ .../FinancialModelingPrepApi.csproj | 6 +- 2 files changed, 426 insertions(+), 3 deletions(-) create mode 100644 FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml diff --git a/FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml b/FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml new file mode 100644 index 0000000..bc4c323 --- /dev/null +++ b/FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml @@ -0,0 +1,423 @@ + + + + FinancialModelingPrep + + + + + Gets the Earnings Calendar + + Format YYYY-MM-DD + Format YYYY-MM-DD + + + + + Gets the Earnings Calendar + + + + + + Gets the Historical Earnings + + Symbol to use + Limits the amount of items. Null acts as unlimited. + + + + + Gets the IPO Calendar + The maximum time interval between from and to is 3 months. + + From date YYYY-MM-DD + To date YYYY-MM-DD + + + + + Gets the Dividend Calendar + The maximum time interval between from and to is 3 months. + + From date YYYY-MM-DD + To date YYYY-MM-DD + + + + + Gets the Economic Calendar + The maximum time interval between from and to is 3 months. + + From date YYYY-MM-DD + To date YYYY-MM-DD + + + + + Gets the Stock Split Calendar + The maximum time interval between from and to is 3 months. + + From date YYYY-MM-DD + To date YYYY-MM-DD + + + + + Public comapnies sometimes change their symbol and thanks to this endpoint you will be able to know if there is any symbol change happened. + Data for new symbol is getting transferred from the old symbol the same day + + + + + + Complete list of all institutional investment managers by cik + + + + + + Cusip mapper + + + + + + + FORM 13F cik search by name + + + + + + + FORM 13F get company name by cik + + + + + + + FORM 13F statements provides position-level report of all institutional investment managers with more than $100m in assets under management (i.e. Berkshire hathaway cik). + + + + + + + + Stock related statistics + + + + + Get analyst estimates + + Stock symbol + Period (Annual or Quarterly) + Limts the amount of results + + + + + Get the latest quote for given stock. + + + + + + + Get Daily Historical Dividends + + Ticker symbol + + + + + Get Daily Historical Stock Splits + + Ticker symbol + + + + + Get Daily Historical Prices + + Ticker symbol + + + + + Get Daily Historical Prices + + Ticker symbol + From date (YYYY-MM-DD) + To date (YYYY-MM-DD) + + + + + Get Daily Historical Prices + Should be used to display on a linechart + + Ticker symbol + + + + + Get Daily Historical Prices + Should be used to display on a linechart + + Ticker symbol + From date (YYYY-MM-DD) + To date (YYYY-MM-DD) + + + + + Get Daily Historical Prices for charts with volume + + Ticker symbol + Time series + + + + + FMP Client that exposes different sections of Endpoints + + + + + Advanced Data Endpoints are grouped here + Note: most of these endpoints require a premium API Key + + + + + All Company Valuation Endpoints are grouped here + + + + + All Market Index Endpoints are grouped here + + + + + All Calendar related Endpoints are grouped here (Earnings, IPO, stock splits, Dividends, Economic) + + + + + All Instituational Fund Endpoints are grouped here + + + + + All Stock Time Series Endpoints are grouped here + + + + + All Stock Market Related Endpoints are grouped here (Most Active, Gainers, Losers) + + + + + Statistic Related Endpoint are grouped here (Estimates) + + + + + Cryptomarket related enpoints + + + + + Forex related enpoints + + + + + Futures related enpoints + + + + + ETF/Mutual Fund related enpoints + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adds the to the services. + This package does not override any existing registrations. + + DI Service Collection + FMP Options if left as null it will use the default options and default API Key + + + + Exposes factory methods to easily create clients without using dependency injection. + If you do want to use DI please see + + + + + Creates an FMP API Client with all dependencies already wired up. + If you do want to use DI please see + + + An instance of + + + + FMP Options + + + + + Get or set the FMP API Key. + You can find your API Key in the dashboard (https://financialmodelingprep.com/developer/docs/dashboard) + By default it will use the 'demo' API Key that is limited and not all endpoints will work. + + + + + Gets or sets the maximum allowed of requests per second. + By default the max allowed is 10. If you have a different rate limit you can configure it here. + See Rate Limitation #15 https://financialmodelingprep.com/developer/docs/terms-of-service + + + + + Gets or sets the maximum allowed API Calls per second. + You can find the defaults on the pricing documentation. + By default we use the 300 "starter" limit. + https://financialmodelingprep.com/developer/docs/pricing + + + + + Error message if any occured + + + + + True if there was an error with the request otherwise false + + + + + The FMP API response object + + + + diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index 6c7dea5..0f6268f 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -28,15 +28,15 @@ - D:\Source\Repos\FinancialModelingPrep.NET\FinancialModelingPrepApi\FinancialModelingPrepApi.xml + ./FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml - D:\Source\Repos\FinancialModelingPrep.NET\FinancialModelingPrepApi\FinancialModelingPrepApi.xml + ./FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml - D:\Source\Repos\FinancialModelingPrep.NET\FinancialModelingPrepApi\FinancialModelingPrepApi.xml + ./FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml From 90859543e7d56a277fcafbd3bc73e8cc86595201 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 18 Dec 2023 19:42:34 -0600 Subject: [PATCH 08/12] Update README.md --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c1df384..64ea65d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ -# FinancialModelingPrep.NET +# FinancialModelingPrep.NET Extended +.NET 8 API Client For https://financialmodelingprep.com/ API written in C#. Extended edition based on MatthiWare's foundation -- see repo this is forked off of. -[![.NET](https://github.com/MatthiWare/FinancialModelingPrep.NET/actions/workflows/dotnet.yml/badge.svg)](https://github.com/MatthiWare/FinancialModelingPrep.NET/actions/workflows/dotnet.yml) -[![Nuget](https://buildstats.info/nuget/MatthiWare.FinancialModelingPrep)](https://www.nuget.org/packages/MatthiWare.FinancialModelingPrep/) - -.NET 5 API Client For https://financialmodelingprep.com/ API written in C# +Actively maintained as part of a financial analysis project. ## Installation ```powershell -PM> Install-Package MatthiWare.FinancialModelingPrep +PM> Install-Package 1130Labs.FinancialModelingPrepExtended ``` # Quick Start @@ -103,8 +101,8 @@ else - Euronext - TSX - Stock Market (Partially covered) -- Cryptocurrencies (Not yet covered) -- Forex (Not yet covered) +- Cryptocurrencies +- Forex ### Contribute Create a PR where you add or improve an Endpoint From 19ab3b59f497357e628a60f5344455429841a0e0 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 18 Dec 2023 19:44:14 -0600 Subject: [PATCH 09/12] Test commit with renamed repo. --- .../FinancialModelingPrepApi.xml | 2 +- .../FinancialModelingPrepApi.csproj | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml b/FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml index bc4c323..d8142b8 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml +++ b/FinancialModelingPrepApi/FinancialModelingPrep.NET/FinancialModelingPrepApi/FinancialModelingPrepApi.xml @@ -1,7 +1,7 @@ - FinancialModelingPrep + FinancialModelingPrepExtended diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index 0f6268f..acd0d85 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -7,13 +7,13 @@ true 0.1.12.0 0.1.12.0 - MatthiWare - MatthiWare.FinancialModelingPrep - 0.1.12 - FinancialModelingPrep API Client written in .NET 5 - Copyright Matthias Beerens 2021 + MatthiWare, 1130 Labs + 1130Labs.FinancialModelingPrepExtended + 0.1.0 + FinancialModelingPrep API Client. + MIT FinancialModelingPrep API Client - Matthias Beerens + Matthias Beerens, Michael McCabe LICENSE https://github.com/MatthiWare/FinancialModelingPrep.NET git @@ -22,7 +22,7 @@ - GetEnterpriseValueAsync Type fixed - FinancialModelingPrep + FinancialModelingPrepExtended AnyCPU;x86;x64 Debug;Release;multi-launch From d9bf2c58f9bbb460376f222eb3f7966df56c7cb4 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 18 Dec 2023 19:49:01 -0600 Subject: [PATCH 10/12] Updated nuget information. --- FinancialModelingPrepApi/FinancialModelingPrepApi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index acd0d85..24cbd95 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -5,8 +5,8 @@ MatthiWare.FinancialModelingPrep true true - 0.1.12.0 - 0.1.12.0 + 0.1.0.0 + 0.1.0.0 MatthiWare, 1130 Labs 1130Labs.FinancialModelingPrepExtended 0.1.0 @@ -15,7 +15,7 @@ FinancialModelingPrep API Client Matthias Beerens, Michael McCabe LICENSE - https://github.com/MatthiWare/FinancialModelingPrep.NET + https://github.com/mccabe93/FinancialModelingPrepExtended git FinancialModelingPrep stock quote finance-api https://github.com/MatthiWare/FinancialModelingPrep.NET From 1647d4a7941f5cad515d70c2240d600a3f4f19ef Mon Sep 17 00:00:00 2001 From: Mike McCabe Date: Tue, 6 Feb 2024 21:29:22 -0600 Subject: [PATCH 11/12] - Added Impact field to EconomicCalendarResponse. - Fixed up a couple unit tests to align with changes. --- .../FinancialModelingPrepApi.csproj | 10 ++-- .../Calendars/EconomicCalendarResponse.cs | 2 + Tests/Crypto/CryptoMarketTests.cs | 4 +- Tests/StockTimeSeries/StockTimeSeriesTests.cs | 49 +++---------------- Tests/Tests.csproj | 2 +- 5 files changed, 18 insertions(+), 49 deletions(-) diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index 24cbd95..b121a5b 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -5,15 +5,15 @@ MatthiWare.FinancialModelingPrep true true - 0.1.0.0 - 0.1.0.0 + + MatthiWare, 1130 Labs - 1130Labs.FinancialModelingPrepExtended - 0.1.0 + FinancialModelingPrepExtended + 0.1.1 FinancialModelingPrep API Client. MIT FinancialModelingPrep API Client - Matthias Beerens, Michael McCabe + Matthias Beerens, 1130 Labs LICENSE https://github.com/mccabe93/FinancialModelingPrepExtended git diff --git a/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs b/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs index b80916c..dac4afa 100644 --- a/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs +++ b/FinancialModelingPrepApi/Model/Calendars/EconomicCalendarResponse.cs @@ -27,5 +27,7 @@ public class EconomicCalendarResponse [JsonPropertyName("estimate")] public decimal? Estimate { get; set; } + [JsonPropertyName("impact")] + public string? Impact { get; set; } } } diff --git a/Tests/Crypto/CryptoMarketTests.cs b/Tests/Crypto/CryptoMarketTests.cs index 0a0499e..1cbb3d9 100644 --- a/Tests/Crypto/CryptoMarketTests.cs +++ b/Tests/Crypto/CryptoMarketTests.cs @@ -37,10 +37,10 @@ public async Task GetAvailableCryptocurrencies() [Fact] public async Task GetDailyPrice() { - var result = await api.GetDailyPricesAsync("BTCUSD"); + var result = await api.GetHistoricalQuoteAsync("BTCUSD"); result.AssertNoErrors(); - Assert.NotEmpty(result.Data.HistoricalPrices); + Assert.NotEmpty(result.Data.Historical); } [Fact] diff --git a/Tests/StockTimeSeries/StockTimeSeriesTests.cs b/Tests/StockTimeSeries/StockTimeSeriesTests.cs index 4f40fd4..718fc09 100644 --- a/Tests/StockTimeSeries/StockTimeSeriesTests.cs +++ b/Tests/StockTimeSeries/StockTimeSeriesTests.cs @@ -64,10 +64,10 @@ public async Task GetHistoricalDailyPricesAsync() var split = result.Data.Historical.First(data => data.Date == "2021-06-04"); - Assert.Equal(125.89m, split.Close, 2); - Assert.Equal(124.07m, split.Open, 2); - Assert.Equal(126.16m, split.High, 2); - Assert.Equal(123.85m, split.Low, 2); + Assert.Equal(125.89d, split.Close, 2); + Assert.Equal(124.07d, split.Open.Value, 2); + Assert.Equal(126.16d, split.High.Value, 2); + Assert.Equal(123.85d, split.Low.Value, 2); } [Fact] @@ -81,10 +81,10 @@ public async Task GetHistoricalDailyPricesUsingFromToAsync() var split = result.Data.Historical.First(data => data.Date == "2021-06-04"); - Assert.Equal(125.89m, split.Close, 2); - Assert.Equal(124.07m, split.Open, 2); - Assert.Equal(126.16m, split.High, 2); - Assert.Equal(123.85m, split.Low, 2); + Assert.Equal(125.89d, split.Close, 2); + Assert.Equal(124.07d, split.Open.Value, 2); + Assert.Equal(126.16d, split.High.Value, 2); + Assert.Equal(123.85d, split.Low.Value, 2); } [Fact] @@ -99,28 +99,6 @@ public async Task GetHistoricalDailyPricesForLineChartAsync() Assert.Equal(125.89m, split.Close, 2); } - [Theory] - [MemberData(nameof(AvailableHistoricalChartSeries))] - public async Task GetHistoricalPricesForChartWithVolume(HistoricalChartSeries series) - { - var result = await api.GetHistoricalPricesForChartWithVolume("AAPL", series); - - result.AssertNoErrors(); - - Assert.True(result.Data.Count > 0); - } - - [Theory] - [MemberData(nameof(AvailableHistoricalChartSeries))] - public async Task GetHistoricalPricesForChartWithVolume2(HistoricalChartSeries series) - { - var result = await api.GetHistoricalPricesForChartWithVolume("AGS.BR", series); - - result.AssertNoErrors(); - - Assert.True(result.Data.Count > 0); - } - [Fact] public async Task GetHistoricalDailyPricesForLineChartUsingFromToAsync() { @@ -134,16 +112,5 @@ public async Task GetHistoricalDailyPricesForLineChartUsingFromToAsync() Assert.Equal(125.89m, split.Close, 2); } - - public static IEnumerable AvailableHistoricalChartSeries - { - get - { - foreach (var enumValue in Enum.GetValues()) - { - yield return new object[] { enumValue }; - } - } - } } } diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 996df16..96febfa 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,7 +1,7 @@ - net5.0 + net8.0 false From 69b0ebd8f02ecd31fcb841477074a2bace52ed10 Mon Sep 17 00:00:00 2001 From: Mike McCabe Date: Wed, 28 Feb 2024 16:37:55 -0600 Subject: [PATCH 12/12] Added CommitmentOfTraders report support. --- .../AdvancedData/IAdvancedDataProvider.cs | 6 +- .../Core/AdvancedData/AdvancedDataProvider.cs | 24 +- .../FinancialModelingPrepApi.csproj | 2 +- .../CommitmentOfTradersResponse.cs | 399 ++++++++++++++++++ ...gs.cs => CryptoHistoricalPriceListings.cs} | 0 Tests/AdvancedData/AdvancedDataTests.cs | 14 +- 6 files changed, 438 insertions(+), 7 deletions(-) create mode 100644 FinancialModelingPrepApi/Model/AdvancedData/CommitmentOfTradersResponse.cs rename FinancialModelingPrepApi/Model/Crypto/{CyptoHistoricalPriceListings.cs => CryptoHistoricalPriceListings.cs} (100%) diff --git a/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs b/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs index 62cdc5a..26ab0df 100644 --- a/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs +++ b/FinancialModelingPrepApi/Abstractions/AdvancedData/IAdvancedDataProvider.cs @@ -21,11 +21,9 @@ public interface IAdvancedDataProvider Task> GetStockPeersAsync(string symbol); Task>> GetSectorsPriceEarningsRatioAsync(string date, string exchange); Task>> GetIndustriesPriceEarningsRatioAsync(string date, string exchange); - + Task>> GetCommitmentOfTradersReportAsync(string symbol); Task> GetSharesFloatAsync(string symbol); - Task>> GetESGScoreAsync(string symbol); - - Task>> GetFinancialScore(string symbol); + Task>> GetFinancialScoreAsync(string symbol); } } diff --git a/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs b/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs index bf76b2c..77b606e 100644 --- a/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs +++ b/FinancialModelingPrepApi/Core/AdvancedData/AdvancedDataProvider.cs @@ -80,7 +80,29 @@ private async Task> GetSta return ApiResponse.FromSuccess(result.Data.First()); } - public async Task>> GetFinancialScore(string symbol) + public async Task>> GetCommitmentOfTradersReportAsync(string symbol) + { + const string url = "[version]/commitment_of_traders_report"; + + var pathParams = new NameValueCollection() + { + { "version", ApiVersion.v4.ToString() } + }; + + var queryString = new QueryStringBuilder(); + queryString.Add("symbol", symbol); + + var result = await client.GetJsonAsync>(url, pathParams, queryString); + + if (result.HasError) + { + return ApiResponse.FromError>(result.Error); + } + + return ApiResponse.FromSuccess(result.Data); + } + + public async Task>> GetFinancialScoreAsync(string symbol) { const string url = "[version]/score"; diff --git a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj index b121a5b..1da5de8 100644 --- a/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj +++ b/FinancialModelingPrepApi/FinancialModelingPrepApi.csproj @@ -9,7 +9,7 @@ MatthiWare, 1130 Labs FinancialModelingPrepExtended - 0.1.1 + 0.2.0 FinancialModelingPrep API Client. MIT FinancialModelingPrep API Client diff --git a/FinancialModelingPrepApi/Model/AdvancedData/CommitmentOfTradersResponse.cs b/FinancialModelingPrepApi/Model/AdvancedData/CommitmentOfTradersResponse.cs new file mode 100644 index 0000000..02103d9 --- /dev/null +++ b/FinancialModelingPrepApi/Model/AdvancedData/CommitmentOfTradersResponse.cs @@ -0,0 +1,399 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace MatthiWare.FinancialModelingPrep.Model.AdvancedData +{ + public class CommitmentOfTradersResponse + { + [JsonPropertyName("symbol")] + public string Symbol { get; set; } + + [JsonPropertyName("date")] + public string Date { get; set; } + + [JsonPropertyName("short_name")] + public string ShortName { get; set; } + + [JsonPropertyName("sector")] + public string Sector { get; set; } + + [JsonPropertyName("market_and_exchange_names")] + public string MarketAndExchangeNames { get; set; } + + [JsonPropertyName("as_of_date_in_form_yymmdd")] + public string AsOfDateInFormYymmdd { get; set; } + + [JsonPropertyName("cftc_contract_market_code")] + public string CftcContractMarketCode { get; set; } + + [JsonPropertyName("cftc_market_code")] + public string CftcMarketCode { get; set; } + + [JsonPropertyName("cftc_region_code")] + public string CftcRegionCode { get; set; } + + [JsonPropertyName("cftc_commodity_code")] + public string CftcCommodityCode { get; set; } + + [JsonPropertyName("open_interest_all")] + public int OpenInterestAll { get; set; } + + [JsonPropertyName("noncomm_positions_long_all")] + public int NoncommPositionsLongAll { get; set; } + + [JsonPropertyName("noncomm_positions_short_all")] + public int NoncommPositionsShortAll { get; set; } + + [JsonPropertyName("noncomm_postions_spread_all")] + public int NoncommPostionsSpreadAll { get; set; } + + [JsonPropertyName("comm_positions_long_all")] + public int CommPositionsLongAll { get; set; } + + [JsonPropertyName("comm_positions_short_all")] + public int CommPositionsShortAll { get; set; } + + [JsonPropertyName("tot_rept_positions_long_all")] + public int TotReptPositionsLongAll { get; set; } + + [JsonPropertyName("tot_rept_positions_short_all")] + public int TotReptPositionsShortAll { get; set; } + + [JsonPropertyName("nonrept_positions_long_all")] + public int NonreptPositionsLongAll { get; set; } + + [JsonPropertyName("nonrept_positions_short_all")] + public int NonreptPositionsShortAll { get; set; } + + [JsonPropertyName("open_interest_old")] + public int OpenInterestOld { get; set; } + + [JsonPropertyName("noncomm_positions_long_old")] + public int NoncommPositionsLongOld { get; set; } + + [JsonPropertyName("noncomm_positions_short_old")] + public int NoncommPositionsShortOld { get; set; } + + [JsonPropertyName("noncomm_positions_spread_old")] + public int NoncommPositionsSpreadOld { get; set; } + + [JsonPropertyName("comm_positions_long_old")] + public int CommPositionsLongOld { get; set; } + + [JsonPropertyName("comm_positions_short_old")] + public int CommPositionsShortOld { get; set; } + + [JsonPropertyName("tot_rept_positions_long_old")] + public int TotReptPositionsLongOld { get; set; } + + [JsonPropertyName("tot_rept_positions_short_old")] + public int TotReptPositionsShortOld { get; set; } + + [JsonPropertyName("nonrept_positions_long_old")] + public int NonreptPositionsLongOld { get; set; } + + [JsonPropertyName("nonrept_positions_short_old")] + public int NonreptPositionsShortOld { get; set; } + + [JsonPropertyName("open_interest_other")] + public int OpenInterestOther { get; set; } + + [JsonPropertyName("noncomm_positions_long_other")] + public int NoncommPositionsLongOther { get; set; } + + [JsonPropertyName("noncomm_positions_short_other")] + public int NoncommPositionsShortOther { get; set; } + + [JsonPropertyName("noncomm_positions_spread_other")] + public int NoncommPositionsSpreadOther { get; set; } + + [JsonPropertyName("comm_positions_long_other")] + public int CommPositionsLongOther { get; set; } + + [JsonPropertyName("comm_positions_short_other")] + public int CommPositionsShortOther { get; set; } + + [JsonPropertyName("tot_rept_positions_long_other")] + public int TotReptPositionsLongOther { get; set; } + + [JsonPropertyName("tot_rept_positions_short_other")] + public int TotReptPositionsShortOther { get; set; } + + [JsonPropertyName("nonrept_positions_long_other")] + public int NonreptPositionsLongOther { get; set; } + + [JsonPropertyName("nonrept_positions_short_other")] + public int NonreptPositionsShortOther { get; set; } + + [JsonPropertyName("change_in_open_interest_all")] + public int ChangeInOpenInterestAll { get; set; } + + [JsonPropertyName("change_in_noncomm_long_all")] + public int ChangeInNoncommLongAll { get; set; } + + [JsonPropertyName("change_in_noncomm_short_all")] + public int ChangeInNoncommShortAll { get; set; } + + [JsonPropertyName("change_in_noncomm_spead_all")] + public int ChangeInNoncommSpeadAll { get; set; } + + [JsonPropertyName("change_in_comm_long_all")] + public int ChangeInCommLongAll { get; set; } + + [JsonPropertyName("change_in_comm_short_all")] + public int ChangeInCommShortAll { get; set; } + + [JsonPropertyName("change_in_tot_rept_long_all")] + public int ChangeInTotReptLongAll { get; set; } + + [JsonPropertyName("change_in_tot_rept_short_all")] + public int ChangeInTotReptShortAll { get; set; } + + [JsonPropertyName("change_in_nonrept_long_all")] + public int ChangeInNonreptLongAll { get; set; } + + [JsonPropertyName("change_in_nonrept_short_all")] + public int ChangeInNonreptShortAll { get; set; } + + [JsonPropertyName("pct_of_open_interest_all")] + public int PctOfOpenInterestAll { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_long_all")] + public double PctOfOiNoncommLongAll { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_short_all")] + public double PctOfOiNoncommShortAll { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_spread_all")] + public double PctOfOiNoncommSpreadAll { get; set; } + + [JsonPropertyName("pct_of_oi_comm_long_all")] + public double PctOfOiCommLongAll { get; set; } + + [JsonPropertyName("pct_of_oi_comm_short_all")] + public double PctOfOiCommShortAll { get; set; } + + [JsonPropertyName("pct_of_oi_tot_rept_long_all")] + public double PctOfOiTotReptLongAll { get; set; } + + [JsonPropertyName("pct_of_oi_tot_rept_short_all")] + public double PctOfOiTotReptShortAll { get; set; } + + [JsonPropertyName("pct_of_oi_nonrept_long_all")] + public double PctOfOiNonreptLongAll { get; set; } + + [JsonPropertyName("pct_of_oi_nonrept_short_all")] + public double PctOfOiNonreptShortAll { get; set; } + + [JsonPropertyName("pct_of_open_interest_ol")] + public int PctOfOpenInterestOl { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_long_ol")] + public double PctOfOiNoncommLongOl { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_short_ol")] + public double PctOfOiNoncommShortOl { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_spread_ol")] + public double PctOfOiNoncommSpreadOl { get; set; } + + [JsonPropertyName("pct_of_oi_comm_long_ol")] + public double PctOfOiCommLongOl { get; set; } + + [JsonPropertyName("pct_of_oi_comm_short_ol")] + public double PctOfOiCommShortOl { get; set; } + + [JsonPropertyName("pct_of_oi_tot_rept_long_ol")] + public double PctOfOiTotReptLongOl { get; set; } + + [JsonPropertyName("pct_of_oi_tot_rept_short_ol")] + public double PctOfOiTotReptShortOl { get; set; } + + [JsonPropertyName("pct_of_oi_nonrept_long_ol")] + public double PctOfOiNonreptLongOl { get; set; } + + [JsonPropertyName("pct_of_oi_nonrept_short_ol")] + public double PctOfOiNonreptShortOl { get; set; } + + [JsonPropertyName("pct_of_open_interest_other")] + public int PctOfOpenInterestOther { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_long_other")] + public int PctOfOiNoncommLongOther { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_short_other")] + public int PctOfOiNoncommShortOther { get; set; } + + [JsonPropertyName("pct_of_oi_noncomm_spread_other")] + public int PctOfOiNoncommSpreadOther { get; set; } + + [JsonPropertyName("pct_of_oi_comm_long_other")] + public int PctOfOiCommLongOther { get; set; } + + [JsonPropertyName("pct_of_oi_comm_short_other")] + public int PctOfOiCommShortOther { get; set; } + + [JsonPropertyName("pct_of_oi_tot_rept_long_other")] + public int PctOfOiTotReptLongOther { get; set; } + + [JsonPropertyName("pct_of_oi_tot_rept_short_other")] + public int PctOfOiTotReptShortOther { get; set; } + + [JsonPropertyName("pct_of_oi_nonrept_long_other")] + public int PctOfOiNonreptLongOther { get; set; } + + [JsonPropertyName("pct_of_oi_nonrept_short_other")] + public int PctOfOiNonreptShortOther { get; set; } + + [JsonPropertyName("traders_tot_all")] + public int TradersTotAll { get; set; } + + [JsonPropertyName("traders_noncomm_long_all")] + public int TradersNoncommLongAll { get; set; } + + [JsonPropertyName("traders_noncomm_short_all")] + public int TradersNoncommShortAll { get; set; } + + [JsonPropertyName("traders_noncomm_spread_all")] + public int TradersNoncommSpreadAll { get; set; } + + [JsonPropertyName("traders_comm_long_all")] + public int TradersCommLongAll { get; set; } + + [JsonPropertyName("traders_comm_short_all")] + public int TradersCommShortAll { get; set; } + + [JsonPropertyName("traders_tot_rept_long_all")] + public int TradersTotReptLongAll { get; set; } + + [JsonPropertyName("traders_tot_rept_short_all")] + public int TradersTotReptShortAll { get; set; } + + [JsonPropertyName("traders_tot_ol")] + public int TradersTotOl { get; set; } + + [JsonPropertyName("traders_noncomm_long_ol")] + public int TradersNoncommLongOl { get; set; } + + [JsonPropertyName("traders_noncomm_short_ol")] + public int TradersNoncommShortOl { get; set; } + + [JsonPropertyName("traders_noncomm_spead_ol")] + public int TradersNoncommSpeadOl { get; set; } + + [JsonPropertyName("traders_comm_long_ol")] + public int TradersCommLongOl { get; set; } + + [JsonPropertyName("traders_comm_short_ol")] + public int TradersCommShortOl { get; set; } + + [JsonPropertyName("traders_tot_rept_long_ol")] + public int TradersTotReptLongOl { get; set; } + + [JsonPropertyName("traders_tot_rept_short_ol")] + public int TradersTotReptShortOl { get; set; } + + [JsonPropertyName("traders_tot_other")] + public int TradersTotOther { get; set; } + + [JsonPropertyName("traders_noncomm_long_other")] + public int TradersNoncommLongOther { get; set; } + + [JsonPropertyName("traders_noncomm_short_other")] + public int TradersNoncommShortOther { get; set; } + + [JsonPropertyName("traders_noncomm_spread_other")] + public int TradersNoncommSpreadOther { get; set; } + + [JsonPropertyName("traders_comm_long_other")] + public int TradersCommLongOther { get; set; } + + [JsonPropertyName("traders_comm_short_other")] + public int TradersCommShortOther { get; set; } + + [JsonPropertyName("traders_tot_rept_long_other")] + public int TradersTotReptLongOther { get; set; } + + [JsonPropertyName("traders_tot_rept_short_other")] + public int TradersTotReptShortOther { get; set; } + + [JsonPropertyName("conc_gross_le_4_tdr_long_all")] + public double ConcGrossLe4TdrLongAll { get; set; } + + [JsonPropertyName("conc_gross_le_4_tdr_short_all")] + public double ConcGrossLe4TdrShortAll { get; set; } + + [JsonPropertyName("conc_gross_le_8_tdr_long_all")] + public double ConcGrossLe8TdrLongAll { get; set; } + + [JsonPropertyName("conc_gross_le_8_tdr_short_all")] + public double ConcGrossLe8TdrShortAll { get; set; } + + [JsonPropertyName("conc_net_le_4_tdr_long_all")] + public double ConcNetLe4TdrLongAll { get; set; } + + [JsonPropertyName("conc_net_le_4_tdr_short_all")] + public double ConcNetLe4TdrShortAll { get; set; } + + [JsonPropertyName("conc_net_le_8_tdr_long_all")] + public double ConcNetLe8TdrLongAll { get; set; } + + [JsonPropertyName("conc_net_le_8_tdr_short_all")] + public double ConcNetLe8TdrShortAll { get; set; } + + [JsonPropertyName("conc_gross_le_4_tdr_long_ol")] + public double ConcGrossLe4TdrLongOl { get; set; } + + [JsonPropertyName("conc_gross_le_4_tdr_short_ol")] + public double ConcGrossLe4TdrShortOl { get; set; } + + [JsonPropertyName("conc_gross_le_8_tdr_long_ol")] + public double ConcGrossLe8TdrLongOl { get; set; } + + [JsonPropertyName("conc_gross_le_8_tdr_short_ol")] + public double ConcGrossLe8TdrShortOl { get; set; } + + [JsonPropertyName("conc_net_le_4_tdr_long_ol")] + public double ConcNetLe4TdrLongOl { get; set; } + + [JsonPropertyName("conc_net_le_4_tdr_short_ol")] + public double ConcNetLe4TdrShortOl { get; set; } + + [JsonPropertyName("conc_net_le_8_tdr_long_ol")] + public double ConcNetLe8TdrLongOl { get; set; } + + [JsonPropertyName("conc_net_le_8_tdr_short_ol")] + public double ConcNetLe8TdrShortOl { get; set; } + + [JsonPropertyName("conc_gross_le_4_tdr_long_other")] + public int ConcGrossLe4TdrLongOther { get; set; } + + [JsonPropertyName("conc_gross_le_4_tdr_short_other")] + public int ConcGrossLe4TdrShortOther { get; set; } + + [JsonPropertyName("conc_gross_le_8_tdr_long_other")] + public int ConcGrossLe8TdrLongOther { get; set; } + + [JsonPropertyName("conc_gross_le_8_tdr_short_other")] + public int ConcGrossLe8TdrShortOther { get; set; } + + [JsonPropertyName("conc_net_le_4_tdr_long_other")] + public int ConcNetLe4TdrLongOther { get; set; } + + [JsonPropertyName("conc_net_le_4_tdr_short_other")] + public int ConcNetLe4TdrShortOther { get; set; } + + [JsonPropertyName("conc_net_le_8_tdr_long_other")] + public int ConcNetLe8TdrLongOther { get; set; } + + [JsonPropertyName("conc_net_le_8_tdr_short_other")] + public int ConcNetLe8TdrShortOther { get; set; } + + [JsonPropertyName("contract_units")] + public string ContractUnits { get; set; } + } +} diff --git a/FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs b/FinancialModelingPrepApi/Model/Crypto/CryptoHistoricalPriceListings.cs similarity index 100% rename from FinancialModelingPrepApi/Model/Crypto/CyptoHistoricalPriceListings.cs rename to FinancialModelingPrepApi/Model/Crypto/CryptoHistoricalPriceListings.cs diff --git a/Tests/AdvancedData/AdvancedDataTests.cs b/Tests/AdvancedData/AdvancedDataTests.cs index 0970146..1aa0ed0 100644 --- a/Tests/AdvancedData/AdvancedDataTests.cs +++ b/Tests/AdvancedData/AdvancedDataTests.cs @@ -3,6 +3,7 @@ using MatthiWare.FinancialModelingPrep.Model; using MatthiWare.FinancialModelingPrep.Model.AdvancedData; using Microsoft.Extensions.DependencyInjection; +using System.Linq; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -17,6 +18,7 @@ public CompanyValuationTests(ITestOutputHelper testOutput) : base(testOutput) { api = ServiceProvider.GetRequiredService(); } + [Fact] public async Task GetFinancialReportAnnualAsync() @@ -31,7 +33,7 @@ public async Task GetFinancialReportAnnualAsync() [Fact] public async Task GetFinancialScoreAsync() { - var result = await api.GetFinancialScore("AAPL"); + var result = await api.GetFinancialScoreAsync("AAPL"); result.AssertNoErrors(); Assert.Equal("AAPL", result.Data[0].Symbol); @@ -120,5 +122,15 @@ private Task> GetStandardI _ => null, }; } + + [Fact] + public async Task CommitmentOfTradersReportTest() + { + var result = await api.GetCommitmentOfTradersReportAsync("ES"); + + result.AssertNoErrors(); + Assert.NotEmpty(result.Data); + Assert.Equal("AAPL", result.Data.First().Symbol); + } } }