ftx

package
v1.42.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrimLowerString added in v1.14.0

func TrimLowerString(original string) string

func TrimUpperString added in v1.14.0

func TrimUpperString(original string) string

Types

type Candle added in v1.15.3

type Candle struct {
	Close     fixedpoint.Value `json:"close"`
	High      fixedpoint.Value `json:"high"`
	Low       fixedpoint.Value `json:"low"`
	Open      fixedpoint.Value `json:"open"`
	StartTime datetime         `json:"startTime"`
	Volume    fixedpoint.Value `json:"volume"`
}

type ErrorResponse

type ErrorResponse struct {
	*util.Response

	IsSuccess   bool   `json:"success"`
	ErrorString string `json:"error,omitempty"`
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Exchange

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

func NewExchange

func NewExchange(key, secret string, subAccount string) *Exchange

func (*Exchange) CancelOrders

func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) error

func (*Exchange) DefaultFeeRates added in v1.39.0

func (e *Exchange) DefaultFeeRates() types.ExchangeFee

DefaultFeeRates returns the FTX Tier 1 fee See also https://help.ftx.com/hc/en-us/articles/360024479432-Fees

func (*Exchange) IsSupportedInterval added in v1.21.0

func (e *Exchange) IsSupportedInterval(interval types.Interval) bool

func (*Exchange) Name

func (e *Exchange) Name() types.ExchangeName

func (*Exchange) NewStream

func (e *Exchange) NewStream() types.Stream

func (*Exchange) PlatformFeeCurrency

func (e *Exchange) PlatformFeeCurrency() string

func (*Exchange) QueryAccount

func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error)

func (*Exchange) QueryAccountBalances

func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap, error)

func (*Exchange) QueryClosedOrders

func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since, until time.Time, lastOrderID uint64) (orders []types.Order, err error)

symbol, since and until are all optional. FTX can only query by order created time, not updated time. FTX doesn't support lastOrderID, so we will query by the time range first, and filter by the lastOrderID.

func (*Exchange) QueryDepositHistory

func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since, until time.Time) (allDeposits []types.Deposit, err error)

func (*Exchange) QueryKLines

func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, options types.KLineQueryOptions) ([]types.KLine, error)

func (*Exchange) QueryMarkets

func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error)

func (*Exchange) QueryOpenOrders

func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error)

func (*Exchange) QueryOrder added in v1.28.0

func (e *Exchange) QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error)

func (*Exchange) QueryTicker added in v1.13.0

func (e *Exchange) QueryTicker(ctx context.Context, symbol string) (*types.Ticker, error)

func (*Exchange) QueryTickers added in v1.13.0

func (e *Exchange) QueryTickers(ctx context.Context, symbol ...string) (map[string]types.Ticker, error)

func (*Exchange) QueryTrades

func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *types.TradeQueryOptions) ([]types.Trade, error)

func (*Exchange) SetModifyOrderAmountForFee added in v1.39.0

func (e *Exchange) SetModifyOrderAmountForFee(feeRate types.ExchangeFee)

SetModifyOrderAmountForFee protects the limit buy orders by reducing amount with taker fee. The amount is recalculated before submit: submit_amount = original_amount / (1 + taker_fee_rate) . This prevents balance exceeding error while closing position without spot margin enabled.

func (*Exchange) SubmitOrder added in v1.40.3

func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (*types.Order, error)

func (*Exchange) SupportedInterval added in v1.21.0

func (e *Exchange) SupportedInterval() map[types.Interval]int

func (*Exchange) Transfer added in v1.17.0

func (e *Exchange) Transfer(ctx context.Context, coin string, size float64, destination string) (string, error)

type HistoricalPricesResponse added in v1.15.3

type HistoricalPricesResponse struct {
	Success bool     `json:"success"`
	Result  []Candle `json:"result"`
}
{
  "success": true,
  "result": [
    {
      "close": 11055.25,
      "high": 11089.0,
      "low": 11043.5,
      "open": 11059.25,
      "startTime": "2019-06-24T17:15:00+00:00",
      "volume": 464193.95725
    }
  ]
}

type MarketMap added in v1.21.0

type MarketMap map[string]MarketTicker

type MarketTicker added in v1.21.0

type MarketTicker struct {
	Market types.Market
	Price  fixedpoint.Value
	Ask    fixedpoint.Value
	Bid    fixedpoint.Value
	Last   fixedpoint.Value
}

type OrderType added in v1.25.3

type OrderType string
const (
	OrderTypeLimit  OrderType = "limit"
	OrderTypeMarket OrderType = "market"
)

type Stream added in v1.13.0

type Stream struct {
	*types.StandardStream
	// contains filtered or unexported fields
}

func NewStream added in v1.13.0

func NewStream(key, secret string, subAccount string, e *Exchange) *Stream

func (*Stream) Close added in v1.13.0

func (s *Stream) Close() error

func (*Stream) Connect added in v1.13.0

func (s *Stream) Connect(ctx context.Context) error

func (*Stream) Subscribe added in v1.13.0

func (s *Stream) Subscribe(channel types.Channel, symbol string, option types.SubscribeOptions)

type TransferPayload added in v1.17.0

type TransferPayload struct {
	Coin        string
	Size        float64
	Source      string
	Destination string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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