ftx

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 36 Imported by: 0

README

GoCryptoTrader package Ftx

Build Status Software License GoDoc Coverage Status Go Report Card

This ftx package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

FTX Exchange

Current Features
  • REST Support
  • Websocket Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var f exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "FTX" {
		f = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := f.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := f.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := f.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := f.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := f.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := f.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := f.Trade(...)
if err != nil {
	// Handle error
}
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TimeIntervalFifteenSeconds = TimeInterval("15")
	TimeIntervalMinute         = TimeInterval("60")
	TimeIntervalFiveMinutes    = TimeInterval("300")
	TimeIntervalFifteenMinutes = TimeInterval("900")
	TimeIntervalHour           = TimeInterval("3600")
	TimeIntervalFourHours      = TimeInterval("14400")
	TimeIntervalDay            = TimeInterval("86400")
)

Vars related to time intervals

Functions

This section is empty.

Types

type AcceptQuote

type AcceptQuote struct {
	Success bool `json:"success"`
}

AcceptQuote stores data of accepted quote

type AccountInfoData

type AccountInfoData struct {
	BackstopProvider             bool           `json:"backstopProvider"`
	ChargeInterestOnNegativeUSD  bool           `json:"chargeInterestOnNegativeUsd"`
	Collateral                   float64        `json:"collateral"`
	FreeCollateral               float64        `json:"freeCollateral"`
	InitialMarginRequirement     float64        `json:"initialMarginRequirement"`
	Leverage                     float64        `json:"leverage"`
	Liquidating                  bool           `json:"liquidating"`
	MaintenanceMarginRequirement float64        `json:"maintenanceMarginRequirement"`
	MakerFee                     float64        `json:"makerFee"`
	MarginFraction               float64        `json:"marginFraction"`
	OpenMarginFraction           float64        `json:"openMarginFraction"`
	PositionLimit                float64        `json:"positionLimit"`
	PositionLimitUsed            float64        `json:"positionLimitUsed"`
	SpotLendingEnabled           bool           `json:"spotLendingEnabled"`
	SpotMarginEnabled            bool           `json:"spotMarginEnabled"`
	TakerFee                     float64        `json:"takerFee"`
	TotalAccountValue            float64        `json:"totalAccountValue"`
	TotalPositionSize            float64        `json:"totalPositionSize"`
	UseFTTCollateral             bool           `json:"useFttCollateral"`
	Username                     string         `json:"username"`
	Positions                    []PositionData `json:"positions"`
}

AccountInfoData stores account data

type AccountOptionsInfoData

type AccountOptionsInfoData struct {
	USDBalance       float64 `json:"usdBalance"`
	LiquidationPrice float64 `json:"liquidationPrice"`
	Liquidating      bool    `json:"liquidating"`
}

AccountOptionsInfoData stores account's options' info data

type AllWalletBalances

type AllWalletBalances map[string][]WalletBalance

AllWalletBalances stores all the user's account balances

type Authenticate

type Authenticate struct {
	Args      AuthenticationData `json:"args"`
	Operation string             `json:"op"`
}

Authenticate stores authentication variables required

type AuthenticationData

type AuthenticationData struct {
	Key        string `json:"key"`
	Sign       string `json:"sign"`
	Time       int64  `json:"time"`
	SubAccount string `json:"subaccount,omitempty"`
}

AuthenticationData stores authentication variables required

type CancelQuoteRequestData

type CancelQuoteRequestData struct {
	ID            int64      `json:"id"`
	Option        OptionData `json:"option"`
	RequestExpiry string     `json:"requestExpiry"`
	Side          string     `json:"side"`
	Size          float64    `json:"size"`
	Status        string     `json:"status"`
	Time          time.Time  `json:"time"`
}

CancelQuoteRequestData stores cancel quote request data

type CreateQuoteRequestData

type CreateQuoteRequestData struct {
	ID            int64     `json:"id"`
	Expiry        time.Time `json:"expiry"`
	Strike        float64   `json:"strike"`
	OptionType    string    `json:"type"`
	Underlying    string    `json:"underlying"`
	RequestExpiry string    `json:"requestExpiry"`
	Side          string    `json:"side"`
	Size          float64   `json:"size"`
	Status        string    `json:"status"`
	Time          time.Time `json:"time"`
}

CreateQuoteRequestData stores quote data of the request sent

type DepositData

type DepositData struct {
	Address string `json:"address"`
	Tag     string `json:"tag"`
	Method  string `json:"method"`
	Coin    string `json:"coin"`
}

DepositData stores deposit address data

type DepositItem

type DepositItem struct {
	Coin          string    `json:"coin"`
	Confirmations int64     `json:"conformations"`
	ConfirmedTime time.Time `json:"confirmedTime"`
	Fee           float64   `json:"fee"`
	ID            int64     `json:"id"`
	SentTime      time.Time `json:"sentTime"`
	Size          float64   `json:"size"`
	Status        string    `json:"status"`
	Time          time.Time `json:"time"`
	TxID          string    `json:"txid"`
	Address       struct {
		Address string `json:"address"`
		Tag     string `json:"tag"`
		Method  string `json:"method"`
	} `json:"address"`
}

DepositItem stores data about deposit history

type FTX

type FTX struct {
	exchange.Base
}

FTX is the overarching type across this package

func (*FTX) AcceptOTCQuote

func (f *FTX) AcceptOTCQuote(ctx context.Context, quoteID string) error

AcceptOTCQuote requests for otc quotes

func (*FTX) AcceptQuote

func (f *FTX) AcceptQuote(ctx context.Context, quoteID string) ([]QuoteForQuoteData, error)

AcceptQuote accepts the quote for quote

func (*FTX) AuthenticateWebsocket

func (f *FTX) AuthenticateWebsocket(_ context.Context) error

AuthenticateWebsocket sends an authentication message to the websocket

func (*FTX) CalcPartialOBChecksum

func (f *FTX) CalcPartialOBChecksum(data *WsOrderbookData) int64

CalcPartialOBChecksum calculates checksum of partial OB data received from WS

func (*FTX) CalcUpdateOBChecksum

func (f *FTX) CalcUpdateOBChecksum(data *orderbook.Base) int64

CalcUpdateOBChecksum calculates checksum of update OB data received from WS

func (*FTX) CancelAllOrders

func (f *FTX) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*FTX) CancelBatchOrders

func (f *FTX) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*FTX) CancelOrder

func (f *FTX) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*FTX) CancelUnstakeRequest

func (f *FTX) CancelUnstakeRequest(ctx context.Context, requestID int64) (bool, error)

CancelUnstakeRequest cancels a pending unstake request

func (*FTX) ChangeAccountLeverage

func (f *FTX) ChangeAccountLeverage(ctx context.Context, leverage float64) error

ChangeAccountLeverage changes default leverage used by account

func (*FTX) CreateQuoteRequest

func (f *FTX) CreateQuoteRequest(ctx context.Context, underlying currency.Code, optionType, side string, expiry int64, requestExpiry string, strike, size, limitPrice, counterPartyID float64, hideLimitPrice bool) (CreateQuoteRequestData, error)

