ftx

package
v0.3.0-pre Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Coin  string  `json:"coin"`
	Free  float64 `json:"free"`
	Total float64 `json:"total"`
}

type CodeC

type CodeC struct {
	*exchange.CodeC
	// contains filtered or unexported fields
}

func NewCodeC

func NewCodeC(codeMap map[string]exchange.Symbol) *CodeC

func (*CodeC) Decode

func (cc *CodeC) Decode(raw []byte) (rpc.Response, error)

type Fill

type Fill struct {
	ID      exchange.OrderID
	Symbol  exchange.Symbol
	OrderID exchange.OrderID
	TradeID exchange.OrderID
	Side    exchange.OrderSide
	Price   decimal.Decimal
	Size    decimal.Decimal
	Time    time.Time
	Fee     decimal.Decimal
	FeeRate decimal.Decimal
}

type FillNotify

type FillNotify struct {
	Fee       decimal.Decimal `json:"fee"`
	FeeRate   decimal.Decimal `json:"feeRate"`
	Future    string          `json:"future"`
	ID        int64           `json:"id"`
	Liquidity string          `json:"liquidity"`
	Market    string          `json:"market"`
	OrderID   int64           `json:"orderId"`
	TradeID   int64           `json:"tradeId"`
	Price     decimal.Decimal `json:"price"`
	Side      string          `json:"side"`
	Size      decimal.Decimal `json:"size"`
	Time      string          `json:"time"`
	Type      string          `json:"type"`
}

type FutureInfo

type FutureInfo struct {
	Ask                 float64 `json:"ask"`
	Bid                 float64 `json:"bid"`
	Change1H            float64 `json:"change1h"`
	Change24H           float64 `json:"change24h"`
	ChangeBod           float64 `json:"changeBod"`
	VolumeUsd24h        float64 `json:"volumeUsd24h"`
	Volume              float64 `json:"volume"`
	Description         string  `json:"description"`
	Enabled             bool    `json:"enabled"`
	Expired             bool    `json:"expired"`
	Expiry              string  `json:"expiry"`
	Index               float64 `json:"index"`
	ImfFactor           float64 `json:"imfFactor"`
	Last                float64 `json:"last"`
	LowerBound          float64 `json:"lowerBound"`
	Mark                float64 `json:"mark"`
	Name                string  `json:"name"`
	Perpetual           bool    `json:"perpetual"`
	PositionLimitWtight float64 `json:"positionLimitWeight"`
	PostOnly            bool    `json:"postOnly"`
	PriceIncrement      float64 `json:"priceIncrement"`
	SizeIncrement       float64 `json:"sizeIncrement"`
	Underlying          string  `json:"underlying"`
	UpperBound          float64 `json:"upperBound"`
	Type                string  `json:"type"`
}

type FuturesSymbol

type FuturesSymbol struct {
	*exchange.BaseFutureSymbol
}

func (*FuturesSymbol) String

func (fs *FuturesSymbol) String() string

type Market

type Market struct {
	Name           string  `json:"name"`
	BaseCurrency   string  `json:"baseCurrency"`
	QuoteCurrency  string  `json:"quoteCurrency"`
	Type           string  `json:"type"`
	Underlying     string  `json:"underlying"`
	Enabled        bool    `json:"enabled"`
	Ask            float64 `json:"ask"`
	Bid            float64 `json:"bid"`
	Last           float64 `json:"last"`
	PostOnly       bool    `json:"postOnly"`
	PriceIncrement float64 `json:"priceIncrement"`
	SizeIncrement  float64 `json:"sizeIncrement"`
	Restricted     bool    `json:"restricted"`
}

type Order

type Order struct {
	CreatedAt     string          `json:"createdAt"`
	FilledSize    decimal.Decimal `json:"filledSize"`
	Future        string          `json:"future"`
	ID            int64           `json:"id"`
	Market        string          `json:"market"`
	Price         decimal.Decimal `json:"price"`
	AvgFillPrice  decimal.Decimal `json:"avgFillPrice"`
	RemainingSize decimal.Decimal `json:"remainingSize"`
	Side          string          `json:"side"`
	Size          decimal.Decimal `json:"size"`
	Status        string          `json:"status"`
	Type          string          `json:"type"`
	ReduceOnly    bool            `json:"reduceOnly"`
	IOC           bool            `json:"ioc"`
	PostOnly      bool            `json:"postOnly"`
	ClientID      string          `json:"clientId"`
}

