pricing

package
v0.0.0-...-db14c7d Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Tick   = int64(1000)
	Second = int64(1000)
	Minute = Second * 60
	Hour   = Minute * 60
	Day    = Hour * 24
	Week   = Day * 7
	Month  = Day * 30
	Year   = Day * 365
)

Variables

View Source
var HighResolution = SortDurations([]int64{

	Second,
	Second * 3,
	Second * 5,
	Second * 10,
	Second * 15,
	Second * 30,
	Minute,
	Minute * 2,
	Minute * 3,
	Minute * 5,
	Minute * 10,
	Minute * 15,
	Minute * 30,
	Hour,
	Hour * 4,
	Hour * 6,
	Hour * 8,
	Hour * 12,
})

Functions

func IsTimeAligned

func IsTimeAligned(now int64, duration int64) bool

func SortDurations

func SortDurations(durations []int64) []int64

func Truncate

func Truncate(f float64, unit float64) float64

Types

type Bar

type Bar struct {
	// contains filtered or unexported fields
}

func NewBar

func NewBar(o, h, l, c float64) *Bar

func (*Bar) Ask

func (s *Bar) Ask() *Candle

func (*Bar) Bid

func (s *Bar) Bid() *Candle

func (*Bar) Bytes

func (s *Bar) Bytes() []byte

func (*Bar) Clone

func (s *Bar) Clone() *Bar

func (*Bar) Greeks

func (s *Bar) Greeks() *Greeks

func (*Bar) Liquidations

func (s *Bar) Liquidations() *Liquidations

func (*Bar) MarshalBinary

func (s *Bar) MarshalBinary() ([]byte, error)

func (*Bar) MarshalBinaryTo

func (s *Bar) MarshalBinaryTo(b []byte) []byte

func (*Bar) MarshalMap

func (s *Bar) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Bar) Mut

func (s *Bar) Mut() *BarMut

func (*Bar) Precision

func (s *Bar) Precision() float64

func (*Bar) Price

func (s *Bar) Price() *Candle

func (*Bar) Read

func (s *Bar) Read(b []byte) (n int, err error)

func (*Bar) ReadFrom

func (s *Bar) ReadFrom(r io.Reader) (int64, error)

func (*Bar) Spread

func (s *Bar) Spread() *Spread

func (*Bar) String

func (s *Bar) String() string

func (*Bar) Ticks

func (s *Bar) Ticks() int64

func (*Bar) Time

func (s *Bar) Time() *Time

func (*Bar) Trades

func (s *Bar) Trades() *Trades

func (*Bar) UnmarshalBinary

func (s *Bar) UnmarshalBinary(b []byte) error

func (*Bar) Volume

func (s *Bar) Volume() *Volume

func (*Bar) WriteTo

func (s *Bar) WriteTo(w io.Writer) (int64, error)

type BarMut

type BarMut struct {
	Bar
}

func (*BarMut) Ask

func (s *BarMut) Ask() *CandleMut

func (*BarMut) Bid

func (s *BarMut) Bid() *CandleMut

func (*BarMut) Clone

func (s *BarMut) Clone() *BarMut

func (*BarMut) Freeze

func (s *BarMut) Freeze() *Bar

func (*BarMut) Greeks

func (s *BarMut) Greeks() *GreeksMut

func (*BarMut) Liquidations

func (s *BarMut) Liquidations() *LiquidationsMut

func (*BarMut) Price

func (s *BarMut) Price() *CandleMut

func (*BarMut) SetAsk

func (s *BarMut) SetAsk(v *Candle) *BarMut

func (*BarMut) SetBid

func (s *BarMut) SetBid(v *Candle) *BarMut

func (*BarMut) SetGreeks

func (s *BarMut) SetGreeks(v *Greeks) *BarMut

func (*BarMut) SetLiquidations

func (s *BarMut) SetLiquidations(v *Liquidations) *BarMut

