security

package
v0.0.0-...-760d1f7 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(securities []Security, expiration string, p Params) (string, string)

Print writes a filtered set of options to CSV files

Types

type Contract

type Contract struct {
	// Received values
	Strike        float64
	Last          float64
	Bid           float64
	Ask           float64
	Expiration    string
	LastTradeDate time.Time
	LotSize       int
	OpenInterest  int64
	Delta         float64
	IV            float64
	// Derived values
	PriceBasisDelta float64 // Share price minus cost basis
	LastTradeDays   int64   // Age of last trade in days
	BidStrikeRatio  float64 // bid / strike
	BidPriceRatio   float64 // bid / strike
	SafetySpread    float64 // distance between share price and cost basis
	CallSpread      float64 // how many strikes out do calls still have bids
}

Contract holds option data for a single expiration date.

type DayRange

type DayRange struct {
	Date   string
	Open   float64
	High   float64
	Low    float64
	Close  float64
	Volume float64
}

DayRange represents a single (historical) trading day.

type Params

type Params struct {
	Initials        string
	MinPrice        float64
	MaxPrice        float64
	MinYield        float64
	MinSafetySpread float64
	MinCallSpread   float64
	MinIfCalled     float64
	Itm             bool
	CallCols        []string
	PutCols         []string
}

Params holds the parameters for each user's output preferences

type Security

type Security struct {
	Ticker         string
	Close          DayRange
	Price          float64 // latest price
	PriceChangePct float64 // percent change in price over trailing period
	Puts           []Contract
	Calls          []Contract
	EarningsDate   string
	PE             float64
}

Security holds data about a security and its option contracts

func (*Security) CallSpread

func (security *Security) CallSpread(expiration string) float64

CallSpread returns the relative distance to the highest OTM bid that is non-zero

func (*Security) HasOptions

func (security *Security) HasOptions() bool

HasOptions returns whether the security has both puts and calls

Jump to

Keyboard shortcuts

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