type OrderBook

type OrderBook struct {
	*exchange.OrderBookDS
	// contains filtered or unexported fields
}

func NewOrderBook

func NewOrderBook(sym exchange.Symbol) *OrderBook

func (*OrderBook) Init

func (ob *OrderBook) Init(cr *callResponse) (*exchange.OrderBook, error)

func (*OrderBook) Update

func (ob *OrderBook) Update(cr *callResponse) (*exchange.OrderBook, error)

type OrderBookData

type OrderBookData struct {
	Action    string       `json:"action"`
	Bids      [][2]float64 `json:"bids"`
	Asks      [][2]float64 `json:"asks"`
	Timestamp int64        `json:"timestamp"`
}

func (*OrderBookData) Transfer

type OrderReq

type OrderReq struct {
	Market   string  `json:"market"`
	Side     string  `json:"side"`
	Price    float64 `json:"price"`
	Type     string  `json:"type"`
	Size     float64 `json:"size"`
	ClientID string  `json:"clientId,omitempty"`
}

type Position

type Position struct {
	Cost       float64 `json:"cost"`
	EntryPrice float64 `json:"entryPrice"`
}

type RestClient

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

func NewRestClient

func NewRestClient(key, secret string) *RestClient

func (*RestClient) Balances

func (rc *RestClient) Balances(ctx context.Context) ([]Balance, error)

func (*RestClient) Future

func (rc *RestClient) Future(ctx context.Context, sym string) (*FutureInfo, error)

func (*RestClient) Futures

func (rc *RestClient) Futures(ctx context.Context) ([]FutureInfo, error)

func (*RestClient) Init

func (rc *RestClient) Init(ctx context.Context) error

func (*RestClient) Markets

func (rc *RestClient) Markets(ctx context.Context) ([]Market, error)

func (*RestClient) NewAuthWSClient

func (rc *RestClient) NewAuthWSClient(ctx context.Context, data chan interface{}) (*WSClient, error)

func (*RestClient) NewWSClient

func (rc *RestClient) NewWSClient(data chan interface{}) *WSClient

func (*RestClient) OrderCancel

func (rc *RestClient) OrderCancel(ctx context.Context, order *exchange.Order) error

OrderCancel only ID field is required

func (*RestClient) OrderFetch

func (rc *RestClient) OrderFetch(ctx context.Context, order *exchange.Order) (*exchange.Order, error)

OrderFetch only ID field is required

func (*RestClient) OrderNew

func (rc *RestClient) OrderNew(ctx context.Context, req *exchange.OrderRequest, options ...exchange.OrderReqOption) (*exchange.Order, error)

func (*RestClient) Orders

func (rc *RestClient) Orders(ctx context.Context, symbol exchange.Symbol) ([]*exchange.Order, error)

Orders return open orders

func (*RestClient) ParseFutureSymbol

func (rc *RestClient) ParseFutureSymbol(symbol string) (exchange.FuturesSymbol, error)

func (*RestClient) ParseSwapSymbol

func (rc *RestClient) ParseSwapSymbol(symbol string) (exchange.SwapSymbol, error)

func (*RestClient) ParseSymbol

func (rc *RestClient) ParseSymbol(symbol string) (exchange.Symbol, error)

func (*RestClient) Positions

func (client *RestClient) Positions(ctx context.Context) ([]Position, error)

type SpotSymbol

type SpotSymbol struct {
	*exchange.BaseSpotSymbol
}

func (*SpotSymbol) String

func (ss *SpotSymbol) String() string

type SwapSymbol

type SwapSymbol struct {
	*exchange.BaseSwapSymbol
}

func (*SwapSymbol) String

func (fs *SwapSymbol) String() string

type WSClient

type WSClient struct {
	*exchange.WSClient
	// contains filtered or unexported fields
}

func (*WSClient) Auth

func (ws *WSClient) Auth(ctx context.Context, key string, secret string) error

func (*WSClient) Handle

func (ws *WSClient) Handle(ctx context.Context, notify *rpc.Notify)

func (*WSClient) Run

func (ws *WSClient) Run(ctx context.Context) error

func (*WSClient) Subscribe

func (ws *WSClient) Subscribe(ctx context.Context, typ exchange.SubType, syms ...exchange.Symbol) error

type Wrap

type Wrap struct {
	Success bool            `json:"success"`
	Result  json.RawMessage `json:"result"`
	Error   string          `json:"error"`
}

Jump to

Keyboard shortcuts

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