option

package
v0.1.51 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	Ask                 *float64  `json:"ask,omitempty" gorm:"type:double precision"`
	Bid                 *float64  `json:"bid,omitempty" gorm:"type:double precision"`
	CFICode             string    `json:"cfiCode,omitempty" gorm:"type:character varying"`
	Close               *float64  `json:"close,omitempty" gorm:"type:double precision"`
	ClosingPrice        *float64  `json:"closingPrice,omitempty" gorm:"type:double precision"`
	ContractDescription string    `json:"contractDescription,omitempty" gorm:"type:character varying"`
	ContractName        string    `json:"contractName,omitempty" gorm:"type:character varying"`
	ContractSize        float64   `json:"contractSize,omitempty" gorm:"type:double precision"`
	Currency            string    `json:"currency,omitempty" gorm:"type:character varying"`
	ExchangeCode        string    `json:"exchangeCode,omitempty" gorm:"type:character varying"`
	ExchangeMIC         string    `json:"exchangeMIC,omitempty" gorm:"type:character varying"`
	ExerciseStyle       style     `json:"exerciseStyle,omitempty" gorm:"type:option_style"`
	FIGI                string    `json:"figi,omitempty" gorm:"type:character varying"`
	High                *float64  `json:"high,omitempty" gorm:"type:double precision"`
	LastTrade           time.Time `json:"-"`
	LastUpdated         time.Time `json:"lastUpdated,omitempty" gorm:"primaryKey;type:date"`
	Low                 *float64  `json:"low,omitempty" gorm:"type:double precision"`
	MarginPrice         *float64  `json:"marginPrice,omitempty" gorm:"type:double precision"`
	Open                *float64  `json:"open,omitempty" gorm:"type:double precision"`
	OpenInterest        *uint     `json:"openInterest,omitempty" gorm:"type:double precision"`
	SettlementPrice     *float64  `json:"settlementPrice,omitempty" gorm:"type:double precision"`
	Symbol              string    `json:"symbol,omitempty" gorm:"primaryKey;type:character varying"`
	ExpirationDate      time.Time `json:"-" gorm:"primaryKey;type:date"`
	StrikePrice         float64   `json:"strikePrice,omitempty" gorm:"primaryKey;type:double precision"`
	Side                side      `json:"side,omitempty" gorm:"primaryKey;type:option_side"`
	IsAdjusted          bool      `json:"isAdjusted,omitempty" gorm:"primaryKey"`
	Type                oType     `json:"type,omitempty" gorm:"type:option_type"`
	Volume              *uint     `json:"volume,omitempty"`
	ID                  string    `json:"id,omitempty" gorm:"-"`
	Key                 string    `json:"key,omitempty" gorm:"-"`
	Subkey              string    `json:"subkey,omitempty" gorm:"-"`
	Date                time.Time `json:"-" gorm:"type:date"`
	Updated             time.Time `json:"-"`
}

Option represents a data point from the Options EOD endpoint. https://iexcloud.io/docs/api/#end-of-day-options Of all the date types, LastUpdated looks like the last day (ie date) the price was updated, where Updated looks to be the timestamp of the last release, which may be the next morning after LastUpdated

func GoldenOption

func GoldenOption() (o []Option)

GoldenOption returns golden data for the Option type

func (*Option) MarshalJSON

func (o *Option) MarshalJSON() ([]byte, error)

func (*Option) UnmarshalJSON

func (o *Option) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON satisfies the json.Unmarshaler interface. This function correctly translates the expirationDate and lastUpdated fields, which are specified as "YYYYMMDD" and "YYYY-MM-DD", respectively, into a time.Time by using time.Parse(). It will return an error if the JSON cannot be unmarshaled, but NOT if the lastUpdated parsing fails.

func (*Option) Validate

func (o *Option) Validate() error

Validate satisfies the Validator interface. It will return an error if the Date, Close or UClose fields are equal to their zero value.

type OptionOrig

type OptionOrig struct {
	Symbol         string    `json:"symbol"`
	ID             string    `json:"id"`
	ExpirationDate time.Time `json:"expirationDate"`
	ContractSize   int       `json:"contractSize"`
	StrikePrice    float64   `json:"strikePrice"`
	ClosingPrice   float64   `json:"closingPrice"`
	Side           string    `json:"side"`
	Type           string    `json:"type"`
	Volume         int       `json:"volume"`
	OpenInterest   int       `json:"openInterest"`
	Bid            float64   `json:"bid"`
	Ask            float64   `json:"ask"`
	LastUpdated    time.Time `json:"lastUpdated"`
	IsAdjusted     bool      `json:"isAdjusted"`
}

OptionOrig represents the original options data format. This schema was deprecated on Dec 1, 2020, and remains for compatibility because the new format makes breaking changes.

Jump to

Keyboard shortcuts

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