instruments

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MasterURL = "https://images.dhan.co/api-data/api-scrip-master.csv"

Variables

This section is empty.

Functions

func CheckAndDownload

func CheckAndDownload(ctx context.Context, path string) error

CheckAndDownload refreshes the master once the most recent 08:30 IST cutoff has passed. Before 08:30 it continues to use the previous day's file.

func GetExpiryDates

func GetExpiryDates(filter Filter) []time.Time

Types

type Filter

type Filter struct {
	Exchange              string
	Segment               string
	SecurityID            string
	Instrument            string
	ExpiryCode            *int
	TradingSymbol         string
	TradingSymbolContains string
	DisplayName           string
	DisplayNameContains   string
	ExpiryDate            *time.Time
	StrikePrice           *float64
	LotSize               *float64
	TickSize              *float64
	OptionType            string
	ExpiryFlag            string
	ExchangeInstrument    string
	Series                string
	SymbolName            string
}

Filter fields are combined with AND. String fields are case-insensitive exact matches; TradingSymbolContains and DisplayNameContains are partial matches.

type Instrument

type Instrument struct {
	Exchange           string
	Segment            string
	SecurityID         string
	Instrument         string
	ExpiryCode         int
	TradingSymbol      string
	LotSize            float64
	DisplayName        string
	ExpiryDate         time.Time
	StrikePrice        float64
	OptionType         string
	TickSize           float64
	ExpiryFlag         string
	ExchangeInstrument string
	Series             string
	SymbolName         string
}

Instrument is one row from Dhan's compact instrument master.

func FindInstruments

func FindInstruments(filter Filter) []Instrument

func Load

func Load(path string) ([]Instrument, error)

Load parses path and replaces the package's in-memory instrument list.

type OptionStrikes

type OptionStrikes struct {
	ATM  float64
	Up   []float64
	Down []float64
}

func GetOptionStrikes

func GetOptionStrikes(filter Filter, price float64, max int) OptionStrikes

Jump to

Keyboard shortcuts

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