market

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candle

type Candle struct {
	Timestamp       time.Time `json:"time"`
	Open            float64   `json:"open"`
	High            float64   `json:"high"`
	Low             float64   `json:"low"`
	Close           float64   `json:"close"`
	Vwap            float64   `json:"vwap"`
	NTrades         int64     `json:"n_trades"`
	NBuy            int64     `json:"n_buy"`
	NSell           int64     `json:"n_sell"`
	VolumeBase      float64   `json:"vol_base"`
	VolumeQuote     float64   `json:"vol_quote"`
	VolumeBuyBase   float64   `json:"vol_buy_base"`
	VolumeBuyQuote  float64   `json:"vol_buy_quote"`
	VolumeSellBase  float64   `json:"vol_sell_base"`
	VolumeSellQuote float64   `json:"vol_sell_quote"`
}

type CandleList

type CandleList []*Candle

func (CandleList) AsOf

func (l CandleList) AsOf(t time.Time) (c *Candle)

func (CandleList) Len

func (l CandleList) Len() int

type CandleQuery

type CandleQuery struct {
	Market   string
	Pair     string
	Collapse time.Duration
	Fill     client.FillMode
	Columns  []string
	From     time.Time
	To       time.Time
	Limit    int
}

func (CandleQuery) Url

func (c CandleQuery) Url() string

type MarketAPI

type MarketAPI interface {
	GetTicker(context.Context, string, string) (*Ticker, error)
	ListTickers(context.Context) ([]Ticker, error)
	ListCandles(context.Context, CandleQuery) (CandleList, error)
}

func NewMarketAPI

func NewMarketAPI(c *client.Client) MarketAPI

type Ticker

type Ticker struct {
	Pair        string    `json:"pair"`
	Base        string    `json:"base"`
	Quote       string    `json:"quote"`
	Exchange    string    `json:"exchange"`
	Open        float64   `json:"open"`
	High        float64   `json:"high"`
	Low         float64   `json:"low"`
	Last        float64   `json:"last"`
	Change      float64   `json:"change"`
	Vwap        float64   `json:"vwap"`
	NTrades     int64     `json:"n_trades"`
	VolumeBase  float64   `json:"volume_base"`
	VolumeQuote float64   `json:"volume_quote"`
	Time        time.Time `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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