CreateQuoteRequest sends a request to create a quote

func (*FTX) CreateSubaccount

func (f *FTX) CreateSubaccount(ctx context.Context, name string) (*Subaccount, error)

CreateSubaccount creates a new subaccount

func (*FTX) DeleteMyQuote

func (f *FTX) DeleteMyQuote(ctx context.Context, quoteID string) ([]QuoteForQuoteData, error)

DeleteMyQuote deletes my quote for quotes

func (*FTX) DeleteOrder

func (f *FTX) DeleteOrder(ctx context.Context, orderID string) (string, error)

DeleteOrder deletes an order

func (*FTX) DeleteOrderByClientID

func (f *FTX) DeleteOrderByClientID(ctx context.Context, clientID string) (string, error)

DeleteOrderByClientID deletes an order

func (*FTX) DeleteQuote

func (f *FTX) DeleteQuote(ctx context.Context, requestID string) (CancelQuoteRequestData, error)

DeleteQuote sends request to cancel a quote

func (*FTX) DeleteSubaccount

func (f *FTX) DeleteSubaccount(ctx context.Context, name string) error

DeleteSubaccount deletes the specified subaccount name

func (*FTX) DeleteTriggerOrder

func (f *FTX) DeleteTriggerOrder(ctx context.Context, orderID string) (string, error)

DeleteTriggerOrder deletes an order

func (*FTX) FetchAccountInfo

func (f *FTX) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*FTX) FetchDepositAddress

func (f *FTX) FetchDepositAddress(ctx context.Context, coin currency.Code, chain string) (*DepositData, error)

FetchDepositAddress gets deposit address for a given coin

func (*FTX) FetchDepositHistory

func (f *FTX) FetchDepositHistory(ctx context.Context) ([]DepositItem, error)

FetchDepositHistory gets deposit history

func (*FTX) FetchExchangeLimits

func (f *FTX) FetchExchangeLimits(ctx context.Context) ([]order.MinMaxLevel, error)

FetchExchangeLimits fetches spot order execution limits

func (*FTX) FetchOrderHistory

func (f *FTX) FetchOrderHistory(ctx context.Context, marketName string, startTime, endTime time.Time, limit string) ([]OrderData, error)

FetchOrderHistory gets order history

func (*FTX) FetchOrderbook

func (f *FTX) FetchOrderbook(ctx context.Context, c currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*FTX) FetchTicker

func (f *FTX) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*FTX) FetchTradablePairs

func (f *FTX) FetchTradablePairs(ctx context.Context, a asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*FTX) FetchWithdrawalHistory

func (f *FTX) FetchWithdrawalHistory(ctx context.Context) ([]WithdrawItem, error)

FetchWithdrawalHistory gets withdrawal history

func (*FTX) GenerateDefaultSubscriptions

func (f *FTX) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)

GenerateDefaultSubscriptions generates default subscription

func (*FTX) GetAccountInfo

func (f *FTX) GetAccountInfo(ctx context.Context) (AccountInfoData, error)

GetAccountInfo gets account info

func (*FTX) GetAccountOptionsInfo

func (f *FTX) GetAccountOptionsInfo(ctx context.Context) (AccountOptionsInfoData, error)

GetAccountOptionsInfo gets account's options' info

func (*FTX) GetActiveOrders

func (f *FTX) GetActiveOrders(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)

GetActiveOrders retrieves any orders that are active/open

func (*FTX) GetAllWalletBalances

func (f *FTX) GetAllWalletBalances(ctx context.Context) (AllWalletBalances, error)

GetAllWalletBalances gets all wallets' balances

func (*FTX) GetAvailableTransferChains

func (f *FTX) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)

GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency

func (*FTX) GetBalances

func (f *FTX) GetBalances(ctx context.Context) ([]WalletBalance, error)

GetBalances gets balances of the account

func (*FTX) GetCoins

func (f *FTX) GetCoins(ctx context.Context) ([]WalletCoinsData, error)

GetCoins gets coins' data in the account wallet

func (*FTX) GetDefaultConfig

func (f *FTX) GetDefaultConfig() (*config.Exchange, error)

GetDefaultConfig returns a default exchange config

func (*FTX) GetDepositAddress

func (f *FTX) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*FTX) GetFee

func (f *FTX) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*FTX) GetFeeByType

func (f *FTX) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on the type of transaction

func (*FTX) GetFills

func (f *FTX) GetFills(ctx context.Context, market, limit string, startTime, endTime time.Time) ([]FillsData, error)

GetFills gets fills' data

func (*FTX) GetFundingHistory

func (f *FTX) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*FTX) GetFundingPayments

func (f *FTX) GetFundingPayments(ctx context.Context, startTime, endTime time.Time, future string) ([]FundingPaymentsData, error)

GetFundingPayments gets funding payments

func (*FTX) GetFundingRates

func (f *FTX) GetFundingRates(ctx context.Context, startTime, endTime time.Time, future string) ([]FundingRatesData, error)

GetFundingRates gets data on funding rates

func (*FTX) GetFuture

func (f *FTX) GetFuture(ctx context.Context, futureName string) (FuturesData, error)

GetFuture gets data on a given future

func (*FTX) GetFutureStats

func (f *FTX) GetFutureStats(ctx context.Context, futureName string) (FutureStatsData, error)

GetFutureStats gets data on a given future's stats

func (*FTX) GetFutures

func (f *FTX) GetFutures(ctx context.Context) ([]FuturesData, error)

GetFutures gets data on futures

func (*FTX) GetHistoricCandles

func (f *FTX) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*FTX) GetHistoricCandlesExtended

func (f *FTX) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*FTX) GetHistoricTrades

func (f *FTX) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided FTX returns trades from the end date and iterates towards the start date

func (*FTX) GetHistoricalData

func (f *FTX) GetHistoricalData(ctx context.Context, marketName string, timeInterval, limit int64, startTime, endTime time.Time) ([]OHLCVData, error)

GetHistoricalData gets historical OHLCV data for a given market pair

func (*FTX) GetHistoricalIndex

func (f *FTX) GetHistoricalIndex(ctx context.Context, indexName string, resolution int64, startTime, endTime time.Time) ([]OHLCVData, error)

GetHistoricalIndex gets historical index data

func (*FTX) GetIndexWeights

func (f *FTX) GetIndexWeights(ctx context.Context, index string) (IndexWeights, error)

GetIndexWeights gets index weights

func (*FTX) GetLendingInfo

func (f *FTX) GetLendingInfo(ctx context.Context) ([]LendingInfoData, error)

GetLendingInfo gets margin lending info

func (*FTX) GetMarginBorrowHistory

func (f *FTX) GetMarginBorrowHistory(ctx context.Context, startTime, endTime time.Time) ([]MarginTransactionHistoryData, error)

GetMarginBorrowHistory gets the margin borrow history data

func (*FTX) GetMarginBorrowRates

func (f *FTX) GetMarginBorrowRates(ctx context.Context) ([]MarginFundingData, error)

