Yahoo Finance的JSON Deserialize

資料型態不保證完全正確,但目前至少可以解析Yahoo Finance的資料。

 

class PoCo_YahooFinance
{
    public PoCo_YahooFinance_Chart chart { get; set; }
}

class PoCo_YahooFinance_Chart
{
    public List<PoCo_YahooFinance_Result> result { get; set; }
    public string error { get; set; }
}

class PoCo_YahooFinance_Result
{
    public PoCo_YahooFinance_Meta meta { get; set; }
    public List<long> timestamp { get; set; }
    public PoCo_YahooFinance_Indicators indicators { get; set; }
}

class PoCo_YahooFinance_Meta
{
    public string currency { get; set; }
    public string symbol { get; set; }
    public string exchangeName { get; set; }
    public string instrumentType { get; set; }
    public long? firstTradeDate { get; set; } //allow nullable
    public long? regularMarketTime { get; set; } //allow nullable
    public int gmtoffset { get; set; }
    public string timezone { get; set; }
    public string exchangeTimezoneName { get; set; }
    public decimal? regularMarketPrice { get; set; } //allow nullable
    public decimal? chartPreviousClose { get; set; } //allow nullable
    public decimal? previousClose { get; set; } //allow nullable
    public int? scale { get; set; } //allow nullable
    public int? priceHint { get; set; } //allow nullable
    public PoCo_YahooFinance_CurrentTradingPeriod currentTradingPeriod { get; set; }
    public List<List<PoCo_YahooFinance_TradingPeriod_Unit>> tradingPeriods { get; set; }
    public string dataGranularity { get; set; }
    public string range { get; set; }
    public List<string> validRanges { get; set; }
}

class PoCo_YahooFinance_CurrentTradingPeriod
{
    PoCo_YahooFinance_TradingPeriod_Unit pre { get; set; }
    PoCo_YahooFinance_TradingPeriod_Unit regular { get; set; }
    PoCo_YahooFinance_TradingPeriod_Unit post { get; set; }
}

class PoCo_YahooFinance_TradingPeriod_Unit
{
    public string timezone { get; set; }
    public long start { get; set; }
    public long end { get; set; }
    public int gmtoffset { get; set; }
}

class PoCo_YahooFinance_Indicators
{
    public List<PoCo_YahooFinance_Quote> quote { get; set; }
}

class PoCo_YahooFinance_Quote
{
    public List<int?> volume { get; set; } //allow nullable
    public List<decimal?> high { get; set; } //allow nullable
    public List<decimal?> close { get; set; } //allow nullable
    public List<decimal?> low { get; set; } //allow nullable
    public List<decimal?> open { get; set; } //allow nullable
}