func (*BarMut) SetPrecision

func (s *BarMut) SetPrecision(v float64) *BarMut

func (*BarMut) SetPrice

func (s *BarMut) SetPrice(v *Candle) *BarMut

func (*BarMut) SetSpread

func (s *BarMut) SetSpread(v *Spread) *BarMut

func (*BarMut) SetTicks

func (s *BarMut) SetTicks(v int64) *BarMut

func (*BarMut) SetTime

func (s *BarMut) SetTime(v *Time) *BarMut

func (*BarMut) SetTrades

func (s *BarMut) SetTrades(v *Trades) *BarMut

func (*BarMut) SetVolume

func (s *BarMut) SetVolume(v *Volume) *BarMut

func (*BarMut) Spread

func (s *BarMut) Spread() *SpreadMut

func (*BarMut) Time

func (s *BarMut) Time() *TimeMut

func (*BarMut) Trades

func (s *BarMut) Trades() *TradesMut

func (*BarMut) Truncate

func (b *BarMut) Truncate() *BarMut

func (*BarMut) Volume

func (s *BarMut) Volume() *VolumeMut

type Candle

type Candle struct {
	// contains filtered or unexported fields
}

Candlestick

func NewCandle

func NewCandle(open, high, low, close float64) *Candle

func (*Candle) Bytes

func (s *Candle) Bytes() []byte

func (*Candle) Clone

func (s *Candle) Clone() *Candle

func (*Candle) Close

func (s *Candle) Close() float64

func (*Candle) High

func (s *Candle) High() float64

func (*Candle) Low

func (s *Candle) Low() float64

func (*Candle) MarshalBinary

func (s *Candle) MarshalBinary() ([]byte, error)

func (*Candle) MarshalBinaryTo

func (s *Candle) MarshalBinaryTo(b []byte) []byte

func (*Candle) MarshalMap

func (s *Candle) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Candle) Mut

func (s *Candle) Mut() *CandleMut

func (*Candle) Open

func (s *Candle) Open() float64

func (*Candle) Read

func (s *Candle) Read(b []byte) (n int, err error)

func (*Candle) ReadFrom

func (s *Candle) ReadFrom(r io.Reader) (int64, error)

func (*Candle) String

func (s *Candle) String() string

func (*Candle) UnmarshalBinary

func (s *Candle) UnmarshalBinary(b []byte) error

func (*Candle) WriteTo

func (s *Candle) WriteTo(w io.Writer) (int64, error)

type CandleMut

type CandleMut struct {
	Candle
}

Candlestick

func (*CandleMut) AddPrice

func (c *CandleMut) AddPrice(price float64)

func (*CandleMut) Append

func (c *CandleMut) Append(o *Candle)

func (*CandleMut) Clone

func (c *CandleMut) Clone() *CandleMut

func (*CandleMut) Freeze

func (c *CandleMut) Freeze() *Candle

func (*CandleMut) SetClose

func (c *CandleMut) SetClose(v float64) *CandleMut

func (*CandleMut) SetHigh

func (c *CandleMut) SetHigh(v float64) *CandleMut

func (*CandleMut) SetLow

func (c *CandleMut) SetLow(v float64) *CandleMut

func (*CandleMut) SetOpen

func (c *CandleMut) SetOpen(v float64) *CandleMut

func (*CandleMut) Truncate

func (c *CandleMut) Truncate(precision float64)

type Duration

type Duration int64

type Greeks

type Greeks struct {
	// contains filtered or unexported fields
}

Greeks are financial measures of the sensitivity of an option’s price to its underlying determining parameters, such as volatility or the price of the underlying asset. The Greeks are utilized in the analysis of an options portfolio and in sensitivity analysis of an option or portfolio of options. The measures are considered essential by many investors for making informed decisions in options trading.

Delta, Gamma, Vega, Theta, and Rho are the key option Greeks. However, there are many other option Greeks that can be derived from those mentioned above.