GetMarginBorrowRates gets borrowing rates for margin trading

func (*FTX) GetMarginLendingHistory

func (f *FTX) GetMarginLendingHistory(ctx context.Context, coin currency.Code, startTime, endTime time.Time) ([]MarginTransactionHistoryData, error)

GetMarginLendingHistory gets margin lending history

func (*FTX) GetMarginLendingOffers

func (f *FTX) GetMarginLendingOffers(ctx context.Context) ([]LendingOffersData, error)

GetMarginLendingOffers gets margin lending offers

func (*FTX) GetMarginLendingRates

func (f *FTX) GetMarginLendingRates(ctx context.Context) ([]MarginFundingData, error)

GetMarginLendingRates gets lending rates for margin trading

func (*FTX) GetMarginMarketInfo

func (f *FTX) GetMarginMarketInfo(ctx context.Context, market string) ([]MarginMarketInfo, error)

GetMarginMarketInfo gets margin market data

func (*FTX) GetMarginMarketLendingHistory

func (f *FTX) GetMarginMarketLendingHistory(ctx context.Context, coin currency.Code, startTime, endTime time.Time) ([]MarginTransactionHistoryData, error)

GetMarginMarketLendingHistory gets the markets margin lending rate history

func (*FTX) GetMarket

func (f *FTX) GetMarket(ctx context.Context, marketName string) (MarketData, error)

GetMarket gets market data for a provided asset type

func (*FTX) GetMarkets

func (f *FTX) GetMarkets(ctx context.Context) ([]MarketData, error)

GetMarkets gets market data

func (*FTX) GetOTCQuoteStatus

func (f *FTX) GetOTCQuoteStatus(ctx context.Context, marketName, quoteID string) (*QuoteStatusData, error)

GetOTCQuoteStatus gets quote status of a quote

func (*FTX) GetOpenOrders

func (f *FTX) GetOpenOrders(ctx context.Context, marketName string) ([]OrderData, error)

GetOpenOrders gets open orders

func (*FTX) GetOpenTriggerOrders

func (f *FTX) GetOpenTriggerOrders(ctx context.Context, marketName, orderType string) ([]TriggerOrderData, error)

GetOpenTriggerOrders gets trigger orders that are currently open

func (*FTX) GetOptionsFills

func (f *FTX) GetOptionsFills(ctx context.Context, startTime, endTime time.Time, limit string) ([]OptionFillsData, error)

GetOptionsFills gets fills data for options

func (*FTX) GetOptionsPositions

func (f *FTX) GetOptionsPositions(ctx context.Context) ([]OptionsPositionsData, error)

GetOptionsPositions gets options' positions

func (*FTX) GetOrderHistory

func (f *FTX) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*FTX) GetOrderInfo

func (f *FTX) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*FTX) GetOrderStatus

func (f *FTX) GetOrderStatus(ctx context.Context, orderID string) (OrderData, error)

GetOrderStatus gets the order status of a given orderID

func (*FTX) GetOrderStatusByClientID

func (f *FTX) GetOrderStatusByClientID(ctx context.Context, clientOrderID string) (OrderData, error)

GetOrderStatusByClientID gets the order status of a given clientOrderID

func (*FTX) GetOrderbook

func (f *FTX) GetOrderbook(ctx context.Context, marketName string, depth int64) (OrderbookData, error)

GetOrderbook gets orderbook for a given market with a given depth (default depth 20)

func (*FTX) GetPositions

func (f *FTX) GetPositions(ctx context.Context) ([]PositionData, error)

GetPositions gets the users positions

func (*FTX) GetPublicOptionsTrades

func (f *FTX) GetPublicOptionsTrades(ctx context.Context, startTime, endTime time.Time, limit string) ([]OptionsTradesData, error)

GetPublicOptionsTrades gets options' trades from public

func (*FTX) GetQuoteRequests

func (f *FTX) GetQuoteRequests(ctx context.Context) ([]QuoteRequestData, error)

GetQuoteRequests gets a list of quote requests

func (*FTX) GetQuotesForYourQuote

func (f *FTX) GetQuotesForYourQuote(ctx context.Context, requestID string) (QuoteForQuoteData, error)

GetQuotesForYourQuote gets a list of quotes for your quote

func (*FTX) GetRecentTrades

func (f *FTX) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*FTX) GetStakeBalances

func (f *FTX) GetStakeBalances(ctx context.Context) ([]StakeBalance, error)

GetStakeBalances returns a collection of staked coin balances

func (*FTX) GetStakes

func (f *FTX) GetStakes(ctx context.Context) ([]Stake, error)

GetStakes returns a list of staked assets

func (*FTX) GetStakingRewards

func (f *FTX) GetStakingRewards(ctx context.Context) ([]StakeReward, error)

GetStakingRewards returns a collection of staking rewards

func (*FTX) GetSubaccounts

func (f *FTX) GetSubaccounts(ctx context.Context) ([]Subaccount, error)

GetSubaccounts returns the users subaccounts

func (*FTX) GetTokenInfo

func (f *FTX) GetTokenInfo(ctx context.Context, tokenName string) ([]LeveragedTokensData, error)

GetTokenInfo gets token info

func (*FTX) GetTrades

func (f *FTX) GetTrades(ctx context.Context, marketName string, startTime, endTime, limit int64) ([]TradeData, error)

GetTrades gets trades based on the conditions specified

func (*FTX) GetTriggerOrderHistory

func (f *FTX) GetTriggerOrderHistory(ctx context.Context, marketName string, startTime, endTime time.Time, side, orderType, limit string) ([]TriggerOrderData, error)

GetTriggerOrderHistory gets trigger orders that are currently open

func (*FTX) GetTriggerOrderTriggers

func (f *FTX) GetTriggerOrderTriggers(ctx context.Context, orderID string) ([]TriggerData, error)

GetTriggerOrderTriggers gets trigger orders that are currently open

func (*FTX) GetUnstakeRequests

func (f *FTX) GetUnstakeRequests(ctx context.Context) ([]UnstakeRequest, error)

GetUnstakeRequests returns a collection of unstake requests

func (*FTX) GetWebsocket

func (f *FTX) GetWebsocket() (*stream.Websocket, error)

GetWebsocket returns a pointer to the exchange websocket

func (*FTX) GetWithdrawalsHistory

func (f *FTX) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)

GetWithdrawalsHistory returns previous withdrawals data

func (*FTX) GetYourQuoteRequests

func (f *FTX) GetYourQuoteRequests(ctx context.Context) ([]PersonalQuotesData, error)

GetYourQuoteRequests gets a list of your quote requests

func (*FTX) ListLTBalances

func (f *FTX) ListLTBalances(ctx context.Context) ([]LTBalanceData, error)

ListLTBalances gets leveraged tokens' balances

func (*FTX) ListLTCreations

func (f *FTX) ListLTCreations(ctx context.Context) ([]LTCreationData, error)

ListLTCreations lists the leveraged tokens' creation requests

func (*FTX) ListLTRedemptions

