Skip to content

Commit

Permalink
Fix properties not marked as nullable (#83)
Browse files Browse the repository at this point in the history
* Fix properties not marked as nullable

* Remove new ticker from quarterly
  • Loading branch information
Matthiee authored Feb 7, 2023
1 parent e4dce8c commit 3e2a1eb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class CompanyProfileResponse
public string Symbol { get; set; }

[JsonPropertyName("price")]
public double Price { get; set; }
public double? Price { get; set; }

[JsonPropertyName("beta")]
public double Beta { get; set; }
Expand All @@ -26,7 +26,7 @@ public class CompanyProfileResponse
public string Range { get; set; }

[JsonPropertyName("changes")]
public double Changes { get; set; }
public double? Changes { get; set; }

[JsonPropertyName("companyName")]
public string CompanyName { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class HistoricalPriceItem
public double Volume { get; set; }

[JsonPropertyName("unadjustedVolume")]
public double UnadjustedVolume { get; set; }
public double? UnadjustedVolume { get; set; }

[JsonPropertyName("change")]
public double Change { get; set; }
Expand Down
55 changes: 46 additions & 9 deletions Tests/CompanyValuation/CompanyValuationTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using MatthiWare.FinancialModelingPrep;
using MatthiWare.FinancialModelingPrep.Abstractions.CompanyValuation;
using MatthiWare.FinancialModelingPrep.Abstractions.CompanyValuation;
using MatthiWare.FinancialModelingPrep.Model;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -35,6 +33,13 @@ public async Task GetSymbolChangesAsyncTests()
[InlineData("AAPL")]
[InlineData("SPY")]
[InlineData("GSM")]
[InlineData("AGS.BR")]
[InlineData("PPL.TO")]
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("BZZUY")]
[InlineData("SWIR")]
public async Task GetCompanyProfileTests(string symbol)
{
var result = await api.GetCompanyProfileAsync(symbol);
Expand All @@ -46,7 +51,7 @@ public async Task GetCompanyProfileTests(string symbol)
[Theory]
[InlineData("AAPL", false)]
// [InlineData("BST", true, Skip = "IsFund returns incorrect result")]
public async Task GetCompanyProfile_IsFund_Tests(string symbol, bool isFund)
public async Task GetCompanyProfile_IsFund_Tests(string symbol, bool isFund)
{
var result = await api.GetCompanyProfileAsync(symbol);

Expand Down Expand Up @@ -122,10 +127,17 @@ public async Task GetSymbolsWithFinancialStatementsAsync()
}

[Theory]
[InlineData("AAPL")]
[InlineData("AGS.BR")]
[InlineData("NNN")]
[InlineData("UGI")]
[InlineData("AAPL")]
[InlineData("GSM")]
[InlineData("AGS.BR")]
[InlineData("PPL.TO")]
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("BZZUY")]
[InlineData("SWIR")]
public async Task GetEnterpriseValue(string symbol)
{
var result = await api.GetEnterpriseValueAsync(symbol, Period.Annual, 5);
Expand All @@ -144,6 +156,9 @@ public async Task GetEnterpriseValue(string symbol)
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("GSM")]
[InlineData("BZZUY")]
[InlineData("SWIR")]
public async Task GetIncomeStatement(string symbol)
{
var result = await api.GetIncomeStatementAsync(symbol, Period.Annual, 10000);
Expand All @@ -161,6 +176,9 @@ public async Task GetIncomeStatement(string symbol)
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("GSM")]

[InlineData("SWIR")]
public async Task GetIncomeStatementPerQuarter(string symbol)
{
var result = await api.GetIncomeStatementAsync(symbol, Period.Quarter, limit: 10000);
Expand All @@ -178,6 +196,9 @@ public async Task GetIncomeStatementPerQuarter(string symbol)
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("GSM")]
[InlineData("BZZUY")]
[InlineData("SWIR")]
public async Task GetCashFlowStatement(string symbol)
{
var result = await api.GetCashFlowStatementAsync(symbol, Period.Annual, 10000);
Expand All @@ -195,6 +216,8 @@ public async Task GetCashFlowStatement(string symbol)
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("GSM")]
[InlineData("SWIR")]
public async Task GetCashFlowStatementPerQuarter(string symbol)
{
var result = await api.GetCashFlowStatementAsync(symbol, Period.Quarter, limit: 10000);
Expand All @@ -212,6 +235,9 @@ public async Task GetCashFlowStatementPerQuarter(string symbol)
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("GSM")]
[InlineData("BZZUY")]
[InlineData("SWIR")]
public async Task GetBalanceSheetStatement(string symbol)
{
var result = await api.GetBalanceSheetStatementAsync(symbol, Period.Annual, 10000);
Expand All @@ -229,6 +255,8 @@ public async Task GetBalanceSheetStatement(string symbol)
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("GSM")]
[InlineData("SWIR")]
public async Task GetBalanceSheetStatementPerQuarter(string symbol)
{
var result = await api.GetBalanceSheetStatementAsync(symbol, Period.Quarter, limit: 10000);
Expand Down Expand Up @@ -336,6 +364,15 @@ public async Task GetRatiosTTMAsync(string symbol)
[InlineData("PPL.TO")]
[InlineData("WDP.BR")]
[InlineData("ENX.PA")]
[InlineData("NNN")]
[InlineData("UGI")]
[InlineData("SPY")]
[InlineData("GSM")]
[InlineData("TSLA")]
[InlineData("AAP")]
[InlineData("MTG")]
[InlineData("BZZUY")]
[InlineData("SWIR")]
public async Task GetCompanyKeyMetricsTTMAsync(string symbol)
{
var result = await api.GetCompanyKeyMetricsTTMAsync(symbol);
Expand All @@ -348,9 +385,9 @@ public async Task GetCompanyKeyMetricsTTMAsync(string symbol)
[InlineData("AGS.BR", Period.Quarter)]
[InlineData("CMCSA", Period.Quarter)]
[InlineData("PINE", Period.Quarter)]
[InlineData("LGEN.L", Period.Quarter)]
[InlineData("LGEN.L", Period.Quarter)]
[InlineData("WDP.BR", Period.Quarter)]
[InlineData("ADM.L", Period.Quarter)]
[InlineData("ADM.L", Period.Quarter)]
[InlineData("PPL.TO", Period.Quarter)]
[InlineData("AAPL", Period.Annual)]
[InlineData("PPL.TO", Period.Annual)]
Expand Down Expand Up @@ -480,7 +517,7 @@ public async Task GetPressReleasesAsync()

public static IEnumerable<object[]> AvailableExchanges
{
get
get
{
foreach (var enumValue in Enum.GetValues<Exchange>())
{
Expand Down
16 changes: 16 additions & 0 deletions Tests/StockTimeSeries/StockTimeSeriesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ public async Task GetHistoricalDailyPricesAsync()
Assert.Equal(123.85, split.Low, 2);
}

[Theory]
[InlineData("AMD")]
[InlineData("O")]
[InlineData("BZZUY")]
[InlineData("SWIR")]
[InlineData("PPL.TO")]
[InlineData("LGEN.L")]
[InlineData("AGS.BR")]
public async Task GetHistoricalDailyPricesAsync_2(string ticker)
{
var result = await api.GetHistoricalDailyPricesAsync(ticker);

result.AssertNoErrors();
Assert.NotEmpty(result.Data.Historical);
}

[Fact]
public async Task GetHistoricalDailyPricesUsingFromToAsync()
{
Expand Down

0 comments on commit 3e2a1eb

Please sign in to comment.