func (*Greeks) Bytes

func (s *Greeks) Bytes() []byte

func (*Greeks) Clone

func (s *Greeks) Clone() *Greeks

func (*Greeks) Delta

func (s *Greeks) Delta() float64

func (*Greeks) Gamma

func (s *Greeks) Gamma() float64

func (*Greeks) Iv

func (s *Greeks) Iv() float64

func (*Greeks) MarshalBinary

func (s *Greeks) MarshalBinary() ([]byte, error)

func (*Greeks) MarshalBinaryTo

func (s *Greeks) MarshalBinaryTo(b []byte) []byte

func (*Greeks) MarshalMap

func (s *Greeks) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Greeks) Mut

func (s *Greeks) Mut() *GreeksMut

func (*Greeks) Read

func (s *Greeks) Read(b []byte) (n int, err error)

func (*Greeks) ReadFrom

func (s *Greeks) ReadFrom(r io.Reader) (int64, error)

func (*Greeks) Rho

func (s *Greeks) Rho() float64

func (*Greeks) String

func (s *Greeks) String() string

func (*Greeks) Theta

func (s *Greeks) Theta() float64

func (*Greeks) UnmarshalBinary

func (s *Greeks) UnmarshalBinary(b []byte) error

func (*Greeks) Vega

func (s *Greeks) Vega() float64

func (*Greeks) WriteTo

func (s *Greeks) WriteTo(w io.Writer) (int64, error)

type GreeksMut

type GreeksMut struct {
	Greeks
}

Greeks are financial measures of the sensitivity of an option’s price to its underlying determining parameters, such as volatility or the price of the underlying asset. The Greeks are utilized in the analysis of an options portfolio and in sensitivity analysis of an option or portfolio of options. The measures are considered essential by many investors for making informed decisions in options trading.

Delta, Gamma, Vega, Theta, and Rho are the key option Greeks. However, there are many other option Greeks that can be derived from those mentioned above.

func (*GreeksMut) Clone

func (s *GreeksMut) Clone() *GreeksMut

func (*GreeksMut) Freeze

func (s *GreeksMut) Freeze() *Greeks

func (*GreeksMut) SetDelta

func (s *GreeksMut) SetDelta(v float64) *GreeksMut

func (*GreeksMut) SetGamma

func (s *GreeksMut) SetGamma(v float64) *GreeksMut

func (*GreeksMut) SetIv

func (s *GreeksMut) SetIv(v float64) *GreeksMut

func (*GreeksMut) SetRho

func (s *GreeksMut) SetRho(v float64) *GreeksMut

func (*GreeksMut) SetTheta

func (s *GreeksMut) SetTheta(v float64) *GreeksMut

func (*GreeksMut) SetVega

func (s *GreeksMut) SetVega(v float64) *GreeksMut

type Liquidations

type Liquidations struct {
	// contains filtered or unexported fields
}

func (*Liquidations) Avg

func (s *Liquidations) Avg() float64

func (*Liquidations) Buys

func (s *Liquidations) Buys() float64

func (*Liquidations) Bytes

func (s *Liquidations) Bytes() []byte

func (*Liquidations) Clone

func (s *Liquidations) Clone() *Liquidations

func (*Liquidations) MarshalBinary

func (s *Liquidations) MarshalBinary() ([]byte, error)

func (*Liquidations) MarshalBinaryTo

func (s *Liquidations) MarshalBinaryTo(b []byte) []byte

func (*Liquidations) MarshalMap

func (s *Liquidations) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Liquidations) Max

func (s *Liquidations) Max() float64

func (*Liquidations) Min

func (s *Liquidations) Min() float64

func (*Liquidations) Mut

func (s *Liquidations) Mut() *LiquidationsMut

func (*Liquidations) Read

func (s *Liquidations) Read(b []byte) (n int, err error)

func (*Liquidations) ReadFrom