func (f *FTX) ListLTRedemptions(ctx context.Context) ([]LTRedemptionData, error)

ListLTRedemptions lists the leveraged tokens' redemption requests

func (*FTX) ListLeveragedTokens

func (f *FTX) ListLeveragedTokens(ctx context.Context) ([]LeveragedTokensData, error)

ListLeveragedTokens lists leveraged tokens

func (*FTX) MakeQuote

func (f *FTX) MakeQuote(ctx context.Context, requestID, price string) ([]QuoteForQuoteData, error)

MakeQuote makes a quote for a quote

func (*FTX) MarginDailyBorrowedAmounts

func (f *FTX) MarginDailyBorrowedAmounts(ctx context.Context) ([]MarginDailyBorrowStats, error)

MarginDailyBorrowedAmounts gets daily borrowed amounts for margin

func (*FTX) ModifyOrder

func (f *FTX) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*FTX) ModifyOrderByClientID

func (f *FTX) ModifyOrderByClientID(ctx context.Context, clientOrderID, clientID string, price, size float64) (OrderData, error)

ModifyOrderByClientID modifies a placed order via clientOrderID

func (*FTX) ModifyPlacedOrder

func (f *FTX) ModifyPlacedOrder(ctx context.Context, orderID, clientID string, price, size float64) (OrderData, error)

ModifyPlacedOrder modifies a placed order

func (*FTX) ModifyTriggerOrder

func (f *FTX) ModifyTriggerOrder(ctx context.Context, orderID, orderType string, size, triggerPrice, orderPrice, trailValue float64) (TriggerOrderData, error)

ModifyTriggerOrder modifies an existing trigger order Choices for ordertype include stop, trailingStop, takeProfit

func (*FTX) MyQuotes

func (f *FTX) MyQuotes(ctx context.Context) ([]QuoteForQuoteData, error)

MyQuotes gets a list of my quotes for quotes

func (*FTX) Order

func (f *FTX) Order(
	ctx context.Context,
	marketName, side, orderType string,
	reduceOnly, ioc, postOnly bool,
	clientID string,
	price, size float64,
) (OrderData, error)

Order places an order

func (*FTX) RequestForQuotes

func (f *FTX) RequestForQuotes(ctx context.Context, base, quote currency.Code, amount float64) (RequestQuoteData, error)

RequestForQuotes requests for otc quotes

func (*FTX) RequestLTCreation

func (f *FTX) RequestLTCreation(ctx context.Context, tokenName string, size float64) (RequestTokenCreationData, error)

RequestLTCreation sends a request to create a leveraged token

func (*FTX) RequestLTRedemption

func (f *FTX) RequestLTRedemption(ctx context.Context, tokenName string, size float64) (LTRedemptionRequestData, error)

RequestLTRedemption sends a request to redeem a leveraged token

func (*FTX) Run

func (f *FTX) Run()

Run implements the FTX wrapper

func (*FTX) SendAuthHTTPRequest

func (f *FTX) SendAuthHTTPRequest(ctx context.Context, ep exchange.URL, method, path string, data, result interface{}) error

SendAuthHTTPRequest sends an authenticated request

func (*FTX) SendHTTPRequest

func (f *FTX) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*FTX) SetDefaults

func (f *FTX) SetDefaults()

SetDefaults sets the basic defaults for FTX

func (*FTX) Setup

func (f *FTX) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*FTX) StakeRequest

func (f *FTX) StakeRequest(ctx context.Context, coin currency.Code, size float64) (*Stake, error)

StakeRequest submits a stake request based on the specified currency and size

func (*FTX) Start

func (f *FTX) Start(wg *sync.WaitGroup) error

Start starts the FTX go routine

func (*FTX) SubaccountBalances

func (f *FTX) SubaccountBalances(ctx context.Context, name string) ([]SubaccountBalance, error)

SubaccountBalances returns the user's subaccount balances

func (*FTX) SubaccountTransfer

func (f *FTX) SubaccountTransfer(ctx context.Context, coin currency.Code, source, destination string, size float64) (*SubaccountTransferStatus, error)

SubaccountTransfer transfers a desired coin to the specified subaccount

func (*FTX) SubmitLendingOffer

func (f *FTX) SubmitLendingOffer(ctx context.Context, coin currency.Code, size, rate float64) error

SubmitLendingOffer submits an offer for margin lending

func (*FTX) SubmitOrder

func (f *FTX) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)

SubmitOrder submits a new order

func (*FTX) Subscribe

func (f *FTX) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error

Subscribe sends a websocket message to receive data from the channel

func (*FTX) SubscribeToWebsocketChannels

func (f *FTX) SubscribeToWebsocketChannels(channels []stream.ChannelSubscription) error

SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing

func (*FTX) TriggerOrder

func (f *FTX) TriggerOrder(ctx context.Context, marketName, side, orderType, reduceOnly, retryUntilFilled string, size, triggerPrice, orderPrice, trailValue float64) (TriggerOrderData, error)

TriggerOrder places an order

func (*FTX) UnstakeRequest

func (f *FTX) UnstakeRequest(ctx context.Context, coin currency.Code, size float64) (*UnstakeRequest, error)

UnstakeRequest unstakes an existing staked coin

func (*FTX) Unsubscribe

func (f *FTX) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*FTX) UnsubscribeToWebsocketChannels

func (f *FTX) UnsubscribeToWebsocketChannels(channels []stream.ChannelSubscription) error

UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing

func (*FTX) UpdateAccountInfo

func (f *FTX) UpdateAccountInfo(ctx context.Context, a asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies

func (*FTX) UpdateOrderExecutionLimits

func (f *FTX) UpdateOrderExecutionLimits(ctx context.Context, _ asset.Item) error

UpdateOrderExecutionLimits sets exchange executions for a required asset type

func (*FTX) UpdateOrderbook

func (f *FTX) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*FTX) UpdateSubaccountName

func (f *FTX) UpdateSubaccountName(ctx context.Context, oldName, newName string) (*Subaccount, error)

UpdateSubaccountName updates an existing subaccount name

func (*FTX) UpdateTicker

func (f *FTX) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*FTX) UpdateTickers

func (f *FTX) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*FTX) UpdateTradablePairs

func (f *FTX) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*FTX) ValidateCredentials

func (f *FTX) ValidateCredentials(ctx context.Context, assetType asset.Item) error

ValidateCredentials validates current credentials used for wrapper functionality

func (*FTX) Withdraw

func (f *FTX) Withdraw(ctx context.Context, coin currency.Code, address, tag, password, chain, code string, size float64) (*WithdrawItem, error)

Withdraw sends a withdrawal request

func (*FTX) WithdrawCryptocurrencyFunds

func (f *FTX) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*FTX) WithdrawFiatFunds

func (f *FTX) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*FTX) WithdrawFiatFundsToInternationalBank

func (f *FTX) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*FTX) WsAuth

func (f *FTX) WsAuth() error

WsAuth sends an authentication message to receive auth data

func (*FTX) WsConnect

func (f *FTX) WsConnect() error

