ftx

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 31 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:"float64"`
	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 AllWalletAccountData

type AllWalletAccountData struct {
	Main         []BalancesData `json:"main"`
	BattleRoyale []BalancesData `json:"Battle Royale"`
}

AllWalletAccountData stores account data on all WalletCoins

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

AuthenticationData stores authentication variables required

type BalancesData

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

BalancesData stores balances data

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

DepositData stores deposit address data

type FTX

type FTX struct {
	exchange.Base
}

FTX is the overarching type across this package

func (*FTX) AcceptOTCQuote

func (f *FTX) AcceptOTCQuote(quoteID string) error

AcceptOTCQuote requests for otc quotes

func (*FTX) AcceptQuote

func (f *FTX) AcceptQuote(quoteID string) ([]QuoteForQuoteData, error)

AcceptQuote accepts the quote for quote

func (*FTX) AuthenticateWebsocket

func (f *FTX) AuthenticateWebsocket() 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(orderCancellation *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*FTX) CancelOrder

func (f *FTX) CancelOrder(order *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*FTX) ChangeAccountLeverage

func (f *FTX) ChangeAccountLeverage(leverage float64) error

ChangeAccountLeverage changes default leverage used by account

func (*FTX) CreateQuoteRequest

func (f *FTX) CreateQuoteRequest(underlying, optionType, side string, expiry int64, requestExpiry string, strike, size, limitPrice, counterParyID float64, hideLimitPrice bool) (CreateQuoteRequestData, error)

CreateQuoteRequest sends a request to create a quote

func (*FTX) DeleteMyQuote

func (f *FTX) DeleteMyQuote(quoteID string) ([]QuoteForQuoteData, error)

DeleteMyQuote deletes my quote for quotes

func (*FTX) DeleteOrder

func (f *FTX) DeleteOrder(orderID string) (string, error)

DeleteOrder deletes an order

func (*FTX) DeleteOrderByClientID

func (f *FTX) DeleteOrderByClientID(clientID string) (string, error)

DeleteOrderByClientID deletes an order

func (*FTX) DeleteQuote

func (f *FTX) DeleteQuote(requestID string) (CancelQuoteRequestData, error)

DeleteQuote sends request to cancel a quote

func (*FTX) DeleteTriggerOrder

func (f *FTX) DeleteTriggerOrder(orderID string) (string, error)

DeleteTriggerOrder deletes an order

func (*FTX) FetchAccountInfo

func (f *FTX) FetchAccountInfo() (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*FTX) FetchDepositAddress

func (f *FTX) FetchDepositAddress(coin string) (DepositData, error)

FetchDepositAddress gets deposit address for a given coin

func (*FTX) FetchDepositHistory

func (f *FTX) FetchDepositHistory() ([]TransactionData, error)

FetchDepositHistory gets deposit history

func (*FTX) FetchOrderHistory

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

FetchOrderHistory gets order history

func (*FTX) FetchOrderbook

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

FetchOrderbook returns orderbook base on the currency pair

func (*FTX) FetchTicker

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

FetchTicker returns the ticker for a currency pair

func (*FTX) FetchTradablePairs

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

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*FTX) FetchWithdrawalHistory

func (f *FTX) FetchWithdrawalHistory() ([]TransactionData, 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() (AccountInfoData, error)

GetAccountInfo gets account info

func (*FTX) GetAccountOptionsInfo

func (f *FTX) GetAccountOptionsInfo() (AccountOptionsInfoData, error)

GetAccountOptionsInfo gets account's options' info

func (*FTX) GetActiveOrders

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

GetActiveOrders retrieves any orders that are active/open

func (*FTX) GetAllWalletBalances

func (f *FTX) GetAllWalletBalances() (AllWalletAccountData, error)

GetAllWalletBalances gets all wallets' balances

func (*FTX) GetBalances

func (f *FTX) GetBalances() ([]BalancesData, error)

GetBalances gets balances of the account

func (*FTX) GetCoins

func (f *FTX) GetCoins() ([]WalletCoinsData, error)

GetCoins gets coins' data in the account wallet

func (*FTX) GetDefaultConfig

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

GetDefaultConfig returns a default exchange config

func (*FTX) GetDepositAddress

func (f *FTX) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, error)

GetDepositAddress returns a deposit address for a specified currency

func (*FTX) GetExchangeHistory

func (f *FTX) GetExchangeHistory(p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data within the timeframe provided.

func (*FTX) GetFee

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

GetFee returns an estimate of fee based on type of transaction

func (*FTX) GetFeeByType

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

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

func (*FTX) GetFills

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

GetFills gets fills' data

func (*FTX) GetFundingHistory

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

GetFundingHistory returns funding history, deposits and withdrawals

func (*FTX) GetFundingPayments

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

GetFundingPayments gets funding payments

func (*FTX) GetFundingRates

func (f *FTX) GetFundingRates() ([]FundingRatesData, error)

GetFundingRates gets data on funding rates

func (*FTX) GetFuture

func (f *FTX) GetFuture(futureName string) (FuturesData, error)

GetFuture gets data on a given future

func (*FTX) GetFutureStats

func (f *FTX) GetFutureStats(futureName string) (FutureStatsData, error)

GetFutureStats gets data on a given future's stats

func (*FTX) GetFutures

func (f *FTX) GetFutures() ([]FuturesData, error)

GetFutures gets data on futures

func (*FTX) GetHistoricCandles

func (f *FTX) GetHistoricCandles(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(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) GetHistoricalData

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

GetHistoricalData gets historical OHLCV data for a given market pair

func (*FTX) GetIndexWeights

func (f *FTX) GetIndexWeights(index string) (IndexWeights, error)

GetIndexWeights gets index weights

func (*FTX) GetMarket

func (f *FTX) GetMarket(marketName string) (MarketData, error)

GetMarket gets market data for a provided asset type

func (*FTX) GetMarkets

func (f *FTX) GetMarkets() ([]MarketData, error)

GetMarkets gets market data

func (*FTX) GetOTCQuoteStatus

func (f *FTX) GetOTCQuoteStatus(marketName, quoteID string) ([]QuoteStatusData, error)

GetOTCQuoteStatus gets quote status of a quote

func (*FTX) GetOpenOrders

func (f *FTX) GetOpenOrders(marketName string) ([]OrderData, error)

GetOpenOrders gets open orders

func (*FTX) GetOpenTriggerOrders

func (f *FTX) GetOpenTriggerOrders(marketName, orderType string) ([]TriggerOrderData, error)

GetOpenTriggerOrders gets trigger orders that are currently open

func (*FTX) GetOptionsFills

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

GetOptionsFills gets fills data for options

func (*FTX) GetOptionsPositions

func (f *FTX) GetOptionsPositions() ([]OptionsPositionsData, error)

GetOptionsPositions gets options' positions

func (*FTX) GetOrderHistory

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

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

func (*FTX) GetOrderHistoryById

func (b *FTX) GetOrderHistoryById(getOrdersRequest string) ([]order.Detail, error)

GetOrderHistoryById retrieves specified closed order information Can Limit response to specific order status

func (*FTX) GetOrderInfo

func (f *FTX) GetOrderInfo(orderID string) (order.Detail, error)

GetOrderInfo returns information on a current open order

func (*FTX) GetOrderStatus

func (f *FTX) GetOrderStatus(orderID string) (OrderData, error)

GetOrderStatus gets the order status of a given orderID

func (*FTX) GetOrderStatusByClientID

func (f *FTX) GetOrderStatusByClientID(clientOrderID string) (OrderData, error)

GetOrderStatusByClientID gets the order status of a given clientOrderID

func (*FTX) GetOrderbook

func (f *FTX) GetOrderbook(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() ([]PositionData, error)

GetPositions gets the users positions

func (*FTX) GetPublicOptionsTrades

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

GetPublicOptionsTrades gets options' trades from public

func (*FTX) GetQuoteRequests

func (f *FTX) GetQuoteRequests() ([]QuoteRequestData, error)

GetQuoteRequests gets a list of quote requests

func (*FTX) GetQuotesForYourQuote

func (f *FTX) GetQuotesForYourQuote(requestID string) (QuoteForQuoteData, error)

GetQuotesForYourQuote gets a list of quotes for your quote

func (*FTX) GetTokenInfo

func (f *FTX) GetTokenInfo(tokenName string) ([]LeveragedTokensData, error)

GetTokenInfo gets token info

func (*FTX) GetTrades

func (f *FTX) GetTrades(marketName string, startTime, endTime time.Time, limit int64) ([]TradeData, error)

GetTrades gets trades based on the conditions specified

func (*FTX) GetTriggerOrderHistory

func (f *FTX) GetTriggerOrderHistory(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(orderID string) ([]TriggerData, error)

GetTriggerOrderTriggers gets trigger orders that are currently open

func (*FTX) GetWebsocket

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

GetWebsocket returns a pointer to the exchange websocket

func (*FTX) GetYourQuoteRequests

func (f *FTX) GetYourQuoteRequests() ([]PersonalQuotesData, error)

GetYourQuoteRequests gets a list of your quote requests

func (*FTX) ListLTBalances

func (f *FTX) ListLTBalances() ([]LTBalanceData, error)

ListLTBalances gets leveraged tokens' balances

func (*FTX) ListLTCreations

func (f *FTX) ListLTCreations() ([]LTCreationData, error)

ListLTCreations lists the leveraged tokens' creation requests

func (*FTX) ListLTRedemptions

func (f *FTX) ListLTRedemptions() ([]LTRedemptionData, error)

ListLTRedemptions lists the leveraged tokens' redemption requests

func (*FTX) ListLeveragedTokens

func (f *FTX) ListLeveragedTokens() ([]LeveragedTokensData, error)

ListLeveragedTokens lists leveraged tokens

func (*FTX) MakeQuote

func (f *FTX) MakeQuote(requestID, price string) ([]QuoteForQuoteData, error)

MakeQuote makes a quote for a quote

func (*FTX) ModifyOrder

func (f *FTX) ModifyOrder(action *order.Modify) (string, error)

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

func (*FTX) ModifyOrderByClientID

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

ModifyOrderByClientID modifies a placed order via clientOrderID

func (*FTX) ModifyPlacedOrder

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

ModifyPlacedOrder modifies a placed order

func (*FTX) ModifyTriggerOrder

func (f *FTX) ModifyTriggerOrder(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() ([]QuoteForQuoteData, error)

MyQuotes gets a list of my quotes for quotes

func (*FTX) Order

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

Order places an order

func (*FTX) RequestForQuotes

func (f *FTX) RequestForQuotes(base, quote string, amount float64) (RequestQuoteData, error)

RequestForQuotes requests for otc quotes

func (*FTX) RequestLTCreation

func (f *FTX) RequestLTCreation(tokenName string, size float64) (RequestTokenCreationData, error)

RequestLTCreation sends a request to create a leveraged token

func (*FTX) RequestLTRedemption

func (f *FTX) RequestLTRedemption(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(method, path string, data, result interface{}) error

SendAuthHTTPRequest sends an authenticated request

func (*FTX) SendHTTPRequest

func (f *FTX) SendHTTPRequest(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.ExchangeConfig) error

Setup takes in the supplied exchange configuration details and sets params

func (*FTX) Start

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

Start starts the FTX go routine

func (*FTX) SubmitOrder

func (f *FTX) SubmitOrder(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(marketName, side, orderType, reduceOnly, retryUntilFilled string, size, triggerPrice, orderPrice, trailValue float64) (TriggerOrderData, error)

TriggerOrder places an order

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() (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies

func (*FTX) UpdateOrderbook

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

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*FTX) UpdateTicker

func (f *FTX) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*FTX) UpdateTradablePairs

func (f *FTX) UpdateTradablePairs(forceUpdate bool) error

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

func (*FTX) ValidateCredentials

func (f *FTX) ValidateCredentials() error

ValidateCredentials validates current credentials used for wrapper functionality

func (*FTX) Withdraw

func (f *FTX) Withdraw(coin, address, tag, password, code string, size float64) (TransactionData, error)

Withdraw sends a withdrawal request

func (*FTX) WithdrawCryptocurrencyFunds

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

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*FTX) WithdrawFiatFunds

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

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*FTX) WithdrawFiatFundsToInternationalBank

func (f *FTX) WithdrawFiatFundsToInternationalBank(_ *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"`
	FeeRate       float64   `json:"feeRate"`
	Future        string    `json:"future"`
	ID            string    `json:"id"`
	Liquidity     string    `json:"liquidity"`
	Market        string    `json:"market"`
	BaseCurrency  string    `json:"baseCurrency"`
	QuoteCurrency string    `json:"quoteCurrency"`
	OrderID       string    `json:"orderID"`
	TradeID       string    `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      string    `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"`
}

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"`
	Perpetual           bool        `json:"perpetual"`
	PositionLimitWeight float64     `json:"positionLimitWeight"`
	PostOnly            bool        `json:"postOnly"`
	PriceIncrement      float64     `json:"priceIncrement"`
	SizeIncrement       float64     `json:"sizeIncrement"`
	Underlying          string      `json:"underlying"`
	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            string    `json:"id"`
	Token         string    `json:"token"`
	RequestedSize float64   `json:"requestedSize"`
	Pending       bool      `json:"pending"`
	CreatedSize   float64   `json:"createdize"`
	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                string    `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 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 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"`
}

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(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"`
	RealisedPnL                  float64 `json:"realisedPnL"`
	ShortOrderSide               float64 `json:"shortOrderSide"`
	Side                         string  `json:"side"`
	Size                         float64 `json:"size"`
	UnrealisedPnL                float64 `json:"unrealisedPnL"`
}

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            string    `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 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 TransactionData

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

TransactionData stores data about deposit history

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 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 WalletCoinsData

type WalletCoinsData struct {
	Bep2Asset        interface{} `json:"bep2Asset"`
	CanConvert       bool        `json:"canConvert"`
	CanDeposit       bool        `json:"canDeposit"`
	CanWithdraw      bool        `json:"canWithdraw"`
	Collateral       bool        `json:"collateral"`
	CollateralWeight float64     `json:"collateralWeight"`
	CreditTo         interface{} `json:"creditTo"`
	ERC20Contract    interface{} `json:"erc20Contract"`
	Fiat             bool        `json:"fiat"`
	HasTag           bool        `json:"hasTag"`
	Hidden           bool        `json:"hidden"`
	IsETF            bool        `json:"isEtf"`
	IsToken          bool        `json:"isToken"`
	Methods          []interface{}
	ID               string `json:"id"`
	Name             string `json:"name"`
}

WalletCoinsData stores data about wallet coins

type WsFills

type WsFills struct {
	Fee       float64   `json:"fee"`
	FeeRate   float64   `json:"feeRate"`
	Future    string    `json:"future"`
	ID        int64     `json:"id"`
	Liquidity string    `json:"liquidity"`
	Market    string    `json:"market"`
	OrderID   int64     `json:"int64"`
	TradeID   int64     `json:"tradeID"`
	Price     float64   `json:"price"`
	Side      string    `json:"side"`
	Size      float64   `json:"size"`
	Time      time.Time `json:"time"`
	OrderType string    `json:"orderType"`
}

WsFills stores websocket fills' data

type WsFillsDataStore

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

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"`
	Size          float64 `json:"size"`
	Price         float64 `json:"price"`
	ReduceOnly    bool    `json:"reduceOnly"`
	IOC           bool    `json:"ioc"`
	PostOnly      bool    `json:"postOnly"`
	Status        string  `json:"status"`
	FilledSize    float64 `json:"filedSize"`
	RemainingSize float64 `json:"remainingSize"`
	AvgFillPrice  float64 `json:"avgFillPrice"`
}

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