Skip to content

Commit f34af7c

Browse files
authored
Make timestamp, price nullable (#77)
* Make properties nullable * Fix failing tests * Make avg volume also double * Fix different error handling on FMP
1 parent 1b8f825 commit f34af7c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

FinancialModelingPrepApi/Core/Http/FinancialModelingPrepHttpClient.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class FinancialModelingPrepHttpClient
1818
private readonly ILogger<FinancialModelingPrepHttpClient> logger;
1919
private readonly JsonSerializerOptions jsonSerializerOptions;
2020
private const string EmptyArrayResponse = "[ ]";
21+
private const string EmptyArrayResponse2 = "[]";
2122
private const string ErrorMessageResponse = "Error Message";
2223

2324
public FinancialModelingPrepHttpClient(HttpClient client, FinancialModelingPrepOptions options,
@@ -64,7 +65,8 @@ public async Task<ApiResponse<string>> GetStringAsync(string urlPattern, NameVal
6465
return ApiResponse.FromError<string>(errorData.ErrorMessage);
6566
}
6667

67-
if (response.Data.Equals(EmptyArrayResponse, StringComparison.OrdinalIgnoreCase))
68+
if (response.Data.Equals(EmptyArrayResponse, StringComparison.OrdinalIgnoreCase) ||
69+
response.Data.Equals(EmptyArrayResponse2, StringComparison.OrdinalIgnoreCase))
6870
{
6971
return ApiResponse.FromError<string>("Invalid parameters");
7072
}

FinancialModelingPrepApi/Model/CompanyValuation/QuoteResponse.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public class QuoteResponse
4242
public double? PriceAvg200 { get; set; }
4343

4444
[JsonPropertyName("volume")]
45-
public long? Volume { get; set; }
45+
public double? Volume { get; set; }
4646

4747
[JsonPropertyName("avgVolume")]
48-
public long? AvgVolume { get; set; }
48+
public double? AvgVolume { get; set; }
4949

5050
[JsonPropertyName("exchange")]
5151
public string Exchange { get; set; }
@@ -66,9 +66,9 @@ public class QuoteResponse
6666
public string EarningsAnnouncement { get; set; }
6767

6868
[JsonPropertyName("sharesOutstanding")]
69-
public long? SharesOutstanding { get; set; }
69+
public double? SharesOutstanding { get; set; }
7070

7171
[JsonPropertyName("timestamp")]
72-
public int Timestamp { get; set; }
72+
public int? Timestamp { get; set; }
7373
}
7474
}

FinancialModelingPrepApi/Model/CompanyValuation/SymbolResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class SymbolResponse
1111
public string Name { get; set; }
1212

1313
[JsonPropertyName("price")]
14-
public double Price { get; set; }
14+
public double? Price { get; set; }
1515

1616
[JsonPropertyName("exchange")]
1717
public string Exchange { get; set; }

0 commit comments

Comments
 (0)