WsConnect connects to a websocket feed

func (*FTX) WsProcessPartialOB

func (f *FTX) WsProcessPartialOB(data *WsOrderbookData, p currency.Pair, a asset.Item) error

WsProcessPartialOB creates an OB from websocket data

func (*FTX) WsProcessUpdateOB

func (f *FTX) WsProcessUpdateOB(data *WsOrderbookData, p currency.Pair, a asset.Item) error

WsProcessUpdateOB processes an update on the orderbook

type FillsData

type FillsData struct {
	Fee           float64   `json:"fee"`
	FeeCurrency   string    `json:"feeCurrency"`
	FeeRate       float64   `json:"feeRate"`
	Future        string    `json:"future"`
	ID            int64     `json:"id"`
	Liquidity     string    `json:"liquidity"`
	Market        string    `json:"market"`
	BaseCurrency  string    `json:"baseCurrency"`
	QuoteCurrency string    `json:"quoteCurrency"`
	OrderID       int64     `json:"orderId"`
	TradeID       int64     `json:"tradeId"`
	Price         float64   `json:"price"`
	Side          string    `json:"side"`
	Size          float64   `json:"size"`
	Time          time.Time `json:"time"`
	OrderType     string    `json:"type"`
}

FillsData stores fills' data

type FundingPaymentsData

type FundingPaymentsData struct {
	Future  string    `json:"future"`
	ID      int64     `json:"id"`
	Payment float64   `json:"payment"`
	Time    time.Time `json:"time"`
	Rate    float64   `json:"rate"`
}

FundingPaymentsData stores funding payments' data

type FundingRatesData

type FundingRatesData struct {
	Future string    `json:"future"`
	Rate   float64   `json:"rate"`
	Time   time.Time `json:"time"`
}

FundingRatesData stores data on funding rates

type FutureStatsData

type FutureStatsData struct {
	Volume                   float64   `json:"volume"`
	NextFundingRate          float64   `json:"nextFundingRate"`
	NextFundingTime          time.Time `json:"nextFundingTime"`
	ExpirationPrice          float64   `json:"expirationPrice"`
	PredictedExpirationPrice float64   `json:"predictedExpirationPrice"`
	OpenInterest             float64   `json:"openInterest"`
	StrikePrice              float64   `json:"strikePrice"`
	Greeks                   *struct {
		ImpliedVolatility float64 `json:"impliedVolatility"`
		Delta             float64 `json:"delta"`
		Gamma             float64 `json:"gamma"`
	} `json:"greeks"`
}

FutureStatsData stores data on futures stats

type FuturesData

type FuturesData 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                time.Time   `json:"expiry"`
	ExpiryDescription     string      `json:"expiryDescription"`
	Group                 string      `json:"group"`
	Index                 float64     `json:"index"`
	IMFFactor             float64     `json:"imfFactor"`
	Last                  float64     `json:"last"`
	LowerBound            float64     `json:"lowerBound"`
	MarginPrice           float64     `json:"marginPrice"`
	Mark                  float64     `json:"mark"`
	MoveStart             interface{} `json:"moveStart"`
	Name                  string      `json:"name"`
	OpenInterest          float64     `json:"openInterest"`
	OpenInterestUSD       float64     `json:"openInterestUsd"`
	Perpetual             bool        `json:"perpetual"`
	PositionLimitWeight   float64     `json:"positionLimitWeight"`
	PostOnly              bool        `json:"postOnly"`
	PriceIncrement        float64     `json:"priceIncrement"`
	SizeIncrement         float64     `json:"sizeIncrement"`
	Underlying            string      `json:"underlying"`
	UnderlyingDescription string      `json:"underlyingDescription"`
	UpperBound            float64     `json:"upperBound"`
	FutureType            string      `json:"type"`
}

FuturesData stores data for futures

type IndexWeights

type IndexWeights struct {
	Result map[string]float64 `json:"result"`
}

IndexWeights stores index weights' data

type LTBalanceData

type LTBalanceData struct {
	Token   string  `json:"token"`
	Balance float64 `json:"balance"`
}

LTBalanceData stores balances of leveraged tokens

type LTCreationData

type LTCreationData struct {
	ID            int64     `json:"id"`
	Token         string    `json:"token"`
	RequestedSize float64   `json:"requestedSize"`
	Pending       bool      `json:"pending"`
	CreatedSize   float64   `json:"createdSize"`
	Price         float64   `json:"price"`
	Cost          float64   `json:"cost"`
	Fee           float64   `json:"fee"`
	RequestedAt   time.Time `json:"requestedAt"`
	FulfilledAt   time.Time `json:"fulfilledAt"`
}

LTCreationData stores token creation requests' data

type LTRedemptionData

type LTRedemptionData struct {
	ID          int64     `json:"id"`
	Token       string    `json:"token"`
	Size        float64   `json:"size"`
	Pending     bool      `json:"pending"`
	Price       float64   `json:"price"`
	Proceeds    float64   `json:"proceeds"`
	Fee         float64   `json:"fee"`
	RequestedAt time.Time `json:"requestedAt"`
	FulfilledAt time.Time `json:"fulfilledAt"`
}

LTRedemptionData stores data of the token redemption request

type LTRedemptionRequestData

type LTRedemptionRequestData struct {
	ID                int64     `json:"id"`
	Token             string    `json:"token"`
	Size              float64   `json:"size"`
	ProjectedProceeds float64   `json:"projectedProceeds"`
	Pending           bool      `json:"pending"`
	RequestedAt       time.Time `json:"requestedAt"`
}

LTRedemptionRequestData stores redemption request data for a leveraged token

type LendingInfoData

type LendingInfoData struct {
	Coin     string  `json:"coin"`
	Lendable float64 `json:"lendable"`
	Locked   float64 `json:"locked"`
	MinRate  float64 `json:"minRate"`
	Offered  float64 `json:"offered"`
}

LendingInfoData stores margin lending info

type LendingOffersData

type LendingOffersData struct {
	Coin string  `json:"coin"`
	Rate float64 `json:"rate"`
	Size float64 `json:"size"`
}

LendingOffersData stores data for lending offers

type LeveragedTokensData

type LeveragedTokensData struct {
	Basket            map[string]interface{} `json:"basket"`
	Bep2AssetName     string                 `json:"bep2AssetName"`
	Name              string                 `json:"name"`
	Description       string                 `json:"description"`
	Underlying        string                 `json:"underlying"`
	Leverage          float64                `json:"leverage"`
	Outstanding       float64                `json:"outstanding"`
	PricePerShare     float64                `json:"pricePerShare"`
	PositionPerShare  float64                `json:"positionPerShare"`
	PositionsPerShare interface{}            `json:"positionsPerShare"`
	TargetComponents  []string               `json:"targetComponents"`
	TotalCollateral   float64                `json:"totalCollateral"`
	TotalNav          float64                `json:"totalNav"`
	UnderlyingMark    float64                `json:"underlyingMark"`
	ContactAddress    string                 `json:"contactAddress"`
	Change1h          float64                `json:"change1h"`
	Change24h         float64                `json:"change24h"`
	ChangeBod         float64                `json:"changeBod"`
}