func (s *Liquidations) ReadFrom(r io.Reader) (int64, error)

func (*Liquidations) Sells

func (s *Liquidations) Sells() float64

func (*Liquidations) String

func (s *Liquidations) String() string

func (*Liquidations) Trades

func (s *Liquidations) Trades() int64

func (*Liquidations) UnmarshalBinary

func (s *Liquidations) UnmarshalBinary(b []byte) error

func (*Liquidations) Value

func (s *Liquidations) Value() float64

func (*Liquidations) WriteTo

func (s *Liquidations) WriteTo(w io.Writer) (int64, error)

type LiquidationsMut

type LiquidationsMut struct {
	Liquidations
}

func (*LiquidationsMut) Clone

func (s *LiquidationsMut) Clone() *LiquidationsMut

func (*LiquidationsMut) Freeze

func (s *LiquidationsMut) Freeze() *Liquidations

func (*LiquidationsMut) SetAvg

func (s *LiquidationsMut) SetAvg(v float64) *LiquidationsMut

func (*LiquidationsMut) SetBuys

func (s *LiquidationsMut) SetBuys(v float64) *LiquidationsMut

func (*LiquidationsMut) SetMax

func (s *LiquidationsMut) SetMax(v float64) *LiquidationsMut

func (*LiquidationsMut) SetMin

func (s *LiquidationsMut) SetMin(v float64) *LiquidationsMut

func (*LiquidationsMut) SetSells

func (s *LiquidationsMut) SetSells(v float64) *LiquidationsMut

func (*LiquidationsMut) SetTrades

func (s *LiquidationsMut) SetTrades(v int64) *LiquidationsMut

func (*LiquidationsMut) SetValue

func (s *LiquidationsMut) SetValue(v float64) *LiquidationsMut

type Spread

type Spread struct {
	// contains filtered or unexported fields
}

func (*Spread) Bytes

func (s *Spread) Bytes() []byte

func (*Spread) Clone

func (s *Spread) Clone() *Spread

func (*Spread) High

func (s *Spread) High() float64

func (*Spread) Low

func (s *Spread) Low() float64

func (*Spread) MarshalBinary

func (s *Spread) MarshalBinary() ([]byte, error)

func (*Spread) MarshalBinaryTo

func (s *Spread) MarshalBinaryTo(b []byte) []byte

func (*Spread) MarshalMap

func (s *Spread) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Spread) Mid

func (s *Spread) Mid() float64

func (*Spread) Mut

func (s *Spread) Mut() *SpreadMut

func (*Spread) Read

func (s *Spread) Read(b []byte) (n int, err error)

func (*Spread) ReadFrom

func (s *Spread) ReadFrom(r io.Reader) (int64, error)

func (*Spread) String

func (s *Spread) String() string

func (*Spread) UnmarshalBinary

func (s *Spread) UnmarshalBinary(b []byte) error

func (*Spread) WriteTo

func (s *Spread) WriteTo(w io.Writer) (int64, error)

type SpreadMut

type SpreadMut struct {
	Spread
}

func (*SpreadMut) Add

func (s *SpreadMut) Add(v float64) *SpreadMut

func (*SpreadMut) Append

func (s *SpreadMut) Append(v *Spread) *SpreadMut

func (*SpreadMut) Clone

func (s *SpreadMut) Clone() *SpreadMut

func (*SpreadMut) Freeze

func (s *SpreadMut) Freeze() *Spread

func (*SpreadMut) SetHigh

func (s *SpreadMut) SetHigh(v float64) *SpreadMut

func (*SpreadMut) SetLow

func (s *SpreadMut) SetLow(v float64) *SpreadMut

func (*SpreadMut) SetMid

func (s *SpreadMut) SetMid(v float64) *SpreadMut

func (*SpreadMut) Truncate

func (s *SpreadMut) Truncate(precision float64) *SpreadMut

