price

package
v0.0.0-...-8fb26ab Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Up = SpreadDirection(iota + 1)
	Down
)

Variables

This section is empty.

Functions

func AddSpread

func AddSpread(price, spreadBps float64, direction SpreadDirection) float64

func GetAbsoluteDistanceBps

func GetAbsoluteDistanceBps(mid, price1, price2 float64) float64

func GetAbsoluteSpreadBps

func GetAbsoluteSpreadBps(mid, price float64) float64

func GetDistanceBps

func GetDistanceBps(mid, price1, price2 float64) float64

func GetSpreadBps

func GetSpreadBps(mid, price float64) float64

func IsEmptyTwoWay

func IsEmptyTwoWay[T instr.Instrument](price TwoWay[T]) bool

func Skew

func Skew(price, skewFactorBps float64) float64

Types

type SpreadDirection

type SpreadDirection int

type TwoWay

type TwoWay[T instr.Instrument] struct {
	Instrument   T
	Bid          float64
	Offer        float64
	BidQty       float64
	OfferQty     float64
	TransactTime time.Time
}

func EmptyTwoWay

func EmptyTwoWay[T instr.Instrument]() TwoWay[T]

func TwoWayFromTicker

func TwoWayFromTicker[T instr.Instrument](ticker ticker.Ticker[T]) *TwoWay[T]

func (*TwoWay[T]) Equals

func (price *TwoWay[T]) Equals(other TwoWay[T]) bool

func (*TwoWay[T]) Mid

func (price *TwoWay[T]) Mid() float64

func (*TwoWay[T]) RawSpread

func (price *TwoWay[T]) RawSpread() float64

func (*TwoWay[T]) SpreadBps

func (price *TwoWay[T]) SpreadBps() float64

Jump to

Keyboard shortcuts

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