LeveragedTokensData stores data of leveraged tokens

type MarginDailyBorrowStats

type MarginDailyBorrowStats struct {
	Coin string  `json:"coin"`
	Size float64 `json:"size"`
}

MarginDailyBorrowStats stores the daily borrowed amounts

type MarginFundingData

type MarginFundingData struct {
	Coin     string  `json:"coin"`
	Estimate float64 `json:"estimate"`
	Previous float64 `json:"previous"`
}

MarginFundingData stores borrowing/lending data for margin trading

type MarginMarketInfo

type MarginMarketInfo struct {
	Coin          string  `json:"coin"`
	Borrowed      float64 `json:"borrowed"`
	Free          float64 `json:"free"`
	EstimatedRate float64 `json:"estimatedRate"`
	PreviousRate  float64 `json:"previousRate"`
}

MarginMarketInfo stores margin market info

type MarginTransactionHistoryData

type MarginTransactionHistoryData struct {
	Coin string    `json:"coin"`
	Cost float64   `json:"cost"`
	Rate float64   `json:"rate"`
	Size float64   `json:"size"`
	Time time.Time `json:"time"`
}

MarginTransactionHistoryData stores margin borrowing/lending history

type MarketData

type MarketData struct {
	Name                  string  `json:"name"`
	BaseCurrency          string  `json:"baseCurrency"`
	QuoteCurrency         string  `json:"quoteCurrency"`
	MarketType            string  `json:"type"`
	Underlying            string  `json:"underlying"`
	Change1h              float64 `json:"change1h"`
	Change24h             float64 `json:"change24h"`
	ChangeBod             float64 `json:"changeBod"`
	QuoteVolume24h        float64 `json:"quoteVolume24h"`
	Enabled               bool    `json:"enabled"`
	Ask                   float64 `json:"ask"`
	Bid                   float64 `json:"bid"`
	Last                  float64 `json:"last"`
	USDVolume24h          float64 `json:"volumeUSD24h"`
	MinProvideSize        float64 `json:"minProvideSize"`
	PriceIncrement        float64 `json:"priceIncrement"`
	SizeIncrement         float64 `json:"sizeIncrement"`
	Restricted            bool    `json:"restricted"`
	PostOnly              bool    `json:"postOnly"`
	Price                 float64 `json:"price"`
	HighLeverageFeeExempt bool    `json:"highLeverageFeeExempt"`
}

MarketData stores market data

type OData

type OData struct {
	Price float64
	Size  float64
}

OData stores orderdata in orderbook

type OHLCVData

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

OHLCVData stores historical OHLCV data

type OptionData

type OptionData struct {
	Underlying string    `json:"underlying"`
	OptionType string    `json:"type"`
	Strike     float64   `json:"strike"`
	Expiry     time.Time `json:"expiry"`
}

OptionData stores options' data

type OptionFillsData

type OptionFillsData struct {
	Fee       float64    `json:"fee"`
	FeeRate   float64    `json:"feeRate"`
	ID        int64      `json:"id"`
	Liquidity string     `json:"liquidity"`
	Option    OptionData `json:"option"`
	Price     float64    `json:"price"`
	QuoteID   int64      `json:"quoteId"`
	Side      string     `json:"side"`
	Size      float64    `json:"size"`
	Time      string     `json:"time"`
}

OptionFillsData stores option's fills data

type OptionsPositionsData

type OptionsPositionsData struct {
	EntryPrice            float64    `json:"entryPrice"`
	NetSize               float64    `json:"netSize"`
	Option                OptionData `json:"option"`
	Side                  string     `json:"side"`
	Size                  float64    `json:"size"`
	PessimisticValuation  float64    `json:"pessimisticValuation,omitempty"`
	PessimisticIndexPrice float64    `json:"pessimisticIndexPrice,omitempty"`
}

OptionsPositionsData stores options positions' data

type OptionsTradesData

type OptionsTradesData struct {
	ID     int64      `json:"id"`
	Option OptionData `json:"option"`
	Price  float64    `json:"price"`
	Size   float64    `json:"size"`
	Time   time.Time  `json:"time"`
}

OptionsTradesData stores options' trades' data

type OrderData

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

OrderData stores open order data

func (*OrderData) GetCompatible

func (s *OrderData) GetCompatible(ctx context.Context, f *FTX) (OrderVars, error)

GetCompatible gets compatible variables for order vars

type OrderVars

type OrderVars struct {
	Side      order.Side
	Status    order.Status
	OrderType order.Type
	Fee       float64
}

OrderVars stores side, status and type for any order/trade

type OrderbookData

type OrderbookData struct {
	MarketName string
	Asks       []OData
	Bids       []OData
}

OrderbookData stores orderbook data

type PersonalQuotesData

type PersonalQuotesData struct {
	ID             int64       `json:"id"`
	Option         OptionData  `json:"option"`
	Side           string      `json:"side"`
	Size           float64     `json:"size"`
	Time           time.Time   `json:"time"`
	RequestExpiry  string      `json:"requestExpiry"`
	Status         string      `json:"status"`
	HideLimitPrice bool        `json:"hideLimitPrice"`
	LimitPrice     float64     `json:"limitPrice"`
	Quotes         []QuoteData `json:"quotes"`
}

PersonalQuotesData stores data of your quotes

type PositionData

type PositionData struct {
	Cost                         float64 `json:"cost"`
	EntryPrice                   float64 `json:"entryPrice"`
	Future                       string  `json:"future"`
	InitialMarginRequirement     float64 `json:"initialMarginRequirement"`
	LongOrderSize                float64 `json:"longOrderSize"`
	MaintenanceMarginRequirement float64 `json:"maintenanceMarginRequirement"`
	NetSize                      float64 `json:"netSize"`
	OpenSize                     float64 `json:"openSize"`
	RealizedPnL                  float64 `json:"realizedPnL"`
	ShortOrderSize               float64 `json:"shortOrderSize"`
	Side                         string  `json:"side"`
	Size                         float64 `json:"size"`
	UnrealizedPnL                float64 `json:"unrealizedPnL"`
	CollateralUsed               float64 `json:"collateralUsed"`
	EstimatedLiquidationPrice    float64 `json:"estimatedLiquidationPrice"`
}

PositionData stores data of an open position

type QuoteData

type QuoteData struct {
	Collateral  float64   `json:"collateral"`
	ID          int64     `json:"id"`
	Price       float64   `json:"price"`
	QuoteExpiry string    `json:"quoteExpiry"`
	Status      string    `json:"status"`
	Time        time.Time `json:"time"`
}

QuoteData stores quote's data

type QuoteForQuoteData

type QuoteForQuoteData struct {
	Collateral  float64    `json:"collateral"`
	ID          int64      `json:"id"`
	Option      OptionData `json:"option"`
	Price       float64    `json:"price"`
	QuoteExpiry string     `json:"quoteExpiry"`
	QuoterSide  string     `json:"quoterSide"`
	RequestID   int64      `json:"requestID"`
	RequestSide string     `json:"requestSide"`
	Size        float64    `json:"size"`
	Status      string     `json:"status"`
	Time        time.Time  `json:"time"`
}