type Time

type Time struct {
	// contains filtered or unexported fields
}

func (*Time) Bytes

func (s *Time) Bytes() []byte

func (*Time) Clone

func (s *Time) Clone() *Time

func (*Time) Duration

func (s *Time) Duration() int64

func (*Time) End

func (s *Time) End() int64

func (*Time) MarshalBinary

func (s *Time) MarshalBinary() ([]byte, error)

func (*Time) MarshalBinaryTo

func (s *Time) MarshalBinaryTo(b []byte) []byte

func (*Time) MarshalMap

func (s *Time) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Time) Mut

func (s *Time) Mut() *TimeMut

func (*Time) Read

func (s *Time) Read(b []byte) (n int, err error)

func (*Time) ReadFrom

func (s *Time) ReadFrom(r io.Reader) (int64, error)

func (*Time) Start

func (s *Time) Start() int64

func (*Time) String

func (s *Time) String() string

func (*Time) UnmarshalBinary

func (s *Time) UnmarshalBinary(b []byte) error

func (*Time) WriteTo

func (s *Time) WriteTo(w io.Writer) (int64, error)

type TimeMut

type TimeMut struct {
	Time
}

func (*TimeMut) Clone

func (s *TimeMut) Clone() *TimeMut

func (*TimeMut) Freeze

func (s *TimeMut) Freeze() *Time

func (*TimeMut) SetDuration

func (s *TimeMut) SetDuration(v int64) *TimeMut

func (*TimeMut) SetEnd

func (s *TimeMut) SetEnd(v int64) *TimeMut

func (*TimeMut) SetStart

func (s *TimeMut) SetStart(v int64) *TimeMut

type Trades

type Trades struct {
	// contains filtered or unexported fields
}

func (*Trades) Bytes

func (s *Trades) Bytes() []byte

func (*Trades) Clone

func (s *Trades) Clone() *Trades

func (*Trades) Count

func (s *Trades) Count() int64

func (*Trades) MarshalBinary

func (s *Trades) MarshalBinary() ([]byte, error)

func (*Trades) MarshalBinaryTo

func (s *Trades) MarshalBinaryTo(b []byte) []byte

func (*Trades) MarshalMap

func (s *Trades) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Trades) Max

func (s *Trades) Max() int64

func (*Trades) Min

func (s *Trades) Min() int64

func (*Trades) Mut

func (s *Trades) Mut() *TradesMut

func (*Trades) Read

func (s *Trades) Read(b []byte) (n int, err error)

func (*Trades) ReadFrom

func (s *Trades) ReadFrom(r io.Reader) (int64, error)

func (*Trades) String

func (s *Trades) String() string

func (*Trades) UnmarshalBinary

func (s *Trades) UnmarshalBinary(b []byte) error

func (*Trades) WriteTo

func (s *Trades) WriteTo(w io.Writer) (int64, error)

type TradesMut

type TradesMut struct {
	Trades
}

func (*TradesMut) Clone

func (s *TradesMut) Clone() *TradesMut

func (*TradesMut) Freeze

func (s *TradesMut) Freeze() *Trades

func (*TradesMut) SetCount

func (s *TradesMut) SetCount(v int64) *TradesMut

func (*TradesMut) SetMax

func (s *TradesMut) SetMax(v int64) *TradesMut

func (*TradesMut) SetMin

func (s *TradesMut) SetMin(v int64) *TradesMut

type Volume

type Volume struct {
	// contains filtered or unexported fields
}

func (*Volume) Buy

func (s *Volume) Buy() *VolumeSide

func (*Volume) Bytes

func (s *Volume) Bytes() []byte

func (*Volume) Clone

func (s *Volume) Clone() *Volume

func (*Volume) MarshalBinary

func (s *Volume) MarshalBinary() ([]byte, error)

func (*Volume) MarshalBinaryTo

func (s *Volume) MarshalBinaryTo(b []byte) []byte

