markets

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ALL = iota
	BASESPOT
	BASEFUTURE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Candle

type Candle struct {
	Close     float64   `json:"close"`
	High      float64   `json:"high"`
	Low       float64   `json:"low"`
	Open      float64   `json:"open"`
	Volume    float64   `json:"volume"`
	StartTime time.Time `json:"startTime"`
}

type Market

type Market struct {
	Type          string `json:"type"`
	Name          string `json:"name"`
	BaseCurrency  string `json:"baseCurrency"`
	QuoteCurrency string `json:"quoteCurrency"`
	Underlying    string `json:"underlying"`

	Last           float64 `json:"last"`
	Ask            float64 `json:"ask"`
	Bid            float64 `json:"bid"`
	Price          float64 `json:"price"`
	PriceIncrement float64 `json:"priceIncrement"`

	SizeIncrement  float64 `json:"sizeIncrement"`
	ChangeBod      float64 `json:"changeBod"`
	Change1H       float64 `json:"change1h"`
	Change24H      float64 `json:"change24h"`
	QuoteVolume24H float64 `json:"quoteVolume24h"`
	VolumeUsd24H   float64 `json:"volumeUsd24h"`

	Enabled bool `json:"enabled"`
}

type Orderbook

type Orderbook struct {
	Asks [][]float64 `json:"asks"`
	Bids [][]float64 `json:"bids"`
}

type RequestForCandles

type RequestForCandles struct {
	ProductCode string `url:"-"`
	// Resolution is sec length, window length in seconds. options: 15, 60(1m), 300(5m), 900(15m), 3600(60m), 14400(4h), 86400(1D)
	Resolution int   `url:"resolution"`
	Limit      int   `url:"limit,omitempty"`
	Start      int64 `url:"start_time,omitempty"`
	End        int64 `url:"end_time,omitempty"`
}

query ?resolution={resolution}&limit={limit}&start_time={start_time}&end_time={end_time}

func (*RequestForCandles) Method

func (req *RequestForCandles) Method() string

func (*RequestForCandles) Path

func (req *RequestForCandles) Path() string

func (*RequestForCandles) Payload

func (req *RequestForCandles) Payload() []byte

func (*RequestForCandles) Query

func (req *RequestForCandles) Query() string

type RequestForMarkets

type RequestForMarkets struct {
	ProductCode string `url:"-"`
}

RequestForMarkets arg productcode can be blank

func (*RequestForMarkets) Method

func (req *RequestForMarkets) Method() string

func (*RequestForMarkets) Path

func (req *RequestForMarkets) Path() string

func (*RequestForMarkets) Payload

func (req *RequestForMarkets) Payload() []byte

func (*RequestForMarkets) Query

func (req *RequestForMarkets) Query() string

type RequestForOrderbook

type RequestForOrderbook struct {
	ProductCode string `url:"-"`
	Depth       int    `url:"depth,omitempty"`
}

query ?depth={depth}

func (*RequestForOrderbook) Method

func (req *RequestForOrderbook) Method() string

func (*RequestForOrderbook) Path

func (req *RequestForOrderbook) Path() string

func (*RequestForOrderbook) Payload

func (req *RequestForOrderbook) Payload() []byte

func (*RequestForOrderbook) Query

func (req *RequestForOrderbook) Query() string

type RequestForTrades

type RequestForTrades struct {
	ProductCode string `url:"-"`
	Limit       int    `url:"limit,omitempty"`
	Start       int64  `url:"start,omitempty"`
	End         int64  `url:"end,omitempty"`
}

query ?limit={limit}&start_time={start_time}&end_time={end_time}

func (*RequestForTrades) Method

func (req *RequestForTrades) Method() string

func (*RequestForTrades) Path

func (req *RequestForTrades) Path() string

This syntax works to request historical prices https://ftx.com/api/markets/DEFI-PERP/trades?&start_time=1597687200&end_time=1597773600

func (*RequestForTrades) Payload

func (req *RequestForTrades) Payload() []byte

func (*RequestForTrades) Query

func (req *RequestForTrades) Query() string

type ResponseForCandles

type ResponseForCandles []Candle

func (ResponseForCandles) Len

func (a ResponseForCandles) Len() int

Sort by timestamp

func (ResponseForCandles) Less

func (a ResponseForCandles) Less(i, j int) bool

func (ResponseForCandles) Swap

func (a ResponseForCandles) Swap(i, j int)

type ResponseForMarkets

type ResponseForMarkets []Market

func (ResponseForMarkets) Len

func (a ResponseForMarkets) Len() int

func (ResponseForMarkets) Less

func (a ResponseForMarkets) Less(i, j int) bool

func (ResponseForMarkets) List

func (markets ResponseForMarkets) List() []string

func (ResponseForMarkets) Ranking

func (markets ResponseForMarkets) Ranking(base int) []string

Ranking return USD volume in 24hours.

func (ResponseForMarkets) Swap

func (a ResponseForMarkets) Swap(i, j int)

type ResponseForOrderbook

type ResponseForOrderbook Orderbook

type ResponseForTrades

type ResponseForTrades []Trade

type Ticker

type Ticker struct {
	Bid     float64       `json:"bid"`
	Ask     float64       `json:"ask"`
	BidSize float64       `json:"bidSize"`
	AskSize float64       `json:"askSize"`
	Last    float64       `json:"last"`
	Time    types.FtxTime `json:"time"`
}

type Trade

type Trade struct {
	ID          int64     `json:"id"`
	Liquidation bool      `json:"liquidation"`
	Price       float64   `json:"price"`
	Side        string    `json:"side"`
	Size        float64   `json:"size"`
	Time        time.Time `json:"time"`
}

Jump to

Keyboard shortcuts

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