QuoteForQuoteData gets quote data for your quote

type QuoteRequestData

type QuoteRequestData struct {
	ID            int64      `json:"id"`
	Option        OptionData `json:"option"`
	Side          string     `json:"side"`
	Size          float64    `json:"size"`
	Time          time.Time  `json:"time"`
	RequestExpiry string     `json:"requestExpiry"`
	Status        string     `json:"status"`
}

QuoteRequestData stores option's quote request data

type QuoteStatusData

type QuoteStatusData struct {
	BaseCoin  string  `json:"baseCoin"`
	Cost      float64 `json:"cost"`
	Expired   bool    `json:"expired"`
	Filled    bool    `json:"filled"`
	FromCoin  string  `json:"fromCoin"`
	ID        int64   `json:"id"`
	Price     float64 `json:"price"`
	Proceeds  float64 `json:"proceeds"`
	QuoteCoin string  `json:"quoteCoin"`
	Side      string  `json:"side"`
	ToCoin    string  `json:"toCoin"`
}

QuoteStatusData stores data of quotes' status

type RequestQuoteData

type RequestQuoteData struct {
	QuoteID int64 `json:"quoteId"`
}

RequestQuoteData stores data on the requested quote

type RequestTokenCreationData

type RequestTokenCreationData struct {
	ID            int64     `json:"id"`
	Token         string    `json:"token"`
	RequestedSize float64   `json:"requestedSize"`
	Cost          float64   `json:"cost"`
	Pending       bool      `json:"pending"`
	RequestedAt   time.Time `json:"requestedAt"`
}

RequestTokenCreationData stores data of the token creation requested

type Stake

type Stake struct {
	Coin      string    `json:"coin"`
	CreatedAt time.Time `json:"createdAt"`
	ID        int64     `json:"id"`
	Size      float64   `json:"size"`
}

Stake stores an individual coin stake

type StakeBalance

type StakeBalance struct {
	Coin               string  `json:"coin"`
	LifetimeRewards    float64 `json:"lifetimeRewards"`
	ScheduledToUnstake float64 `json:"scheduledToUnstake"`
	Staked             float64 `json:"staked"`
}

StakeBalance stores an individual coin stake balance

type StakeReward

type StakeReward struct {
	Coin   string    `json:"coin"`
	ID     int64     `json:"id"`
	Size   float64   `json:"size"`
	Notes  string    `json:"notes"`
	Status string    `json:"status"`
	Time   time.Time `json:"time"`
}

StakeReward stores an individual staking reward

type Subaccount

type Subaccount struct {
	Nickname    string `json:"nickname"`
	Special     bool   `json:"special"`
	Deletable   bool   `json:"deletable"`
	Editable    bool   `json:"editable"`
	Competition bool   `json:"competition"`
}

Subaccount stores subaccount data

type SubaccountBalance

type SubaccountBalance struct {
	Coin                   string  `json:"coin"`
	Free                   float64 `json:"free"`
	Total                  float64 `json:"total"`
	SpotBorrow             float64 `json:"spotBorrow"`
	AvailableWithoutBorrow float64 `json:"availableWithoutBorrow"`
}

SubaccountBalance stores the user's subaccount balance

type SubaccountTransferStatus

type SubaccountTransferStatus struct {
	ID     int64     `json:"id"`
	Coin   string    `json:"coin"`
	Size   float64   `json:"size"`
	Time   time.Time `json:"time"`
	Notes  string    `json:"notes"`
	Status string    `json:"status"`
}

SubaccountTransferStatus stores the subaccount transfer details

type TempOBData

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

TempOBData stores orderbook data temporarily

type TimeInterval

type TimeInterval string

TimeInterval represents interval enum.

type TradeData

type TradeData 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"`
}

TradeData stores data from trades

type TriggerData

type TriggerData struct {
	Error      string    `json:"error"`
	FilledSize float64   `json:"filledSize"`
	OrderSize  float64   `json:"orderSize"`
	OrderID    int64     `json:"orderId"`
	Time       time.Time `json:"time"`
}

TriggerData stores trigger orders' trigger data

type TriggerOrderData

type TriggerOrderData struct {
	CreatedAt        time.Time `json:"createdAt"`
	Error            string    `json:"error"`
	Future           string    `json:"future"`
	ID               int64     `json:"id"`
	Market           string    `json:"market"`
	OrderID          int64     `json:"orderId"`
	OrderPrice       float64   `json:"orderPrice"`
	ReduceOnly       bool      `json:"reduceOnly"`
	Side             string    `json:"side"`
	Size             float64   `json:"size"`
	Status           string    `json:"status"`
	TrailStart       float64   `json:"trailStart"`
	TrailValue       float64   `json:"trailvalue"`
	TriggerPrice     float64   `json:"triggerPrice"`
	TriggeredAt      string    `json:"triggeredAt"`
	OrderType        string    `json:"type"`
	MarketOrLimit    string    `json:"orderType"`
	FilledSize       float64   `json:"filledSize"`
	AvgFillPrice     float64   `json:"avgFillPrice"`
	RetryUntilFilled bool      `json:"retryUntilFilled"`
}

TriggerOrderData stores trigger order data

type UnstakeRequest

type UnstakeRequest struct {
	Stake
	Status       string    `json:"status"`
	UnlockAt     time.Time `json:"unlockAt"`
	FractionToGo float64   `json:"fractionToGo"`
	Fee          float64   `json:"fee"`
}

UnstakeRequest stores data for an unstake request

type WSMarkets

type WSMarkets struct {
	Channel     string        `json:"channel"`
	MessageType string        `json:"type"`
	Data        WsMarketsData `json:"data"`
	Action      string        `json:"action"`
}

WSMarkets stores websocket markets data

type WalletBalance

type WalletBalance struct {
	Coin                   string  `json:"coin"`
	Free                   float64 `json:"free"`
	Total                  float64 `json:"total"`
	AvailableWithoutBorrow float64 `json:"availableWithoutBorrow"`
	USDValue               float64 `json:"usdValue"`
	SpotBorrow             float64 `json:"spotBorrow"`
}

WalletBalance stores balances data

type WalletCoinsData

type WalletCoinsData struct {
	USDFungible      bool     `json:"usdFungible"`
	CanDeposit       bool     `json:"canDeposit"`
	CanWithdraw      bool     `json:"canWithdraw"`
	CanConvert       bool     `json:"canConvert"`
	Collateral       bool     `json:"collateral"`
	CollateralWeight float64  `json:"collateralWeight"`
	CreditTo         string   `json:"creditTo"`
	ERC20Contract    string   `json:"erc20Contract"`
	BEP2Asset        string   `json:"bep2Asset"`
	TRC20Contract    string   `json:"trc20Contract"`
	SpotMargin       bool     `json:"spotMargin"`
	IndexPrice       float64  `json:"indexPrice"`
	SPLMint          string   `json:"splMint"`
	Fiat             bool     `json:"fiat"`
	HasTag           bool     `json:"hasTag"`
	Hidden           bool     `json:"hidden"`
	IsETF            bool     `json:"isEtf"`
	IsToken          bool     `json:"isToken"`
	Methods          []string `json:"methods"`
	ID               string   `json:"id"`
	Name             string   `json:"name"`
}