func (*Volume) MarshalMap

func (s *Volume) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*Volume) Mut

func (s *Volume) Mut() *VolumeMut

func (*Volume) Read

func (s *Volume) Read(b []byte) (n int, err error)

func (*Volume) ReadFrom

func (s *Volume) ReadFrom(r io.Reader) (int64, error)

func (*Volume) Sell

func (s *Volume) Sell() *VolumeSide

func (*Volume) String

func (s *Volume) String() string

func (*Volume) Total

func (s *Volume) Total() float64

func (*Volume) UnmarshalBinary

func (s *Volume) UnmarshalBinary(b []byte) error

func (*Volume) WriteTo

func (s *Volume) WriteTo(w io.Writer) (int64, error)

type VolumeMut

type VolumeMut struct {
	Volume
}

func (*VolumeMut) Buy

func (s *VolumeMut) Buy() *VolumeSideMut

func (*VolumeMut) Clone

func (s *VolumeMut) Clone() *VolumeMut

func (*VolumeMut) Finish

func (v *VolumeMut) Finish()

func (*VolumeMut) Freeze

func (s *VolumeMut) Freeze() *Volume

func (*VolumeMut) Sell

func (s *VolumeMut) Sell() *VolumeSideMut

func (*VolumeMut) SetBuy

func (s *VolumeMut) SetBuy(v *VolumeSide) *VolumeMut

func (*VolumeMut) SetSell

func (s *VolumeMut) SetSell(v *VolumeSide) *VolumeMut

func (*VolumeMut) SetTotal

func (s *VolumeMut) SetTotal(v float64) *VolumeMut

type VolumeSide

type VolumeSide struct {
	// contains filtered or unexported fields
}

func (*VolumeSide) Bytes

func (s *VolumeSide) Bytes() []byte

func (*VolumeSide) Clone

func (s *VolumeSide) Clone() *VolumeSide

func (*VolumeSide) Interest

func (s *VolumeSide) Interest() float64

func (*VolumeSide) MarshalBinary

func (s *VolumeSide) MarshalBinary() ([]byte, error)

func (*VolumeSide) MarshalBinaryTo

func (s *VolumeSide) MarshalBinaryTo(b []byte) []byte

func (*VolumeSide) MarshalMap

func (s *VolumeSide) MarshalMap(m map[string]interface{}) map[string]interface{}

func (*VolumeSide) Mut

func (s *VolumeSide) Mut() *VolumeSideMut

func (*VolumeSide) Percent

func (s *VolumeSide) Percent() float64

func (*VolumeSide) Read

func (s *VolumeSide) Read(b []byte) (n int, err error)

func (*VolumeSide) ReadFrom

func (s *VolumeSide) ReadFrom(r io.Reader) (int64, error)

func (*VolumeSide) String

func (s *VolumeSide) String() string

func (*VolumeSide) Total

func (s *VolumeSide) Total() float64

func (*VolumeSide) UnmarshalBinary

func (s *VolumeSide) UnmarshalBinary(b []byte) error

func (*VolumeSide) WriteTo

func (s *VolumeSide) WriteTo(w io.Writer) (int64, error)

type VolumeSideMut

type VolumeSideMut struct {
	VolumeSide
}

func (*VolumeSideMut) Clone

func (s *VolumeSideMut) Clone() *VolumeSideMut

func (*VolumeSideMut) Freeze

func (s *VolumeSideMut) Freeze() *VolumeSide

func (*VolumeSideMut) SetInterest

func (s *VolumeSideMut) SetInterest(v float64) *VolumeSideMut

func (*VolumeSideMut) SetPercent

func (s *VolumeSideMut) SetPercent(v float64) *VolumeSideMut

func (*VolumeSideMut) SetTotal

func (s *VolumeSideMut) SetTotal(v float64) *VolumeSideMut

Jump to

Keyboard shortcuts

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