Skip to content

Commit

Permalink
Update the batch response properties for the options API so the batch…
Browse files Browse the repository at this point in the history
… API is actually useful when working with options data. IEX Cloud API for the options endpoing is available at https://www.iexcloud.io/docs/api/#options (#69)

This is a follow up to #68
  • Loading branch information
biyimaks authored Oct 4, 2020
1 parent 4d5164b commit b3e16b9
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion IEXSharp/Model/CoreData/Batch/Response/BatchResponse.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using IEXSharp.Model.CoreData.News.Response;
using IEXSharp.Model.CoreData.Options.Response;
using IEXSharp.Model.CoreData.StockFundamentals.Response;
using IEXSharp.Model.CoreData.StockPrices.Response;
using IEXSharp.Model.CoreData.StockProfiles.Response;
Expand Down Expand Up @@ -70,7 +73,34 @@ public class BatchResponse
public LogoResponse Logo { get; set; }
public List<NewsResponse> News { get; set; }
public OHLCResponse Ohlc { get; set; }
public List<string> Options { get; set; }

[JsonPropertyName("options")]
public List<JsonElement> RawOptions { get; set; }

public List<OptionResponse> OptionContracts
{
get
{
return this.RawOptions != null
? this.RawOptions
.Select(option => JsonSerializer.Deserialize<OptionResponse>(option.GetRawText()))
.ToList()
: null;
}
}

public List<string> OptionExpirationDates
{
get
{
return this.RawOptions != null
? this.RawOptions
.Select(option => option.ToString())
.ToList()
: null;
}
}

public List<string> Peers { get; set; }

[JsonPropertyName("previous")]
Expand Down

0 comments on commit b3e16b9

Please sign in to comment.