-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a method to get the spark chart info
- Loading branch information
Showing
9 changed files
with
135 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace OoplesFinance.YahooFinanceAPI.Helpers; | ||
|
||
internal class SparkChartHelper : YahooJsonBase | ||
{ | ||
/// <summary> | ||
/// Parses the raw json data for the Spark Chart data | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="jsonData"></param> | ||
/// <returns></returns> | ||
internal override IEnumerable<T> ParseYahooJsonData<T>(string jsonData) | ||
{ | ||
var sparkChartData = JsonSerializer.Deserialize<SparkChartData>(jsonData); | ||
|
||
return sparkChartData != null ? Enumerable.Cast<T>(new SparkInfo[] { sparkChartData.Result }) : Enumerable.Empty<T>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace OoplesFinance.YahooFinanceAPI.Models; | ||
|
||
public class SparkInfo | ||
{ | ||
[JsonPropertyName("timestamp")] | ||
public List<int?> Timestamp { get; set; } = new(); | ||
|
||
[JsonPropertyName("symbol")] | ||
public string Symbol { get; set; } = string.Empty; | ||
|
||
[JsonPropertyName("previousClose")] | ||
public object PreviousClose { get; set; } = new(); | ||
|
||
[JsonPropertyName("chartPreviousClose")] | ||
public double? ChartPreviousClose { get; set; } | ||
|
||
[JsonPropertyName("dataGranularity")] | ||
public int? DataGranularity { get; set; } | ||
|
||
[JsonPropertyName("end")] | ||
public object End { get; set; } = new(); | ||
|
||
[JsonPropertyName("start")] | ||
public object Start { get; set; } = new(); | ||
|
||
[JsonPropertyName("close")] | ||
public List<double?> Close { get; set; } = new(); | ||
} | ||
|
||
public class SparkChartData | ||
{ | ||
public SparkInfo Result { get; set; } = new(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters