filters

package
v1.4.1-rc-151 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bod

func Bod(t time.Time, timezone string) (time.Time, error)

Bod - gives you today's beginning of day

func CVI

func CVI(sigma1 float64, sigma2 float64, t1 float64, t2 float64, year int) (float64, error)

CVI computes the crypto volatility index

func CVIFiltering

func CVIFiltering(computedCVIs scrapers.ComputedCVIs, filteredCVIs chan<- scrapers.ComputedCVI)

CVIFiltering is the actual filtering algorithm; computedCVIs is the channel through which we receive the calculated CVIs, filteredCVIs is the channel through which we send the filtered CVIs

func CVIToDatastore

func CVIToDatastore(value float64) error

func CVIsFromDatastore

func CVIsFromDatastore(starttime time.Time, endtime time.Time) ([]dia.CviDataPoint, error)

func CalculateForwardIndex

func CalculateForwardIndex(strikePrice, roi, time, callprice, putprice float64) float64

func CalculateT

func CalculateT(settlementMinutes float64, tmod float64) float64

func ETHCVIToDatastore

func ETHCVIToDatastore(value float64) error

func Eod

func Eod(t time.Time, timezone string) (time.Time, error)

Eod - gives you t's midnight time

func ForwardIndexLevel

func ForwardIndexLevel(optionsMeta []dia.OptionMetaForward, r float64, t float64) (float64, error)

ForwardIndexLevel calculates the forward level; used to compute the forward level for near-term & next-term options; r - risk free rate; t - time to expiration; LaTeX equation for the forward index level is: F_j = \texttt{Strike Price}_j + \exp{(R_j T)} \cdot (\texttt{Call Price}_j - \texttt{Put Price}_j)

func GetNear

func GetNear(optionsMeta []dia.OptionMeta) ([]dia.OptionMeta, error)

Return Option expiring in 25 days

func GetNearTermOptionMeta

func GetNearTermOptionMeta(baseCurrency string, expirationNextTerm time.Time) ([]dia.OptionMetaForward, error)

Find last option with expiration date before NextTermOption

func GetNext

func GetNext(optionsMeta []dia.OptionMeta) ([]dia.OptionMeta, error)

Expiring in greater than 10 days

func GetNextTermOptionMeta

func GetNextTermOptionMeta(baseCurrency string) ([]dia.OptionMetaForward, error)

Get the forward option meta information for near and next term

func GetOptionComponents

func GetOptionComponents(baseCurrency string) ([]dia.OptionMeta, error)

Retursn Option b/w 23 to 37 days of expirationss

func GetOptionMetaIndex

func GetOptionMetaIndex(baseCurrency string, maturityDate string) ([]dia.OptionMetaIndex, error)

func MinutesBetweenTwoDays

func MinutesBetweenTwoDays(t1 time.Time, t2 time.Time) (float64, error)

MinutesBetweenTwoDays - given two days: t1 and t2, this method calculates how many minutes there are between the midnight of t1 and the midnight of the day immediately before t2. So this is an exclusive time difference measured in minutes between the two dates. The order of the dates given does not matter.

func MinutesInYear

func MinutesInYear(year int) (float64, error)

MinutesInYear - returns how many minutes there were in a year

func MinutesUntilMidnight

func MinutesUntilMidnight(timezone string) (float64, error)

MinutesUntilMidnight - how many minutes until midnight

func MinutesUntilSettlement

func MinutesUntilSettlement(settlement scrapers.OptionSettlement, timezone string) (float64, error)

MinutesUntilSettlement - how many minutes from midnight until settlement; If on the settlement day, however and after midnight, then count how many minutes until settlement (rather than count how many minutes from midnight until settlement)

func TimeToMaturity

func TimeToMaturity(option dia.OptionMetaForward) float64

func TimeToMaturityTime

func TimeToMaturityTime(endtime time.Time) float64

func VarianceIndex

func VarianceIndex(optionsMeta []dia.OptionMetaIndex, r float64, t float64, f float64, k0 float64) (float64, error)

VarianceIndex is used to calculate variance for near term and next term options; later on these two values are used in interpolation to obtain a CVI value; r - risk free rate; t - time to expiration; f - forward index level; k0 - strike price just below the forward index level; LaTeX equation for the output of this function is: \sigma^2_j = \frac{1}{T_j} \left(2 \sum_i \frac{\Delta K_i}{K_i^2} \exp{(RT_j)} \cdot Q(K_i) - \left( \frac{F_j}{K_0} - 1 \right)^2 \right), \forall \ j \in \{1,2\}

Types

This section is empty.

Jump to

Keyboard shortcuts

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