WalletCoinsData stores data about wallet coins

type WithdrawItem

type WithdrawItem struct {
	ID              int64     `json:"id"`
	Coin            string    `json:"coin"`
	Address         string    `json:"address"`
	Tag             string    `json:"tag"`
	Method          string    `json:"method"`
	TXID            string    `json:"txid"`
	Size            float64   `json:"size"`
	Fee             float64   `json:"fee"`
	Status          string    `json:"status"`
	Complete        time.Time `json:"complete"`
	Time            time.Time `json:"time"`
	Notes           string    `json:"notes"`
	DestinationName string    `json:"destinationName"`
}

WithdrawItem stores data about withdraw history

type WsFills

type WsFills struct {
	ID            int64     `json:"id"`
	Market        string    `json:"market"`
	Future        string    `json:"future"`
	BaseCurrency  string    `json:"baseCurrency"`
	QuoteCurrency string    `json:"quoteCurrency"`
	Type          string    `json:"type"`
	Side          string    `json:"side"`
	Price         float64   `json:"price"`
	Size          float64   `json:"size"`
	OrderID       int64     `json:"orderId"`
	Time          time.Time `json:"time"`
	TradeID       int64     `json:"tradeId"`
	FeeRate       float64   `json:"feeRate"`
	Fee           float64   `json:"fee"`
	FeeCurrency   string    `json:"feeCurrency"`
	Liquidity     string    `json:"liquidity"`
}

WsFills stores websocket fills' data

type WsFillsDataStore

type WsFillsDataStore struct {
	Channel     string  `json:"channel"`
	MessageType string  `json:"type"`
	FillsData   WsFills `json:"data"`
}

WsFillsDataStore stores ws fills' data

type WsMarketsData

type WsMarketsData struct {
	Data map[string]WsMarketsDataStorage `json:"data"`
}

WsMarketsData stores websocket markets data

type WsMarketsDataStorage

type WsMarketsDataStorage struct {
	Name           string              `json:"name,omitempty"`
	Enabled        bool                `json:"enabled,omitempty"`
	PriceIncrement float64             `json:"priceIncrement,omitempty"`
	SizeIncrement  float64             `json:"sizeIncrement,omitempty"`
	MarketType     string              `json:"marketType,omitempty"`
	BaseCurrency   string              `json:"baseCurrency,omitempty"`
	QuoteCurrency  string              `json:"quoteCurrency,omitempty"`
	Underlying     string              `json:"underlying,omitempty"`
	Restricted     bool                `json:"restricted,omitempty"`
	Future         WsMarketsFutureData `json:"future,omitempty"`
}

WsMarketsDataStorage stores websocket markets data

type WsMarketsFutureData

type WsMarketsFutureData struct {
	Name                  string    `json:"name,omitempty"`
	Underlying            string    `json:"underlying,omitempty"`
	Description           string    `json:"description,omitempty"`
	MarketType            string    `json:"type,omitempty"`
	Expiry                time.Time `json:"expiry,omitempty"`
	Perpetual             bool      `json:"perpetual,omitempty"`
	Expired               bool      `json:"expired,omitempty"`
	Enabled               bool      `json:"enabled,omitempty"`
	PostOnly              bool      `json:"postOnly,omitempty"`
	IMFFactor             float64   `json:"imfFactor,omitempty"`
	UnderlyingDescription string    `json:"underlyingDescription,omitempty"`
	ExpiryDescription     string    `json:"expiryDescription,omitempty"`
	MoveStart             string    `json:"moveStart,omitempty"`
	PositionLimitWeight   float64   `json:"positionLimitWeight,omitempty"`
	Group                 string    `json:"group,omitempty"`
}

WsMarketsFutureData stores websocket markets' future data

type WsOrderDataStore

type WsOrderDataStore struct {
	Channel     string   `json:"channel"`
	MessageType string   `json:"type"`
	OrderData   WsOrders `json:"data"`
}

WsOrderDataStore stores ws orders' data

type WsOrderbookData

type WsOrderbookData struct {
	Action   string       `json:"action"`
	Bids     [][2]float64 `json:"bids"`
	Asks     [][2]float64 `json:"asks"`
	Time     float64      `json:"time"`
	Checksum int64        `json:"checksum"`
}

WsOrderbookData stores ws orderbook data

type WsOrderbookDataStore

type WsOrderbookDataStore struct {
	Channel     string          `json:"channel"`
	Market      string          `json:"market"`
	MessageType string          `json:"type"`
	OBData      WsOrderbookData `json:"data"`
}

WsOrderbookDataStore stores ws orderbook data

type WsOrders

type WsOrders struct {
	ID            int64     `json:"id"`
	ClientID      string    `json:"clientId"`
	Market        string    `json:"market"`
	OrderType     string    `json:"type"`
	Side          string    `json:"side"`
	Price         float64   `json:"price"`
	Size          float64   `json:"size"`
	Status        string    `json:"status"`
	FilledSize    float64   `json:"filledSize"`
	RemainingSize float64   `json:"remainingSize"`
	ReduceOnly    bool      `json:"reduceOnly"`
	Liquidation   bool      `json:"liquidation"`
	AvgFillPrice  float64   `json:"avgFillPrice"`
	PostOnly      bool      `json:"postOnly"`
	IOC           bool      `json:"ioc"`
	CreatedAt     time.Time `json:"createdAt"`
}

WsOrders stores ws orders' data

type WsResponseData

type WsResponseData struct {
	ResponseType string      `json:"type"`
	Channel      string      `json:"channel"`
	Market       string      `json:"market"`
	Data         interface{} `json:"data"`
}

WsResponseData stores basic ws response data on being subscribed to a channel successfully

type WsSub

type WsSub struct {
	Channel   string `json:"channel,omitempty"`
	Market    string `json:"market,omitempty"`
	Operation string `json:"op,omitempty"`
}

WsSub has the data used to subscribe to a channel

type WsTickerData

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

WsTickerData stores ws ticker data

type WsTickerDataStore

type WsTickerDataStore struct {
	Channel     string       `json:"channel"`
	Market      string       `json:"market"`
	MessageType string       `json:"type"`
	Ticker      WsTickerData `json:"data"`
}

WsTickerDataStore stores ws ticker data

type WsTradeData

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

WsTradeData stores ws trade data

type WsTradeDataStore

type WsTradeDataStore struct {
	Channel     string        `json:"channel"`
	Market      string        `json:"market"`
	MessageType string        `json:"type"`
	TradeData   []WsTradeData `json:"data"`
}

WsTradeDataStore stores ws trades' data

Jump to

Keyboard shortcuts

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