forked from yonch/go-tdameritrade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchain_types.go
114 lines (107 loc) · 5.25 KB
/
chain_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package tdameritrade
// ChainsService handles communication with the chains related methods of
// the TDAmeritrade API.
//
// TDAmeritrade API docs: https://developer.tdameritrade.com/option-chains/apis
//easyjson:json
type ChainsService struct {
client *Client
}
// a float64 whose JSON unmarshaller supports NaN and Inf
type Float64WithSpecial float64
//easyjson:json
type Underlying struct {
Symbol string `json:"symbol"`
Description string `json:"description"`
Change float64 `json:"change"`
PercentChange float64 `json:"percentChange"`
Close float64 `json:"close"`
QuoteTime int `json:"quoteTime"`
TradeTime int `json:"tradeTime"`
Bid float64 `json:"bid"`
Ask float64 `json:"ask"`
Last float64 `json:"last"`
Mark float64 `json:"mark"`
MarkChange float64 `json:"markChange"`
MarkPercentChange float64 `json:"markPercentChange"`
BidSize int `json:"bidSize"`
AskSize int `json:"askSize"`
HighPrice float64 `json:"highPrice"`
LowPrice float64 `json:"lowPrice"`
OpenPrice float64 `json:"openPrice"`
TotalVolume int `json:"totalVolume"`
ExchangeName string `json:"exchangeName"`
FiftyTwoWeekHigh float64 `json:"fiftyTwoWeekHigh"`
FiftyTwoWeekLow float64 `json:"fiftyTwoWeekLow"`
Delayed bool `json:"delayed"`
}
//easyjson:json
type ExpDateOption struct {
PutCall string `json:"putCall"`
Symbol string `json:"symbol"`
Description string `json:"description"`
ExchangeName string `json:"exchangeName"`
Bid float64 `json:"bid"`
Ask float64 `json:"ask"`
Last float64 `json:"last"`
Mark float64 `json:"mark"`
BidSize int `json:"bidSize"`
AskSize int `json:"askSize"`
BidAskSize string `json:"bidAskSize"`
LastSize float64 `json:"lastSize"`
HighPrice float64 `json:"highPrice"`
LowPrice float64 `json:"lowPrice"`
OpenPrice float64 `json:"openPrice"`
ClosePrice float64 `json:"closePrice"`
TotalVolume int `json:"totalVolume"`
TradeDate string `json:"tradeDate"`
TradeTimeInLong int `json:"tradeTimeInLong"`
QuoteTimeInLong int `json:"quoteTimeInLong"`
NetChange float64 `json:"netChange"`
Volatility Float64WithSpecial `json:"volatility"`
Delta float64 `json:"delta"`
Gamma Float64WithSpecial `json:"gamma"`
Theta Float64WithSpecial `json:"theta"`
Vega Float64WithSpecial `json:"vega"`
Rho Float64WithSpecial `json:"rho"`
OpenInterest int `json:"openInterest"`
TimeValue float64 `json:"timeValue"`
TheoreticalOptionValue Float64WithSpecial `json:"theoreticalOptionValue"`
TheoreticalVolatility Float64WithSpecial `json:"theoreticalVolatility"`
OptionDeliverablesList string `json:"optionDeliverablesList"`
StrikePrice float64 `json:"strikePrice"`
ExpirationDate int `json:"expirationDate"`
DaysToExpiration int `json:"daysToExpiration"`
ExpirationType string `json:"expirationType"`
LastTradingDate int `json:"lastTradingDay"`
Multiplier float64 `json:"multiplier"`
SettlementType string `json:"settlementType"`
DeliverableNote string `json:"deliverableNote"`
IsIndexOption bool `json:"isIndexOption"`
PercentChange float64 `json:"percentChange"`
MarkChange float64 `json:"markChange"`
MarkPercentChange float64 `json:"markPercentChange"`
InTheMoney bool `json:"inTheMoney"`
Mini bool `json:"mini"`
NonStandard bool `json:"nonStandard"`
}
// the first string is the exp date. the second string is the strike price.
//easyjson:json
type ExpDateMap map[string]map[string][]ExpDateOption
//easyjson:json
type Chains struct {
Symbol string `json:"symbol"`
Status string `json:"status"`
Underlying Underlying `json:"underlying"`
Strategy string `json:"strategy"`
Interval float64 `json:"interval"`
IsDelayed bool `json:"isDelayed"`
IsIndex bool `json:"isIndex"`
InterestRate float64 `json:"interestRate"`
UnderlyingPrice float64 `json:"underlyingPrice"`
Volatility float64 `json:"volatility"`
DaysToExpiration float64 `json:"daysToExpiration"`
NumberOfContracts int `json:"numberOfContracts"`
CallExpDateMap ExpDateMap `json:"callExpDateMap"`
PutExpDateMap ExpDateMap `json:"putExpDateMap"`
}