options

package
v0.0.0-...-f36ee27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2021 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Single

func Single(strikes, fromDTE, toDTE int) url.Values

Types

type Client

type Client struct {
	*tdam.Client
}

func (*Client) GetChain

func (c *Client) GetChain(symbol string, options url.Values) (*OptionChain, error)

type EpochTime

type EpochTime time.Time

func (EpochTime) MarshalJSON

func (t EpochTime) MarshalJSON() ([]byte, error)

func (*EpochTime) UnmarshalJSON

func (t *EpochTime) UnmarshalJSON(b []byte) error

type ExpirationDate

type ExpirationDate string

func (ExpirationDate) DTE

func (e ExpirationDate) DTE() int

func (ExpirationDate) Date

func (e ExpirationDate) Date() time.Time

func (ExpirationDate) String

func (e ExpirationDate) String() string

type NaNableFloat64

type NaNableFloat64 float64

func (*NaNableFloat64) UnmarshalText

func (v *NaNableFloat64) UnmarshalText(b []byte) error

type Option

type Option struct {
	PutCall                string               `json:"putCall"`
	Symbol                 string               `json:"symbol"`
	Description            string               `json:"description"`
	ExchangeName           string               `json:"exchangeName"`
	BidPrice               float64              `json:"bid"`
	AskPrice               float64              `json:"ask"`
	LastPrice              float64              `json:"last"`
	MarkPrice              float64              `json:"mark"`
	BidSize                float64              `json:"bidSize"`
	AskSize                float64              `json:"askSize"`
	LastSize               float64              `json:"lastSize"`
	HighPrice              float64              `json:"highPrice"`
	LowPrice               float64              `json:"lowPrice"`
	OpenPrice              float64              `json:"openPrice"`
	ClosePrice             float64              `json:"closePrice"`
	TotalVolume            int64                `json:"totalVolume"`
	QuoteTimeInLong        float64              `json:"quoteTimeInLong"`
	TradeTimeInLong        float64              `json:"tradeTimeInLong"`
	NetChange              float64              `json:"netChange"`
	Volatility             float64              `json:"volatility"`
	Delta                  float64              `json:"delta"`
	Gamma                  float64              `json:"gamma"`
	Theta                  float64              `json:"theta"`
	Vega                   float64              `json:"vega"`
	Rho                    float64              `json:"rho"`
	TimeValue              float64              `json:"timeValue"`
	OpenInterest           float64              `json:"openInterest"`
	IsInTheMoney           bool                 `json:"isInTheMoney"`
	TheoreticalOptionValue float64              `json:"theoreticalOptionValue"`
	TheoreticalVolatility  float64              `json:"theoreticalVolatility"`
	IsMini                 bool                 `json:"isMini"`
	IsNonStandard          bool                 `json:"isNonStandard"`
	OptionDeliverablesList []OptionDeliverables `json:"optionDeliverablesList"`
	StrikePrice            float64              `json:"strikePrice"`
	ExpirationDate         EpochTime            `json:"expirationDate"`
	ExpirationType         string               `json:"expirationType"`
	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"`
}

type OptionChain

type OptionChain 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"`
	DaysToExpiration float64                      `json:"daysToExpiration"`
	InterestRate     float64                      `json:"interestRate"`
	UnderlyingPrice  float64                      `json:"underlyingPrice"`
	Volatility       float64                      `json:"volatility"`
	RawCalls         map[ExpirationDate]StrikeMap `json:"callExpDateMap"`
	RawPuts          map[ExpirationDate]StrikeMap `json:"putExpDateMap"`
}

func (*OptionChain) ExpirationDates

func (c *OptionChain) ExpirationDates() []ExpirationDate

func (*OptionChain) NearestDTE

func (ch *OptionChain) NearestDTE(target int) ExpirationDate

func (*OptionChain) StrikeTable

func (c *OptionChain) StrikeTable(exp ExpirationDate) StrikeTable

type OptionDeliverables

type OptionDeliverables struct {
	Symbol           string `json:"symbol"`
	AssetType        string `json:"assetType"`
	DeliverableUnits string `json:"deliverableUnits"`
	CurrencyType     string `json:"currencyType"`
}

type Strike

type Strike struct {
	Price StrikePrice
	Call  []Option // it's possible to get multiple exchanges' orderbook
	Put   []Option
}

func (Strike) DeltaAbove

func (s Strike) DeltaAbove(d float64) bool

func (Strike) DeltaBelow

func (s Strike) DeltaBelow(d float64) bool

func (Strike) DeltaBetween

func (s Strike) DeltaBetween(a, b float64) bool

func (Strike) DistToDelta

func (s Strike) DistToDelta(d float64) float64

type StrikeMap

type StrikeMap map[StrikePrice][]Option

type StrikePrice

type StrikePrice float64

func (StrikePrice) String

func (s StrikePrice) String() string

func (*StrikePrice) UnmarshalText

func (v *StrikePrice) UnmarshalText(b []byte) error

type StrikeTable

type StrikeTable []Strike

func (StrikeTable) NearestToDelta

func (s StrikeTable) NearestToDelta(d float64) (put, call Strike)

type Underlying

type Underlying struct {
	Ask               float64 `json:"ask"`
	AskSize           int     `json:"askSize"`
	Bid               float64 `json:"bid"`
	BidSize           float64 `json:"bidSize"`
	Change            float64 `json:"change"`
	Close             float64 `json:"close"`
	Delayed           bool    `json:"delayed"`
	Description       string  `json:"description"`
	ExchangeName      string  `json:"exchangeName"`
	FiftyTwoWeekHigh  float64 `json:"fiftyTwoWeekHigh"`
	FiftyTwoWeekLow   float64 `json:"fiftyTwoWeekLow"`
	HighPrice         float64 `json:"highPrice"`
	Last              float64 `json:"last"`
	LowPrice          float64 `json:"lowPrice"`
	Mark              float64 `json:"mark"`
	MarkChange        float64 `json:"markChange"`
	MarkPercentChange float64 `json:"markPercentChange"`
	OpenPrice         float64 `json:"openPrice"`
	PercentChange     float64 `json:"percentChange"`
	QuoteTime         float64 `json:"quoteTime"`
	Symbol            string  `json:"symbol"`
	TotalVolume       int64   `json:"totalVolume"`
	TradeTime         int64   `json:"tradeTime"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL