kucoin

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 47 Imported by: 0

README

GoCryptoTrader package Kucoin

Build Status Software License GoDoc Coverage Status Go Report Card

This kucoin 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

Kucoin 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 b exchange.IBotExchange

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

// Public calls - wrapper functions

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

// Fetches current orderbook information
ob, err := b.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 := b.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

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

// Fetches current orderbook information
ob, err := b.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 := b.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
	// Handle error
}
How to do Websocket public/private calls
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
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

This section is empty.

Functions

This section is empty.

Types

type APIKeyDetail

type APIKeyDetail struct {
	SubName     string               `json:"subName"`
	Remark      string               `json:"remark"`
	APIKey      string               `json:"apiKey"`
	APISecret   string               `json:"apiSecret"`
	Passphrase  string               `json:"passphrase"`
	Permission  string               `json:"permission"`
	IPWhitelist string               `json:"ipWhitelist"`
	CreateAt    convert.ExchangeTime `json:"createdAt"`
}

APIKeyDetail represents the API key detail

type AccountInfo

type AccountInfo struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	// contains filtered or unexported fields
}

AccountInfo represents account information

type AccountLedgerResponse

type AccountLedgerResponse struct {
	CurrentPage int64        `json:"currentPage"`
	PageSize    int64        `json:"pageSize"`
	TotalNum    int64        `json:"totalNum"`
	TotalPage   int64        `json:"totalPage"`
	Items       []LedgerInfo `json:"items"`
}

AccountLedgerResponse represents the account ledger response detailed information

type AccountSummaryInformation

type AccountSummaryInformation struct {
	Data struct {
		Level                 float64 `json:"level"`
		SubQuantity           float64 `json:"subQuantity"`
		MaxDefaultSubQuantity float64 `json:"maxDefaultSubQuantity"`
		MaxSubQuantity        float64 `json:"maxSubQuantity"`
		SpotSubQuantity       float64 `json:"spotSubQuantity"`
		MarginSubQuantity     float64 `json:"marginSubQuantity"`
		FuturesSubQuantity    float64 `json:"futuresSubQuantity"`
		MaxSpotSubQuantity    float64 `json:"maxSpotSubQuantity"`
		MaxMarginSubQuantity  float64 `json:"maxMarginSubQuantity"`
		MaxFuturesSubQuantity float64 `json:"maxFuturesSubQuantity"`
	} `json:"data"`
	Code string `json:"code"`
}

AccountSummaryInformation represents account summary information detail.

type AssetInfo

type AssetInfo struct {
	Symbol     string    `json:"symbol"`
	Status     string    `json:"status"`
	DebtRatio  float64   `json:"debtRatio,string"`
	BaseAsset  baseAsset `json:"baseAsset"`
	QuoteAsset baseAsset `json:"quoteAsset"`
}

AssetInfo holds asset information for an instrument.

type BorrowOrder

type BorrowOrder struct {
	OrderID   string  `json:"orderId"`
	Currency  string  `json:"currency"`
	Size      float64 `json:"size,string"`
	Filled    float64 `json:"filled"`
	MatchList []struct {
		Currency     string               `json:"currency"`
		DailyIntRate float64              `json:"dailyIntRate,string"`
		Size         float64              `json:"size,string"`
		Term         int64                `json:"term"`
		Timestamp    convert.ExchangeTime `json:"timestamp"`
		TradeID      string               `json:"tradeId"`
	} `json:"matchList"`
	Status string `json:"status"`
}

BorrowOrder stores borrow order

type CancelOrderResponse

type CancelOrderResponse struct {
	CancelledOrderID string `json:"cancelledOrderId"`
	ClientOID        string `json:"clientOid"`
	Error
}

CancelOrderResponse represents cancel order response model.

type Chain

type Chain struct {
	Name              string  `json:"chainName"`
	Confirms          int64   `json:"confirms"`
	ContractAddress   string  `json:"contractAddress"`
	WithdrawalMinSize float64 `json:"withdrawalMinSize,string"`
	WithdrawalMinFee  float64 `json:"withdrawalMinFee,string"`
	IsWithdrawEnabled bool    `json:"isWithdrawEnabled"`
	IsDepositEnabled  bool    `json:"isDepositEnabled"`
}

Chain stores blockchain data

type CompletedRepaymentRecord

type CompletedRepaymentRecord struct {
	RepayFinishAt convert.ExchangeTime `json:"repayFinishAt"`
	// contains filtered or unexported fields
}

CompletedRepaymentRecord represents repayment records of isolated margin positions

type CompletedRepaymentRecordsResponse

type CompletedRepaymentRecordsResponse struct {
	CurrentPage int64                      `json:"currentPage"`
	PageSize    int64                      `json:"pageSize"`
	TotalNum    int64                      `json:"totalNum"`
	TotalPage   int64                      `json:"totalPage"`
	Items       []CompletedRepaymentRecord `json:"items"`
}

CompletedRepaymentRecordsResponse represents a completed payment records list.

type ConnectionMessage

type ConnectionMessage struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

ConnectionMessage represents a connection and subscription status message.

type Contract

type Contract struct {
	Symbol                  string               `json:"symbol"`
	RootSymbol              string               `json:"rootSymbol"`
	ContractType            string               `json:"type"`
	FirstOpenDate           convert.ExchangeTime `json:"firstOpenDate"`
	ExpireDate              convert.ExchangeTime `json:"expireDate"`
	SettleDate              convert.ExchangeTime `json:"settleDate"`
	BaseCurrency            string               `json:"baseCurrency"`
	QuoteCurrency           string               `json:"quoteCurrency"`
	SettleCurrency          string               `json:"settleCurrency"`
	MaxOrderQty             float64              `json:"maxOrderQty"`
	MaxPrice                float64              `json:"maxPrice"`
	LotSize                 float64              `json:"lotSize"`
	TickSize                float64              `json:"tickSize"`
	IndexPriceTickSize      float64              `json:"indexPriceTickSize"`
	Multiplier              float64              `json:"multiplier"`
	InitialMargin           float64              `json:"initialMargin"`
	MaintainMargin          float64              `json:"maintainMargin"`
	MaxRiskLimit            float64              `json:"maxRiskLimit"`
	MinRiskLimit            float64              `json:"minRiskLimit"`
	RiskStep                float64              `json:"riskStep"`
	MakerFeeRate            float64              `json:"makerFeeRate"`
	TakerFeeRate            float64              `json:"takerFeeRate"`
	TakerFixFee             float64              `json:"takerFixFee"`
	MakerFixFee             float64              `json:"makerFixFee"`
	SettlementFee           float64              `json:"settlementFee"`
	IsDeleverage            bool                 `json:"isDeleverage"`
	IsQuanto                bool                 `json:"isQuanto"`
	IsInverse               bool                 `json:"isInverse"`
	MarkMethod              string               `json:"markMethod"`
	FairMethod              string               `json:"fairMethod"`
	FundingBaseSymbol       string               `json:"fundingBaseSymbol"`
	FundingQuoteSymbol      string               `json:"fundingQuoteSymbol"`
	FundingRateSymbol       string               `json:"fundingRateSymbol"`
	IndexSymbol             string               `json:"indexSymbol"`
	SettlementSymbol        string               `json:"settlementSymbol"`
	Status                  string               `json:"status"`
	FundingFeeRate          float64              `json:"fundingFeeRate"`
	PredictedFundingFeeRate float64              `json:"predictedFundingFeeRate"`
	OpenInterest            types.Number         `json:"openInterest"`
	TurnoverOf24h           float64              `json:"turnoverOf24h"`
	VolumeOf24h             float64              `json:"volumeOf24h"`
	MarkPrice               float64              `json:"markPrice"`
	IndexPrice              float64              `json:"indexPrice"`
	LastTradePrice          float64              `json:"lastTradePrice"`
	NextFundingRateTime     int64                `json:"nextFundingRateTime"`
	MaxLeverage             float64              `json:"maxLeverage"`
	SourceExchanges         []string             `json:"sourceExchanges"`
	PremiumsSymbol1M        string               `json:"premiumsSymbol1M"`
	PremiumsSymbol8H        string               `json:"premiumsSymbol8H"`
	FundingBaseSymbol1M     string               `json:"fundingBaseSymbol1M"`
	FundingQuoteSymbol1M    string               `json:"fundingQuoteSymbol1M"`
	LowPrice                float64              `json:"lowPrice"`
	HighPrice               float64              `json:"highPrice"`
	PriceChgPct             float64              `json:"priceChgPct"`
	PriceChg                float64              `json:"priceChg"`
}

Contract store contract details

type Currency

type Currency struct {
	WithdrawalMinSize float64 `json:"withdrawalMinSize,string"`
	WithdrawalMinFee  float64 `json:"withdrawalMinFee,string"`
	IsWithdrawEnabled bool    `json:"isWithdrawEnabled"`
	IsDepositEnabled  bool    `json:"isDepositEnabled"`
	// contains filtered or unexported fields
}

Currency stores currency data

type CurrencyDetail

type CurrencyDetail struct {
	Chains []Chain `json:"chains"`
	// contains filtered or unexported fields
}

CurrencyDetail stores currency details

type Decomposition

type Decomposition struct {
	Exchange string  `json:"exchange"`
	Price    float64 `json:"price"`
	Weight   float64 `json:"weight"`
}

Decomposition stores decomposition data

type DeleteSubAccountResponse

type DeleteSubAccountResponse struct {
	SubAccountName string `json:"subName"`
	APIKey         string `json:"apiKey"`
}

DeleteSubAccountResponse represents delete sub-account response.

type Deposit

type Deposit struct {
	Amount    float64 `json:"amount,string"`
	Address   string  `json:"address"`
	Memo      string  `json:"memo"`
	Fee       float64 `json:"fee,string"`
	Remark    string  `json:"remark"`
	CreatedAt convert.ExchangeTime
	UpdatedAt convert.ExchangeTime
	// contains filtered or unexported fields
}

Deposit represents deposit address and detail and timestamp information.

type DepositAddress

type DepositAddress struct {
	Address         string `json:"address"`
	Memo            string `json:"memo"`
	Chain           string `json:"chain"`
	ContractAddress string `json:"contractAddress"` // missing in case of futures
}

DepositAddress represents deposit address information for Spot and Margin trading.

type DepositResponse

type DepositResponse struct {
	CurrentPage int64     `json:"currentPage"`
	PageSize    int64     `json:"pageSize"`
	TotalNum    int64     `json:"totalNum"`
	TotalPage   int64     `json:"totalPage"`
	Items       []Deposit `json:"items"`
}

DepositResponse represents a detailed response for list of deposit.

type Error

type Error struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
}

Error defines all error information for each request

func (Error) GetError

func (e Error) GetError() error

GetError checks and returns an error if it is supplied.

type Fees

type Fees struct {
	Symbol       string  `json:"symbol"`
	TakerFeeRate float64 `json:"takerFeeRate,string"`
	MakerFeeRate float64 `json:"makerFeeRate,string"`
}

Fees represents taker and maker fee information a symbol.

type Fill

type Fill struct {
	Symbol         string               `json:"symbol"`
	TradeID        string               `json:"tradeId"`
	OrderID        string               `json:"orderId"`
	CounterOrderID string               `json:"counterOrderId"`
	Side           string               `json:"side"`
	Liquidity      string               `json:"liquidity"`
	ForceTaker     bool                 `json:"forceTaker"`
	Price          float64              `json:"price,string"`
	Size           float64              `json:"size,string"`
	Funds          float64              `json:"funds,string"`
	Fee            float64              `json:"fee,string"`
	FeeRate        float64              `json:"feeRate,string"`
	FeeCurrency    string               `json:"feeCurrency"`
	Stop           string               `json:"stop"`
	OrderType      string               `json:"type"`
	CreatedAt      convert.ExchangeTime `json:"createdAt"`
	TradeType      string               `json:"tradeType"`
}

Fill represents order fills for margin and spot orders.

type FundingInterestRateResponse

type FundingInterestRateResponse struct {
	List    []FuturesInterestRate `json:"dataList"`
	HasMore bool                  `json:"hasMore"`
}

FundingInterestRateResponse represents a funding interest rate list response information.

type FutureFillsResponse

type FutureFillsResponse struct {
	CurrentPage int64         `json:"currentPage"`
	PageSize    int64         `json:"pageSize"`
	TotalNum    int64         `json:"totalNum"`
	TotalPage   int64         `json:"totalPage"`
	Items       []FuturesFill `json:"items"`
}

FutureFillsResponse represents a future fills list response detail.

type FutureOrdersResponse

type FutureOrdersResponse struct {
	CurrentPage int64          `json:"currentPage"`
	PageSize    int64          `json:"pageSize"`
	TotalNum    int64          `json:"totalNum"`
	TotalPage   int64          `json:"totalPage"`
	Items       []FuturesOrder `json:"items"`
}

FutureOrdersResponse represents a future order response list detail.

type FuturesAccount

type FuturesAccount struct {
	AccountEquity    float64 `json:"accountEquity"` // marginBalance + Unrealised PNL
	UnrealisedPNL    float64 `json:"unrealisedPNL"` // unrealised profit and loss
	MarginBalance    float64 `json:"marginBalance"` // positionMargin + orderMargin + frozenFunds + availableBalance - unrealisedPNL
	PositionMargin   float64 `json:"positionMargin"`
	OrderMargin      float64 `json:"orderMargin"`
	FrozenFunds      float64 `json:"frozenFunds"` // frozen funds for withdrawal and out-transfer
	AvailableBalance float64 `json:"availableBalance"`
	Currency         string  `json:"currency"`
}

FuturesAccount holds futures account detail information.

type FuturesDepositDetail

type FuturesDepositDetail struct {
	Currency   string               `json:"currency"`
	Status     string               `json:"status"`
	Address    string               `json:"address"`
	IsInner    bool                 `json:"isInner"`
	Amount     float64              `json:"amount"`
	Fee        float64              `json:"fee"`
	WalletTxID string               `json:"walletTxId"`
	CreatedAt  convert.ExchangeTime `json:"createdAt"`
}

FuturesDepositDetail represents futures deposit detail information.

type FuturesDepositDetailsResponse

type FuturesDepositDetailsResponse struct {
	CurrentPage int64                  `json:"currentPage"`
	PageSize    int64                  `json:"pageSize"`
	TotalNum    int64                  `json:"totalNum"`
	TotalPage   int64                  `json:"totalPage"`
	Items       []FuturesDepositDetail `json:"items"`
}

FuturesDepositDetailsResponse represents a futures deposits list detail response.

type FuturesFill

type FuturesFill struct {
	Symbol         string               `json:"symbol"`
	TradeID        string               `json:"tradeId"`
	OrderID        string               `json:"orderId"`
	Side           string               `json:"side"`
	Liquidity      string               `json:"liquidity"`
	ForceTaker     bool                 `json:"forceTaker"`
	Price          float64              `json:"price,string"`
	Size           float64              `json:"size,string"`
	Value          float64              `json:"value,string"`
	FeeRate        float64              `json:"feeRate,string"`
	FixFee         float64              `json:"fixFee,string"`
	FeeCurrency    string               `json:"feeCurrency"`
	Stop           string               `json:"stop"`
	Fee            float64              `json:"fee,string"`
	OrderType      string               `json:"orderType"`
	TradeType      string               `json:"tradeType"`
	CreatedAt      convert.ExchangeTime `json:"createdAt"`
	SettleCurrency string               `json:"settleCurrency"`
	TradeTime      convert.ExchangeTime `json:"tradeTime"`
}

FuturesFill represents list of recent fills for futures orders.

type FuturesFundingHistory

type FuturesFundingHistory struct {
	ID             string               `json:"id"`
	Symbol         string               `json:"symbol"`
	Time           convert.ExchangeTime `json:"timePoint"`
	FundingRate    float64              `json:"fundingRate"`
	MarkPrice      float64              `json:"markPrice"`
	PositionQty    float64              `json:"positionQty"`
	PositionCost   float64              `json:"positionCost"`
	Funding        float64              `json:"funding"`
	SettleCurrency string               `json:"settleCurrency"`
}

FuturesFundingHistory represents futures funding information.

type FuturesFundingHistoryResponse

type FuturesFundingHistoryResponse struct {
	DataList []FuturesFundingHistory `json:"dataList"`
	HasMore  bool                    `json:"hasMore"`
}

FuturesFundingHistoryResponse represents funding history response for futures account.

type FuturesFundingRate

type FuturesFundingRate struct {
	FuturesInterestRate
	PredictedValue float64 `json:"predictedValue"`
}

FuturesFundingRate stores funding rate data

type FuturesIndex

type FuturesIndex struct {
	FuturesInterestRate
	DecompositionList []Decomposition `json:"decompositionList"`
}

FuturesIndex stores index data

type FuturesIndexResponse

type FuturesIndexResponse struct {
	List    []FuturesIndex `json:"dataList"`
	HasMore bool           `json:"hasMore"`
}

FuturesIndexResponse represents a response data for futures indexes.

type FuturesInterestRate

type FuturesInterestRate struct {
	Symbol      string               `json:"symbol"`
	TimePoint   convert.ExchangeTime `json:"timePoint"`
	Value       float64              `json:"value"`
	Granularity int64                `json:"granularity"`
}

FuturesInterestRate stores interest rate data

type FuturesInterestRateResponse

type FuturesInterestRateResponse struct {
	List    []FuturesInterestRate `json:"dataList"`
	HasMore bool                  `json:"hasMore"`
}

FuturesInterestRateResponse represents a futures interest rate list response.

type FuturesKline

type FuturesKline struct {
	StartTime time.Time
	Open      float64
	Close     float64
	High      float64
	Low       float64
	Volume    float64
}

FuturesKline stores kline data

type FuturesMarkPrice

type FuturesMarkPrice struct {
	FuturesInterestRate
	IndexPrice float64 `json:"indexPrice"`
}

FuturesMarkPrice stores mark price data

type FuturesOpenOrderStats

type FuturesOpenOrderStats struct {
	OpenOrderBuySize  int64   `json:"openOrderBuySize"`
	OpenOrderSellSize int64   `json:"openOrderSellSize"`
	OpenOrderBuyCost  float64 `json:"openOrderBuyCost,string"`
	OpenOrderSellCost float64 `json:"openOrderSellCost,string"`
	SettleCurrency    string  `json:"settleCurrency"`
}

FuturesOpenOrderStats represents futures open order summary stats information.

type FuturesOrder

type FuturesOrder struct {
	ID             string               `json:"id"`
	Symbol         string               `json:"symbol"`
	OrderType      string               `json:"type"`
	Side           string               `json:"side"`
	Price          float64              `json:"price,string"`
	Size           float64              `json:"size"`
	Value          float64              `json:"value,string"`
	DealValue      float64              `json:"dealValue,string"`
	DealSize       float64              `json:"dealSize"`
	Stp            string               `json:"stp"`
	Stop           string               `json:"stop"`
	StopPriceType  string               `json:"stopPriceType"`
	StopTriggered  bool                 `json:"stopTriggered"`
	StopPrice      float64              `json:"stopPrice,string"`
	TimeInForce    string               `json:"timeInForce"`
	PostOnly       bool                 `json:"postOnly"`
	Hidden         bool                 `json:"hidden"`
	Iceberg        bool                 `json:"iceberg"`
	Leverage       float64              `json:"leverage,string"`
	ForceHold      bool                 `json:"forceHold"`
	CloseOrder     bool                 `json:"closeOrder"`
	VisibleSize    float64              `json:"visibleSize"`
	ClientOid      string               `json:"clientOid"`
	Remark         string               `json:"remark"`
	Tags           string               `json:"tags"`
	IsActive       bool                 `json:"isActive"`
	CancelExist    bool                 `json:"cancelExist"`
	CreatedAt      convert.ExchangeTime `json:"createdAt"`
	UpdatedAt      convert.ExchangeTime `json:"updatedAt"`
	EndAt          convert.ExchangeTime `json:"endAt"`
	OrderTime      convert.ExchangeTime `json:"orderTime"`
	SettleCurrency string               `json:"settleCurrency"`
	Status         string               `json:"status"`
	FilledValue    float64              `json:"filledValue,string"`
	FilledSize     float64              `json:"filledSize"`
	ReduceOnly     bool                 `json:"reduceOnly"`
}

FuturesOrder represents futures order information

type FuturesOrderParam

type FuturesOrderParam struct {
	ClientOrderID string        `json:"clientOid"`
	Side          string        `json:"side"`
	Symbol        currency.Pair `json:"symbol,omitempty"`
	OrderType     string        `json:"type"`
	Remark        string        `json:"remark,omitempty"`
	Stop          string        `json:"stp,omitempty"`           // [optional] Either `down` or `up`. Requires stopPrice and stopPriceType to be defined
	StopPriceType string        `json:"stopPriceType,omitempty"` // [optional] Either TP, IP or MP, Need to be defined if stop is specified. `TP` for trade price, `MP` for Mark price, and "IP" for index price.
	TimeInForce   string        `json:"timeInForce,omitempty"`
	Size          float64       `json:"size,omitempty,string"`
	Price         float64       `json:"price,string,omitempty"`
	StopPrice     float64       `json:"stopPrice,omitempty,string"`
	Leverage      float64       `json:"leverage,omitempty,string"`
	VisibleSize   float64       `json:"visibleSize,omitempty,string"`
	ReduceOnly    bool          `json:"reduceOnly,omitempty"`
	CloseOrder    bool          `json:"closeOrder,omitempty"`
	ForceHold     bool          `json:"forceHold,omitempty"`
	PostOnly      bool          `json:"postOnly,omitempty"`
	Hidden        bool          `json:"hidden,omitempty"`
	Iceberg       bool          `json:"iceberg,omitempty"`
}

FuturesOrderParam represents a query parameter for placing future oorder

type FuturesPosition

type FuturesPosition struct {
	ID                   string               `json:"id"`
	Symbol               string               `json:"symbol"`
	AutoDeposit          bool                 `json:"autoDeposit"`
	MaintMarginReq       float64              `json:"maintMarginReq"`
	RiskLimit            int64                `json:"riskLimit"`
	RealLeverage         float64              `json:"realLeverage"`
	CrossMode            bool                 `json:"crossMode"`
	ADLRankingPercentile float64              `json:"delevPercentage"`
	OpeningTimestamp     convert.ExchangeTime `json:"openingTimestamp"`
	CurrentTimestamp     convert.ExchangeTime `json:"currentTimestamp"`
	CurrentQty           float64              `json:"currentQty"`
	CurrentCost          float64              `json:"currentCost"` // Current position value
	CurrentComm          float64              `json:"currentComm"` // Current commission
	UnrealisedCost       float64              `json:"unrealisedCost"`
	RealisedGrossCost    float64              `json:"realisedGrossCost"`
	RealisedCost         float64              `json:"realisedCost"`
	IsOpen               bool                 `json:"isOpen"`
	MarkPrice            float64              `json:"markPrice"`
	MarkValue            float64              `json:"markValue"`
	PosCost              float64              `json:"posCost"`   // Position value
	PosCross             float64              `json:"posCross"`  // Added margin
	PosInit              float64              `json:"posInit"`   // Leverage margin
	PosComm              float64              `json:"posComm"`   // Bankruptcy cost
	PosLoss              float64              `json:"posLoss"`   // Funding fees paid out
	PosMargin            float64              `json:"posMargin"` // Position margin
	PosMaint             float64              `json:"posMaint"`  // Maintenance margin
	MaintMargin          float64              `json:"maintMargin"`
	RealisedGrossPnl     float64              `json:"realisedGrossPnl"`
	RealisedPnl          float64              `json:"realisedPnl"`
	UnrealisedPnl        float64              `json:"unrealisedPnl"`
	UnrealisedPnlPcnt    float64              `json:"unrealisedPnlPcnt"`
	UnrealisedRoePcnt    float64              `json:"unrealisedRoePcnt"`
	AvgEntryPrice        float64              `json:"avgEntryPrice"`
	LiquidationPrice     float64              `json:"liquidationPrice"`
	BankruptPrice        float64              `json:"bankruptPrice"`
	SettleCurrency       string               `json:"settleCurrency"`
	MaintainMargin       float64              `json:"maintainMargin"`
	RiskLimitLevel       int64                `json:"riskLimitLevel"`
}

FuturesPosition represents futures position detailed information.

type FuturesRiskLimitLevel

type FuturesRiskLimitLevel struct {
	Symbol         string  `json:"symbol"`
	Level          int64   `json:"level"`
	MaxRiskLimit   float64 `json:"maxRiskLimit"`
	MinRiskLimit   float64 `json:"minRiskLimit"`
	MaxLeverage    float64 `json:"maxLeverage"`
	InitialMargin  float64 `json:"initialMargin"`
	MaintainMargin float64 `json:"maintainMargin"`
}

FuturesRiskLimitLevel represents futures risk limit level information.

type FuturesServiceStatus

type FuturesServiceStatus struct {
	Status  string `json:"status"`
	Message string `json:"msg"`
}

FuturesServiceStatus represents service status.

type FuturesTicker

type FuturesTicker struct {
	Sequence     int64                `json:"sequence"`
	Symbol       string               `json:"symbol"`
	Side         order.Side           `json:"side"`
	Size         float64              `json:"size"`
	Price        types.Number         `json:"price"`
	BestBidSize  float64              `json:"bestBidSize"`
	BestBidPrice types.Number         `json:"bestBidPrice"`
	BestAskSize  float64              `json:"bestAskSize"`
	BestAskPrice types.Number         `json:"bestAskPrice"`
	TradeID      string               `json:"tradeId"`
	FilledTime   convert.ExchangeTime `json:"ts"`
}

FuturesTicker stores ticker data

type FuturesTrade

type FuturesTrade struct {
	Sequence     int64                `json:"sequence"`
	TradeID      string               `json:"tradeId"`
	TakerOrderID string               `json:"takerOrderId"`
	MakerOrderID string               `json:"makerOrderId"`
	Price        float64              `json:"price,string"`
	Size         float64              `json:"size"`
	Side         string               `json:"side"`
	FilledTime   convert.ExchangeTime `json:"ts"`
}

FuturesTrade stores trade data

type FuturesTransactionHistory

type FuturesTransactionHistory struct {
	Time          convert.ExchangeTime `json:"time"`
	Type          string               `json:"type"`
	Amount        float64              `json:"amount"`
	Fee           float64              `json:"fee"`
	AccountEquity float64              `json:"accountEquity"`
	Status        string               `json:"status"`
	Remark        string               `json:"remark"`
	Offset        int64                `json:"offset"`
	Currency      string               `json:"currency"`
}

FuturesTransactionHistory represents a transaction history

type FuturesTransactionHistoryResponse

type FuturesTransactionHistoryResponse struct {
	List    []FuturesTransactionHistory `json:"dataList"`
	HasMore bool                        `json:"hasMore"`
}

FuturesTransactionHistoryResponse represents a futures transaction history response.

type FuturesWithdrawalHistory

type FuturesWithdrawalHistory struct {
	WithdrawalID string               `json:"withdrawalId"`
	Currency     string               `json:"currency"`
	Status       string               `json:"status"`
	Address      string               `json:"address"`
	Memo         string               `json:"memo"`
	IsInner      bool                 `json:"isInner"`
	Amount       float64              `json:"amount"`
	Fee          float64              `json:"fee"`
	WalletTxID   string               `json:"walletTxId"`
	CreatedAt    convert.ExchangeTime `json:"createdAt"`
	Remark       string               `json:"remark"`
	Reason       string               `json:"reason"`
}

FuturesWithdrawalHistory represents a list of Futures withdrawal history.

type FuturesWithdrawalLimit

type FuturesWithdrawalLimit struct {
	Currency            string  `json:"currency"`
	ChainID             string  `json:"chainId"`
	LimitAmount         float64 `json:"limitAmount"`
	UsedAmount          float64 `json:"usedAmount"`
	RemainAmount        float64 `json:"remainAmount"`
	AvailableAmount     float64 `json:"availableAmount"`
	WithdrawMinFee      float64 `json:"withdrawMinFee"`
	InnerWithdrawMinFee float64 `json:"innerWithdrawMinFee"`
	WithdrawMinSize     float64 `json:"withdrawMinSize"`
	IsWithdrawEnabled   bool    `json:"isWithdrawEnabled"`
	Precision           float64 `json:"precision"`
}

FuturesWithdrawalLimit represents withdrawal limit information.

type FuturesWithdrawalsListResponse

type FuturesWithdrawalsListResponse struct {
	CurrentPage int64                      `json:"currentPage"`
	PageSize    int64                      `json:"pageSize"`
	TotalNum    int64                      `json:"totalNum"`
	TotalPage   int64                      `json:"totalPage"`
	Items       []FuturesWithdrawalHistory `json:"items"`
}

FuturesWithdrawalsListResponse represents a list of futures Withdrawal history instance.

type HistoricalDepositWithdrawal

type HistoricalDepositWithdrawal struct {
	Amount    float64              `json:"amount,string"`
	CreatedAt convert.ExchangeTime `json:"createAt"`
	// contains filtered or unexported fields
}

HistoricalDepositWithdrawal represents deposit and withdrawal funding item.

type HistoricalDepositWithdrawalResponse

type HistoricalDepositWithdrawalResponse struct {
	CurrentPage int64                         `json:"currentPage"`
	PageSize    int64                         `json:"pageSize"`
	TotalNum    int64                         `json:"totalNum"`
	TotalPage   int64                         `json:"totalPage"`
	Items       []HistoricalDepositWithdrawal `json:"items"`
}

HistoricalDepositWithdrawalResponse represents deposit and withdrawal funding items details.

type InstanceServer

type InstanceServer struct {
	Endpoint     string `json:"endpoint"`
	Encrypt      bool   `json:"encrypt"`
	Protocol     string `json:"protocol"`
	PingInterval int64  `json:"pingInterval"`
	PingTimeout  int64  `json:"pingTimeout"`
}

InstanceServer represents a single websocket instance server information.

type IsolatedMarginAccountInfo

type IsolatedMarginAccountInfo struct {
	TotalConversionBalance     float64     `json:"totalConversionBalance,string"`
	LiabilityConversionBalance float64     `json:"liabilityConversionBalance,string"`
	Assets                     []AssetInfo `json:"assets"`
}

IsolatedMarginAccountInfo holds isolated margin accounts of the current user

type IsolatedMarginBorrowing

type IsolatedMarginBorrowing struct {
	OrderID    string  `json:"orderId"`
	Currency   string  `json:"currency"`
	ActualSize float64 `json:"actualSize,string"`
}

IsolatedMarginBorrowing represents response data for initiating isolated margin borrowing.

type IsolatedMarginPairConfig

type IsolatedMarginPairConfig struct {
	Symbol                string  `json:"symbol"`
	SymbolName            string  `json:"symbolName"`
	BaseCurrency          string  `json:"baseCurrency"`
	QuoteCurrency         string  `json:"quoteCurrency"`
	MaxLeverage           int64   `json:"maxLeverage"`
	LiquidationDebtRatio  float64 `json:"flDebtRatio,string"`
	TradeEnable           bool    `json:"tradeEnable"`
	AutoRenewMaxDebtRatio float64 `json:"autoRenewMaxDebtRatio,string"`
	BaseBorrowEnable      bool    `json:"baseBorrowEnable"`
	QuoteBorrowEnable     bool    `json:"quoteBorrowEnable"`
	BaseTransferInEnable  bool    `json:"baseTransferInEnable"`
	QuoteTransferInEnable bool    `json:"quoteTransferInEnable"`
}

IsolatedMarginPairConfig current isolated margin trading pair configuration

type Kline

type Kline struct {
	StartTime time.Time
	Open      float64
	Close     float64
	High      float64
	Low       float64
	Volume    float64 // Transaction volume
	Amount    float64 // Transaction amount
}

Kline stores kline data

type Kucoin

type Kucoin struct {
	exchange.Base
	// contains filtered or unexported fields
}

Kucoin is the overarching type across this package

func (*Kucoin) AddMargin

func (ku *Kucoin) AddMargin(ctx context.Context, symbol, uniqueID string, margin float64) (*FuturesPosition, error)

AddMargin is used to add margin manually

func (*Kucoin) ApplyWithdrawal

func (ku *Kucoin) ApplyWithdrawal(ctx context.Context, ccy, address, memo, remark, chain, feeDeductType string, isInner bool, amount float64) (string, error)

ApplyWithdrawal create a withdrawal request The endpoint was deprecated for futures, please transfer assets from the FUTURES account to the MAIN account first, and then withdraw from the MAIN account

func (*Kucoin) CalculateAssets

func (ku *Kucoin) CalculateAssets(topic string, cp currency.Pair) ([]asset.Item, error)

CalculateAssets returns the available asset types for a currency pair

func (*Kucoin) CancelAllFuturesOpenOrders

func (ku *Kucoin) CancelAllFuturesOpenOrders(ctx context.Context, symbol string) ([]string, error)

CancelAllFuturesOpenOrders used to cancel all futures order excluding stop orders

func (*Kucoin) CancelAllFuturesStopOrders

func (ku *Kucoin) CancelAllFuturesStopOrders(ctx context.Context, symbol string) ([]string, error)

CancelAllFuturesStopOrders used to cancel all untriggered stop orders

func (*Kucoin) CancelAllOpenOrders

func (ku *Kucoin) CancelAllOpenOrders(ctx context.Context, symbol, tradeType string) ([]string, error)

CancelAllOpenOrders used to cancel all order based upon the parameters passed

func (*Kucoin) CancelAllOrders

func (ku *Kucoin) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Kucoin) CancelBatchOrders

func (ku *Kucoin) CancelBatchOrders(ctx context.Context, orderCancellation []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels orders by their corresponding ID numbers

func (*Kucoin) CancelFuturesOrder

func (ku *Kucoin) CancelFuturesOrder(ctx context.Context, orderID string) ([]string, error)

CancelFuturesOrder used to cancel single order previously placed including a stop order

func (*Kucoin) CancelFuturesTransferOut

func (ku *Kucoin) CancelFuturesTransferOut(ctx context.Context, applyID string) error

CancelFuturesTransferOut is used to cancel transfer out request of only PROCESSING status

func (*Kucoin) CancelFuturesWithdrawal

func (ku *Kucoin) CancelFuturesWithdrawal(ctx context.Context, withdrawalID string) (bool, error)

CancelFuturesWithdrawal is used to cancel withdrawal request of only PROCESSING status

func (*Kucoin) CancelLendOrder

func (ku *Kucoin) CancelLendOrder(ctx context.Context, orderID string) error

CancelLendOrder used to cancel lend order

func (*Kucoin) CancelOrder

func (ku *Kucoin) CancelOrder(ctx context.Context, ord *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Kucoin) CancelOrderByClientOID

func (ku *Kucoin) CancelOrderByClientOID(ctx context.Context, orderID string) (*CancelOrderResponse, error)

CancelOrderByClientOID used to cancel order via the clientOid

func (*Kucoin) CancelSingleOrder

func (ku *Kucoin) CancelSingleOrder(ctx context.Context, orderID string) ([]string, error)

CancelSingleOrder used to cancel single order previously placed

func (*Kucoin) CancelStopOrder

func (ku *Kucoin) CancelStopOrder(ctx context.Context, orderID string) ([]string, error)

CancelStopOrder used to cancel single stop order previously placed

func (*Kucoin) CancelStopOrderByClientID

func (ku *Kucoin) CancelStopOrderByClientID(ctx context.Context, symbol, clientOID string) (*CancelOrderResponse, error)

CancelStopOrderByClientID used to cancel a stop order via the clientOID.

func (*Kucoin) CancelStopOrders

func (ku *Kucoin) CancelStopOrders(ctx context.Context, symbol, tradeType, orderIDs string) ([]string, error)

CancelStopOrders used to cancel all order based upon the parameters passed

func (*Kucoin) CancelWithdrawal

func (ku *Kucoin) CancelWithdrawal(ctx context.Context, withdrawalID string) error

CancelWithdrawal used to cancel a withdrawal request

func (*Kucoin) ChangePositionMargin

func (ku *Kucoin) ChangePositionMargin(ctx context.Context, r *margin.PositionChangeRequest) (*margin.PositionChangeResponse, error)

ChangePositionMargin will modify a position/currencies margin parameters

func (*Kucoin) CreateDepositAddress

func (ku *Kucoin) CreateDepositAddress(ctx context.Context, ccy, chain string) (*DepositAddress, error)

CreateDepositAddress create a deposit address for a currency you intend to deposit

func (*Kucoin) CreateFuturesSubAccountAPIKey

func (ku *Kucoin) CreateFuturesSubAccountAPIKey(ctx context.Context, ipWhitelist, passphrase, permission, remark, subName string) (*APIKeyDetail, error)

CreateFuturesSubAccountAPIKey is used to create Futures APIs for sub-accounts

func (*Kucoin) CreateSpotAPIsForSubAccount

func (ku *Kucoin) CreateSpotAPIsForSubAccount(ctx context.Context, arg *SpotAPISubAccountParams) (*SpotAPISubAccount, error)

CreateSpotAPIsForSubAccount can be used to create Spot APIs for sub-accounts.

func (*Kucoin) CreateSubUser

func (ku *Kucoin) CreateSubUser(ctx context.Context, subAccountName, password, remarks, access string) (*SubAccount, error)

CreateSubUser creates a new sub-user for the account.

func (*Kucoin) DeleteSubAccountSpotAPI

func (ku *Kucoin) DeleteSubAccountSpotAPI(ctx context.Context, apiKey, passphrase, subAccountName string) (*DeleteSubAccountResponse, error)

DeleteSubAccountSpotAPI delete sub-account Spot APIs.

func (*Kucoin) FetchAccountInfo

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

FetchAccountInfo retrieves balances for all enabled currencies

func (*Kucoin) FetchOrderbook

func (ku *Kucoin) FetchOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Kucoin) FetchTicker

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

FetchTicker returns the ticker for a currency pair

func (*Kucoin) FetchTradablePairs

func (ku *Kucoin) FetchTradablePairs(ctx context.Context, assetType asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Kucoin) FuturesUpdateRiskLmitLevel

func (ku *Kucoin) FuturesUpdateRiskLmitLevel(ctx context.Context, symbol string, level int64) (bool, error)

FuturesUpdateRiskLmitLevel is used to adjustment the risk limit level

func (*Kucoin) GenerateDefaultSubscriptions

func (ku *Kucoin) GenerateDefaultSubscriptions() ([]subscription.Subscription, error)

GenerateDefaultSubscriptions Adds default subscriptions to websocket.

func (*Kucoin) Get24hrStats

func (ku *Kucoin) Get24hrStats(ctx context.Context, pair string) (*Stats24hrs, error)

Get24hrStats get the statistics of the specified pair in the last 24 hours

func (*Kucoin) GetAccount

func (ku *Kucoin) GetAccount(ctx context.Context, accountID string) (*AccountInfo, error)

GetAccount get information of single account

func (*Kucoin) GetAccountFundingHistory

func (ku *Kucoin) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Kucoin) GetAccountLedgers

func (ku *Kucoin) GetAccountLedgers(ctx context.Context, ccy, direction, bizType string, startAt, endAt time.Time) (*AccountLedgerResponse, error)

GetAccountLedgers get the history of deposit/withdrawal of all accounts, supporting inquiry of various currencies

func (*Kucoin) GetAccountLendRecord

func (ku *Kucoin) GetAccountLendRecord(ctx context.Context, ccy string) ([]LendRecord, error)

GetAccountLendRecord get the lending history of the main account

func (*Kucoin) GetAccountSummaryInformation

func (ku *Kucoin) GetAccountSummaryInformation(ctx context.Context) (*AccountSummaryInformation, error)

GetAccountSummaryInformation this can be used to obtain account summary information.

func (*Kucoin) GetActiveOrder

func (ku *Kucoin) GetActiveOrder(ctx context.Context, ccy string) ([]LendOrder, error)

GetActiveOrder gets active lend orders

func (*Kucoin) GetActiveOrders

func (ku *Kucoin) GetActiveOrders(ctx context.Context, getOrdersRequest *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*Kucoin) GetAggregatedSubAccountBalance

func (ku *Kucoin) GetAggregatedSubAccountBalance(ctx context.Context) ([]SubAccountInfo, error)

GetAggregatedSubAccountBalance get the account info of all sub-users

func (*Kucoin) GetAllAccounts

func (ku *Kucoin) GetAllAccounts(ctx context.Context, ccy, accountType string) ([]AccountInfo, error)

GetAllAccounts get all accounts

func (*Kucoin) GetAuthenticatedInstanceServers

func (ku *Kucoin) GetAuthenticatedInstanceServers(ctx context.Context) (*WSInstanceServers, error)

GetAuthenticatedInstanceServers retrieves server instances for authenticated users.

func (*Kucoin) GetAvailableTransferChains

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

GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency

func (*Kucoin) GetBasicFee

func (ku *Kucoin) GetBasicFee(ctx context.Context, currencyType string) (*Fees, error)

GetBasicFee get basic fee rate of users

func (*Kucoin) GetBorrowOrder

func (ku *Kucoin) GetBorrowOrder(ctx context.Context, orderID string) (*BorrowOrder, error)

GetBorrowOrder gets borrow order information

func (*Kucoin) GetCollateralMode

func (ku *Kucoin) GetCollateralMode(_ context.Context, _ asset.Item) (collateral.Mode, error)

GetCollateralMode returns the collateral type for your account

func (*Kucoin) GetCurrencies

func (ku *Kucoin) GetCurrencies(ctx context.Context) ([]Currency, error)

GetCurrencies gets list of currencies

func (*Kucoin) GetCurrencyDetail

func (ku *Kucoin) GetCurrencyDetail(ctx context.Context, ccy, chain string) (*CurrencyDetail, error)

GetCurrencyDetail gets currency detail using currency code and chain information.

func (*Kucoin) GetCurrencyTradeURL

func (ku *Kucoin) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)

GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair

func (*Kucoin) GetCurrentServerTime

func (ku *Kucoin) GetCurrentServerTime(ctx context.Context) (time.Time, error)

GetCurrentServerTime gets the server time

func (*Kucoin) GetDepositAddress

func (ku *Kucoin) GetDepositAddress(ctx context.Context, c currency.Code, _, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Kucoin) GetDepositAddressV1

func (ku *Kucoin) GetDepositAddressV1(ctx context.Context, ccy, chain string) (*DepositAddress, error)

GetDepositAddressV1 get a deposit address for the currency you intend to deposit

func (*Kucoin) GetDepositAddressesV2

func (ku *Kucoin) GetDepositAddressesV2(ctx context.Context, ccy string) ([]DepositAddress, error)

GetDepositAddressesV2 get all deposit addresses for the currency you intend to deposit

func (*Kucoin) GetDepositList

func (ku *Kucoin) GetDepositList(ctx context.Context, ccy, status string, startAt, endAt time.Time) (*DepositResponse, error)

GetDepositList get deposit list items and sorted to show the latest first

func (*Kucoin) GetFeeByType

func (ku *Kucoin) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

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

func (*Kucoin) GetFiatPrice

func (ku *Kucoin) GetFiatPrice(ctx context.Context, base, currencies string) (map[string]string, error)

GetFiatPrice gets fiat prices of currencies, default base currency is USD

func (*Kucoin) GetFills

func (ku *Kucoin) GetFills(ctx context.Context, orderID, symbol, side, orderType, tradeType string, startAt, endAt time.Time) (*ListFills, error)

GetFills get fills

func (*Kucoin) GetFuturesAccountOverview

func (ku *Kucoin) GetFuturesAccountOverview(ctx context.Context, currency string) (FuturesAccount, error)

GetFuturesAccountOverview gets future account overview

func (*Kucoin) GetFuturesContract

func (ku *Kucoin) GetFuturesContract(ctx context.Context, symbol string) (*Contract, error)

GetFuturesContract get contract details

func (*Kucoin) GetFuturesContractDetails

func (ku *Kucoin) GetFuturesContractDetails(ctx context.Context, item asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns details about futures contracts

func (*Kucoin) GetFuturesCurrentFundingRate

func (ku *Kucoin) GetFuturesCurrentFundingRate(ctx context.Context, symbol string) (*FuturesFundingRate, error)

GetFuturesCurrentFundingRate get current funding rate

func (*Kucoin) GetFuturesCurrentMarkPrice

func (ku *Kucoin) GetFuturesCurrentMarkPrice(ctx context.Context, symbol string) (*FuturesMarkPrice, error)

GetFuturesCurrentMarkPrice get current mark price

func (*Kucoin) GetFuturesDepositAddress

func (ku *Kucoin) GetFuturesDepositAddress(ctx context.Context, currency string) (*DepositAddress, error)

GetFuturesDepositAddress gets deposit address for currency

func (*Kucoin) GetFuturesDepositsList

func (ku *Kucoin) GetFuturesDepositsList(ctx context.Context, currency, status string, startAt, endAt time.Time) (*FuturesDepositDetailsResponse, error)

GetFuturesDepositsList gets deposits list

func (*Kucoin) GetFuturesFills

func (ku *Kucoin) GetFuturesFills(ctx context.Context, orderID, symbol, side, orderType string, startAt, endAt time.Time) (*FutureFillsResponse, error)

GetFuturesFills gets list of recent fills

func (*Kucoin) GetFuturesFundingHistory

func (ku *Kucoin) GetFuturesFundingHistory(ctx context.Context, symbol string, offset, maxCount int64, reverse, forward bool, startAt, endAt time.Time) (*FuturesFundingHistoryResponse, error)

GetFuturesFundingHistory gets information about funding history

func (*Kucoin) GetFuturesIndexList

func (ku *Kucoin) GetFuturesIndexList(ctx context.Context, symbol string, startAt, endAt time.Time, reverse, forward bool, offset, maxCount int64) (*FuturesIndexResponse, error)

GetFuturesIndexList retrieves futures index information for a symbol

func (*Kucoin) GetFuturesInterestRate

func (ku *Kucoin) GetFuturesInterestRate(ctx context.Context, symbol string, startAt, endAt time.Time, reverse, forward bool, offset, maxCount int64) (*FundingInterestRateResponse, error)

GetFuturesInterestRate get interest rate

func (*Kucoin) GetFuturesKline

func (ku *Kucoin) GetFuturesKline(ctx context.Context, granularity int64, symbol string, from, to time.Time) ([]FuturesKline, error)

GetFuturesKline get contract's kline data

func (*Kucoin) GetFuturesOpenContracts

func (ku *Kucoin) GetFuturesOpenContracts(ctx context.Context) ([]Contract, error)

GetFuturesOpenContracts gets all open futures contract with its details

func (*Kucoin) GetFuturesOpenOrderStats

func (ku *Kucoin) GetFuturesOpenOrderStats(ctx context.Context, symbol string) (*FuturesOpenOrderStats, error)

GetFuturesOpenOrderStats gets the total number and value of the all your active orders

func (*Kucoin) GetFuturesOrderDetails

func (ku *Kucoin) GetFuturesOrderDetails(ctx context.Context, orderID string) (*FuturesOrder, error)

GetFuturesOrderDetails gets single order details by order ID

func (*Kucoin) GetFuturesOrderDetailsByClientID

func (ku *Kucoin) GetFuturesOrderDetailsByClientID(ctx context.Context, clientID string) (*FuturesOrder, error)

GetFuturesOrderDetailsByClientID gets single order details by client ID

func (*Kucoin) GetFuturesOrderbook

func (ku *Kucoin) GetFuturesOrderbook(ctx context.Context, symbol string) (*Orderbook, error)

GetFuturesOrderbook gets full orderbook for a specified symbol

func (*Kucoin) GetFuturesOrders

func (ku *Kucoin) GetFuturesOrders(ctx context.Context, status, symbol, side, orderType string, startAt, endAt time.Time) (*FutureOrdersResponse, error)

GetFuturesOrders gets the user current futures order list

func (*Kucoin) GetFuturesPartOrderbook100

func (ku *Kucoin) GetFuturesPartOrderbook100(ctx context.Context, symbol string) (*Orderbook, error)

GetFuturesPartOrderbook100 gets orderbook for a specified symbol with depth 100

func (*Kucoin) GetFuturesPartOrderbook20

func (ku *Kucoin) GetFuturesPartOrderbook20(ctx context.Context, symbol string) (*Orderbook, error)

GetFuturesPartOrderbook20 gets orderbook for a specified symbol with depth 20

func (*Kucoin) GetFuturesPosition

func (ku *Kucoin) GetFuturesPosition(ctx context.Context, symbol string) (*FuturesPosition, error)

GetFuturesPosition gets the position details of a specified position

func (*Kucoin) GetFuturesPositionList

func (ku *Kucoin) GetFuturesPositionList(ctx context.Context) ([]FuturesPosition, error)

GetFuturesPositionList gets the list of position with details

func (*Kucoin) GetFuturesPositionOrders

func (ku *Kucoin) GetFuturesPositionOrders(ctx context.Context, r *futures.PositionsRequest) ([]futures.PositionResponse, error)

GetFuturesPositionOrders returns the orders for futures positions

func (*Kucoin) GetFuturesPositionSummary

func (ku *Kucoin) GetFuturesPositionSummary(ctx context.Context, r *futures.PositionSummaryRequest) (*futures.PositionSummary, error)

GetFuturesPositionSummary returns position summary details for an active position

func (*Kucoin) GetFuturesPremiumIndex

func (ku *Kucoin) GetFuturesPremiumIndex(ctx context.Context, symbol string, startAt, endAt time.Time, reverse, forward bool, offset, maxCount int64) (*FuturesInterestRateResponse, error)

GetFuturesPremiumIndex get premium index

func (*Kucoin) GetFuturesRecentCompletedOrders

func (ku *Kucoin) GetFuturesRecentCompletedOrders(ctx context.Context) ([]FuturesOrder, error)

GetFuturesRecentCompletedOrders gets list of recent 1000 orders in the last 24 hours

func (*Kucoin) GetFuturesRecentFills

func (ku *Kucoin) GetFuturesRecentFills(ctx context.Context) ([]FuturesFill, error)

GetFuturesRecentFills gets list of 1000 recent fills in the last 24 hrs

func (*Kucoin) GetFuturesRiskLimitLevel

func (ku *Kucoin) GetFuturesRiskLimitLevel(ctx context.Context, symbol string) ([]FuturesRiskLimitLevel, error)

GetFuturesRiskLimitLevel gets information about risk limit level of a specific contract

func (*Kucoin) GetFuturesServerTime

func (ku *Kucoin) GetFuturesServerTime(ctx context.Context) (time.Time, error)

GetFuturesServerTime get server time

func (*Kucoin) GetFuturesServiceStatus

func (ku *Kucoin) GetFuturesServiceStatus(ctx context.Context) (*FuturesServiceStatus, error)

GetFuturesServiceStatus get service status

func (*Kucoin) GetFuturesTicker

func (ku *Kucoin) GetFuturesTicker(ctx context.Context, symbol string) (*FuturesTicker, error)

GetFuturesTicker get real time ticker

func (*Kucoin) GetFuturesTickers

func (ku *Kucoin) GetFuturesTickers(ctx context.Context) ([]*ticker.Price, error)

GetFuturesTickers does n * REST requests based on enabled pairs of the futures asset type

func (*Kucoin) GetFuturesTradeHistory

func (ku *Kucoin) GetFuturesTradeHistory(ctx context.Context, symbol string) ([]FuturesTrade, error)

GetFuturesTradeHistory get last 100 trades for symbol

func (*Kucoin) GetFuturesTransactionHistory

func (ku *Kucoin) GetFuturesTransactionHistory(ctx context.Context, currency, txType string, offset, maxCount int64, forward bool, startAt, endAt time.Time) (*FuturesTransactionHistoryResponse, error)

GetFuturesTransactionHistory gets future transaction history

func (*Kucoin) GetFuturesTransferOutList

func (ku *Kucoin) GetFuturesTransferOutList(ctx context.Context, currency, status string, startAt, endAt time.Time) (*TransferListsResponse, error)

GetFuturesTransferOutList gets list of transfer out

func (*Kucoin) GetFuturesWithdrawalLimit

func (ku *Kucoin) GetFuturesWithdrawalLimit(ctx context.Context, currency string) (*FuturesWithdrawalLimit, error)

GetFuturesWithdrawalLimit gets withdrawal limits for currency

func (*Kucoin) GetFuturesWithdrawalList

func (ku *Kucoin) GetFuturesWithdrawalList(ctx context.Context, currency, status string, startAt, endAt time.Time) (*FuturesWithdrawalsListResponse, error)

GetFuturesWithdrawalList gets withdrawal list

func (*Kucoin) GetHistoricCandles

func (ku *Kucoin) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

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

func (*Kucoin) GetHistoricCandlesExtended

func (ku *Kucoin) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

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

func (*Kucoin) GetHistoricTrades

func (ku *Kucoin) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Kucoin) GetHistoricalDepositList

func (ku *Kucoin) GetHistoricalDepositList(ctx context.Context, ccy, status string, startAt, endAt time.Time) (*HistoricalDepositWithdrawalResponse, error)

GetHistoricalDepositList get historical deposit list items

func (*Kucoin) GetHistoricalFundingRates

func (ku *Kucoin) GetHistoricalFundingRates(_ context.Context, _ *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error)

GetHistoricalFundingRates returns funding rates for a given asset and currency for a time period

func (*Kucoin) GetHistoricalWithdrawalList

func (ku *Kucoin) GetHistoricalWithdrawalList(ctx context.Context, ccy, status string, startAt, endAt time.Time, currentPage, pageSize int64) (*HistoricalDepositWithdrawalResponse, error)

GetHistoricalWithdrawalList get historical withdrawal list items

func (*Kucoin) GetInstanceServers

func (ku *Kucoin) GetInstanceServers(ctx context.Context) (*WSInstanceServers, error)

GetInstanceServers retrieves the server list and temporary public token

func (*Kucoin) GetIsolatedMarginAccountInfo

func (ku *Kucoin) GetIsolatedMarginAccountInfo(ctx context.Context, balanceCurrency string) (*IsolatedMarginAccountInfo, error)

GetIsolatedMarginAccountInfo get all isolated margin accounts of the current user

func (*Kucoin) GetIsolatedMarginPairConfig

func (ku *Kucoin) GetIsolatedMarginPairConfig(ctx context.Context) ([]IsolatedMarginPairConfig, error)

GetIsolatedMarginPairConfig get the current isolated margin trading pair configuration

func (*Kucoin) GetIsolatedMarginRepaymentRecords

func (ku *Kucoin) GetIsolatedMarginRepaymentRecords(ctx context.Context, symbol, ccy string, pageSize, currentPage int64) (*CompletedRepaymentRecordsResponse, error)

GetIsolatedMarginRepaymentRecords get the repayment records of isolated margin positions

func (*Kucoin) GetIsolatedOutstandingRepaymentRecords

func (ku *Kucoin) GetIsolatedOutstandingRepaymentRecords(ctx context.Context, symbol, ccy string, pageSize, currentPage int64) (*OutstandingRepaymentRecordsResponse, error)

GetIsolatedOutstandingRepaymentRecords get the outstanding repayment records of isolated margin positions

func (*Kucoin) GetKlines

func (ku *Kucoin) GetKlines(ctx context.Context, pair, period string, start, end time.Time) ([]Kline, error)

GetKlines gets kline of the specified pair

func (*Kucoin) GetLatestFundingRates

func (ku *Kucoin) GetLatestFundingRates(ctx context.Context, r *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)

GetLatestFundingRates returns the latest funding rates data

func (*Kucoin) GetLendHistory

func (ku *Kucoin) GetLendHistory(ctx context.Context, ccy string) ([]LendOrderHistory, error)

GetLendHistory gets lend orders

func (*Kucoin) GetLendingMarketData

func (ku *Kucoin) GetLendingMarketData(ctx context.Context, ccy string, term int64) ([]LendMarketData, error)

GetLendingMarketData get the lending market data

func (*Kucoin) GetLeverage

func (ku *Kucoin) GetLeverage(_ context.Context, _ asset.Item, _ currency.Pair, _ margin.Type, _ order.Side) (float64, error)

GetLeverage gets the account's initial leverage for the asset type and pair

func (*Kucoin) GetMarginAccount

func (ku *Kucoin) GetMarginAccount(ctx context.Context) (*MarginAccounts, error)

GetMarginAccount gets configure info of the margin

func (*Kucoin) GetMarginConfiguration

func (ku *Kucoin) GetMarginConfiguration(ctx context.Context) (*MarginConfiguration, error)

GetMarginConfiguration gets configure info of the margin

func (*Kucoin) GetMarginRiskLimit

func (ku *Kucoin) GetMarginRiskLimit(ctx context.Context, marginModel string) ([]MarginRiskLimit, error)

GetMarginRiskLimit gets cross/isolated margin risk limit, default model is cross margin

func (*Kucoin) GetMarginTradeData

func (ku *Kucoin) GetMarginTradeData(ctx context.Context, ccy string) ([]MarginTradeData, error)

GetMarginTradeData get the last 300 fills in the lending and borrowing market

func (*Kucoin) GetMarkPrice

func (ku *Kucoin) GetMarkPrice(ctx context.Context, pair string) (*MarkPrice, error)

GetMarkPrice gets index price of the specified pair

func (*Kucoin) GetMarketList

func (ku *Kucoin) GetMarketList(ctx context.Context) ([]string, error)

GetMarketList get the transaction currency for the entire trading market

func (*Kucoin) GetOpenInterest

func (ku *Kucoin) GetOpenInterest(ctx context.Context, k ...key.PairAsset) ([]futures.OpenInterest, error)

GetOpenInterest returns the open interest rate for a given asset pair

func (*Kucoin) GetOrderByClientSuppliedOrderID

func (ku *Kucoin) GetOrderByClientSuppliedOrderID(ctx context.Context, clientOID string) (*OrderDetail, error)

GetOrderByClientSuppliedOrderID get a single order info by client order ID

func (*Kucoin) GetOrderByID

func (ku *Kucoin) GetOrderByID(ctx context.Context, orderID string) (*OrderDetail, error)

GetOrderByID get a single order info by order ID

func (*Kucoin) GetOrderHistory

func (ku *Kucoin) GetOrderHistory(ctx context.Context, getOrdersRequest *order.MultiOrderRequest) (order.FilteredOrders, error)

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

func (*Kucoin) GetOrderInfo

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

GetOrderInfo returns order information based on order ID

func (*Kucoin) GetOrderbook

func (ku *Kucoin) GetOrderbook(ctx context.Context, pair string) (*Orderbook, error)

GetOrderbook gets full orderbook for a specified pair

func (*Kucoin) GetOutstandingRecord

func (ku *Kucoin) GetOutstandingRecord(ctx context.Context, ccy string) (*OutstandingRecordResponse, error)

GetOutstandingRecord gets outstanding record information

func (*Kucoin) GetPaginatedListOfSubAccounts

func (ku *Kucoin) GetPaginatedListOfSubAccounts(ctx context.Context, currentPage, pageSize int64) (*SubAccountResponse, error)

GetPaginatedListOfSubAccounts to retrieve a paginated list of sub-accounts. Pagination is required.

func (*Kucoin) GetPaginatedSubAccountInformation

func (ku *Kucoin) GetPaginatedSubAccountInformation(ctx context.Context, currentPage, pageSize int64) ([]SubAccountInfo, error)

GetPaginatedSubAccountInformation this endpoint can be used to get paginated sub-account information. Pagination is required.

func (*Kucoin) GetPartOrderbook100

func (ku *Kucoin) GetPartOrderbook100(ctx context.Context, pair string) (*Orderbook, error)

GetPartOrderbook100 gets orderbook for a specified pair with depth 100

func (*Kucoin) GetPartOrderbook20

func (ku *Kucoin) GetPartOrderbook20(ctx context.Context, pair string) (*Orderbook, error)

GetPartOrderbook20 gets orderbook for a specified pair with depth 20

func (*Kucoin) GetRecentFills

func (ku *Kucoin) GetRecentFills(ctx context.Context) ([]Fill, error)

GetRecentFills get a list of 1000 fills in last 24 hours

func (*Kucoin) GetRecentOrders

func (ku *Kucoin) GetRecentOrders(ctx context.Context) ([]OrderDetail, error)

GetRecentOrders get orders in the last 24 hours.

func (*Kucoin) GetRecentTrades

func (ku *Kucoin) 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 (*Kucoin) GetRepaidRecord

func (ku *Kucoin) GetRepaidRecord(ctx context.Context, ccy string) (*RepaidRecordsResponse, error)

GetRepaidRecord gets repaid record information

func (*Kucoin) GetServerTime

func (ku *Kucoin) GetServerTime(ctx context.Context, a asset.Item) (time.Time, error)

GetServerTime returns the current exchange server time.

func (*Kucoin) GetServiceStatus

func (ku *Kucoin) GetServiceStatus(ctx context.Context) (*ServiceStatus, error)

GetServiceStatus gets the service status

func (*Kucoin) GetSettledLendOrder

func (ku *Kucoin) GetSettledLendOrder(ctx context.Context, ccy string) ([]SettleLendOrder, error)

GetSettledLendOrder gets settle lend orders

func (*Kucoin) GetSingleIsolatedMarginAccountInfo

func (ku *Kucoin) GetSingleIsolatedMarginAccountInfo(ctx context.Context, symbol string) (*AssetInfo, error)

GetSingleIsolatedMarginAccountInfo get single isolated margin accounts of the current user

func (*Kucoin) GetStopOrder

func (ku *Kucoin) GetStopOrder(ctx context.Context, orderID string) (*StopOrder, error)

GetStopOrder used to cancel single stop order previously placed

func (*Kucoin) GetStopOrderByClientID

func (ku *Kucoin) GetStopOrderByClientID(ctx context.Context, symbol, clientOID string) ([]StopOrder, error)

GetStopOrderByClientID get a stop order information via the clientOID

func (*Kucoin) GetSubAccountBalance

func (ku *Kucoin) GetSubAccountBalance(ctx context.Context, subUserID string, includeBaseAmount bool) (*SubAccountInfo, error)

GetSubAccountBalance get account info of a sub-user specified by the subUserID

func (*Kucoin) GetSubAccountSpotAPIList

func (ku *Kucoin) GetSubAccountSpotAPIList(ctx context.Context, subAccountName, apiKeys string) (*SubAccountResponse, error)

GetSubAccountSpotAPIList used to obtain a list of Spot APIs pertaining to a sub-account.

func (*Kucoin) GetSymbols

func (ku *Kucoin) GetSymbols(ctx context.Context, market string) ([]SymbolInfo, error)

GetSymbols gets pairs details on the exchange For market details see endpoint: https://www.kucoin.com/docs/rest/spot-trading/market-data/get-market-list

func (*Kucoin) GetTicker

func (ku *Kucoin) GetTicker(ctx context.Context, pair string) (*Ticker, error)

GetTicker gets pair ticker information

func (*Kucoin) GetTickers

func (ku *Kucoin) GetTickers(ctx context.Context) (*TickersResponse, error)

GetTickers gets all trading pair ticker information including 24h volume

func (*Kucoin) GetTradeHistory

func (ku *Kucoin) GetTradeHistory(ctx context.Context, pair string) ([]Trade, error)

GetTradeHistory gets trade history of the specified pair

func (*Kucoin) GetTradingFee

func (ku *Kucoin) GetTradingFee(ctx context.Context, pairs currency.Pairs) ([]Fees, error)

GetTradingFee get fee rate of trading pairs WARNING: There is a limit of 10 currency pairs allowed to be requested per call.

func (*Kucoin) GetTransferableBalance

func (ku *Kucoin) GetTransferableBalance(ctx context.Context, ccy, accountType, tag string) (*TransferableBalanceInfo, error)

GetTransferableBalance get the transferable balance of a specified account

func (*Kucoin) GetUnsettledLendOrder

func (ku *Kucoin) GetUnsettledLendOrder(ctx context.Context, ccy string) ([]UnsettleLendOrder, error)

GetUnsettledLendOrder gets outstanding lend order list

func (*Kucoin) GetUntriggeredFuturesStopOrders

func (ku *Kucoin) GetUntriggeredFuturesStopOrders(ctx context.Context, symbol, side, orderType string, startAt, endAt time.Time) (*FutureOrdersResponse, error)

GetUntriggeredFuturesStopOrders gets the untriggered stop orders list

func (*Kucoin) GetUserInfoOfAllSubAccounts

func (ku *Kucoin) GetUserInfoOfAllSubAccounts(ctx context.Context) (*SubAccountResponse, error)

GetUserInfoOfAllSubAccounts get the user info of all sub-users via this interface.

func (*Kucoin) GetWithdrawalList

func (ku *Kucoin) GetWithdrawalList(ctx context.Context, ccy, status string, startAt, endAt time.Time) (*WithdrawalsResponse, error)

GetWithdrawalList get withdrawal list items

func (*Kucoin) GetWithdrawalQuotas

func (ku *Kucoin) GetWithdrawalQuotas(ctx context.Context, ccy, chain string) (*WithdrawalQuota, error)

GetWithdrawalQuotas get withdrawal quota details

func (*Kucoin) GetWithdrawalsHistory

func (ku *Kucoin) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Kucoin) InitiateIsolatedMarginBorrowing

func (ku *Kucoin) InitiateIsolatedMarginBorrowing(ctx context.Context, symbol, ccy, borrowStrategy, period string, size, maxRate int64) (*IsolatedMarginBorrowing, error)

InitiateIsolatedMarginBorrowing initiates isolated margin borrowing

func (*Kucoin) InitiateIsolatedMarginQuickRepayment

func (ku *Kucoin) InitiateIsolatedMarginQuickRepayment(ctx context.Context, symbol, ccy, seqStrategy string, size int64) error

InitiateIsolatedMarginQuickRepayment is used to initiate quick repayment for isolated margin accounts

func (*Kucoin) InitiateIsolatedMarginSingleRepayment

func (ku *Kucoin) InitiateIsolatedMarginSingleRepayment(ctx context.Context, symbol, ccy, loanID string, size int64) error

InitiateIsolatedMarginSingleRepayment is used to initiate quick repayment for single margin accounts

func (*Kucoin) IsPerpetualFutureCurrency

func (ku *Kucoin) IsPerpetualFutureCurrency(a asset.Item, cp currency.Pair) (bool, error)

IsPerpetualFutureCurrency ensures a given asset and currency is a perpetual future

func (*Kucoin) ListOrders

func (ku *Kucoin) ListOrders(ctx context.Context, status, symbol, side, orderType, tradeType string, startAt, endAt time.Time) (*OrdersListResponse, error)

ListOrders gets the user order list

func (*Kucoin) ListStopOrders

func (ku *Kucoin) ListStopOrders(ctx context.Context, symbol, side, orderType, tradeType, orderIDs string, startAt, endAt time.Time, currentPage, pageSize int64) (*StopOrderListResponse, error)

ListStopOrders get all current untriggered stop orders

func (*Kucoin) MakeInnerTransfer

func (ku *Kucoin) MakeInnerTransfer(ctx context.Context, clientOID, ccy, from, to, amount, fromTag, toTag string) (string, error)

MakeInnerTransfer used to transfer funds between accounts internally

func (*Kucoin) ModifyOrder

func (ku *Kucoin) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)

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

func (*Kucoin) ModifySubAccountSpotAPIs

func (ku *Kucoin) ModifySubAccountSpotAPIs(ctx context.Context, arg *SpotAPISubAccountParams) (*SpotAPISubAccount, error)

ModifySubAccountSpotAPIs modifies sub-account Spot APIs.

func (*Kucoin) OneClickRepayment

func (ku *Kucoin) OneClickRepayment(ctx context.Context, ccy, sequence string, size float64) error

OneClickRepayment used to complete repayment in single go

func (*Kucoin) PostBorrowOrder

func (ku *Kucoin) PostBorrowOrder(ctx context.Context, ccy, orderType, term string, size, maxRate float64) (*PostBorrowOrderResp, error)

PostBorrowOrder used to post borrow order

func (*Kucoin) PostBulkOrder

func (ku *Kucoin) PostBulkOrder(ctx context.Context, symbol string, orderList []OrderRequest) ([]PostBulkOrderResp, error)

PostBulkOrder used to place 5 orders at the same time. The order type must be a limit order of the same symbol Note: it supports only SPOT trades Note: To check if order was posted successfully, check status field in response

func (*Kucoin) PostFuturesOrder

func (ku *Kucoin) PostFuturesOrder(ctx context.Context, arg *FuturesOrderParam) (string, error)

PostFuturesOrder used to place two types of futures orders: limit and market

func (*Kucoin) PostLendOrder

func (ku *Kucoin) PostLendOrder(ctx context.Context, ccy string, dailyInterestRate, size float64, term int64) (string, error)

PostLendOrder used to create lend order

func (*Kucoin) PostMarginOrder

func (ku *Kucoin) PostMarginOrder(ctx context.Context, arg *MarginOrderParam) (*PostMarginOrderResp, error)

PostMarginOrder used to place two types of margin orders: limit and market

func (*Kucoin) PostOrder

func (ku *Kucoin) PostOrder(ctx context.Context, arg *SpotOrderParam) (string, error)

PostOrder used to place two types of orders: limit and market Note: use this only for SPOT trades

func (*Kucoin) PostStopOrder

func (ku *Kucoin) PostStopOrder(ctx context.Context, clientOID, side, symbol, orderType, remark, stop, stp, tradeType, timeInForce string, size, price, stopPrice, cancelAfter, visibleSize, funds float64, postOnly, hidden, iceberg bool) (string, error)

PostStopOrder used to place two types of stop orders: limit and market

func (*Kucoin) ProcessUpdate

func (ku *Kucoin) ProcessUpdate(cp currency.Pair, a asset.Item, ws *WsOrderbook) error

ProcessUpdate processes the websocket orderbook update

func (*Kucoin) SeedLocalCache

func (ku *Kucoin) SeedLocalCache(ctx context.Context, p currency.Pair, assetType asset.Item) error

SeedLocalCache seeds depth data

func (*Kucoin) SeedLocalCacheWithBook

func (ku *Kucoin) SeedLocalCacheWithBook(p currency.Pair, orderbookNew *Orderbook, assetType asset.Item) error

SeedLocalCacheWithBook seeds the local orderbook cache

func (*Kucoin) SendAuthHTTPRequest

func (ku *Kucoin) SendAuthHTTPRequest(ctx context.Context, ePath exchange.URL, epl request.EndpointLimit, method, path string, arg, result interface{}) error

SendAuthHTTPRequest sends an authenticated HTTP request Request parameters are added to path variable for GET and DELETE request and for other requests its passed in params variable

func (*Kucoin) SendHTTPRequest

func (ku *Kucoin) SendHTTPRequest(ctx context.Context, ePath exchange.URL, epl request.EndpointLimit, path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*Kucoin) SetAutoDepositMargin

func (ku *Kucoin) SetAutoDepositMargin(ctx context.Context, symbol string, status bool) (bool, error)

SetAutoDepositMargin enable/disable of auto-deposit margin

func (*Kucoin) SetAutoLend

func (ku *Kucoin) SetAutoLend(ctx context.Context, ccy string, dailyInterestRate, retainSize float64, term int64, isEnable bool) error

SetAutoLend used to set up the automatic lending for a specified currency

func (*Kucoin) SetCollateralMode

func (ku *Kucoin) SetCollateralMode(_ context.Context, _ asset.Item, _ collateral.Mode) error

SetCollateralMode sets the collateral type for your account

func (*Kucoin) SetDefaults

func (ku *Kucoin) SetDefaults()

SetDefaults sets the basic defaults for Kucoin

func (*Kucoin) SetLeverage

func (ku *Kucoin) SetLeverage(_ context.Context, _ asset.Item, _ currency.Pair, _ margin.Type, _ float64, _ order.Side) error

SetLeverage sets the account's initial leverage for the asset type and pair

func (*Kucoin) SetMarginType

func (ku *Kucoin) SetMarginType(_ context.Context, _ asset.Item, _ currency.Pair, _ margin.Type) error

SetMarginType sets the default margin type for when opening a new position

func (*Kucoin) Setup

func (ku *Kucoin) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*Kucoin) SingleOrderRepayment

func (ku *Kucoin) SingleOrderRepayment(ctx context.Context, ccy, tradeID string, size float64) error

SingleOrderRepayment used to repay single order

func (*Kucoin) SubmitOrder

func (ku *Kucoin) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Kucoin) SubmitOrders added in v1.0.7

func (ku *Kucoin) SubmitOrders(ctx context.Context, ss ...*order.Submit) ([]*order.SubmitResponse, error)

PostBulkOrder

func (*Kucoin) Subscribe

func (ku *Kucoin) Subscribe(subscriptions []subscription.Subscription) error

Subscribe sends a websocket message to receive data from the channel

func (*Kucoin) SynchroniseWebsocketOrderbook

func (ku *Kucoin) SynchroniseWebsocketOrderbook()

SynchroniseWebsocketOrderbook synchronises full orderbook for currency pair asset

func (*Kucoin) TransferFundsToFuturesAccount

func (ku *Kucoin) TransferFundsToFuturesAccount(ctx context.Context, amount float64, currency, payAccountType string) error

TransferFundsToFuturesAccount helps in transferring funds from payee account to futures account

func (*Kucoin) TransferFuturesFundsToMainAccount

func (ku *Kucoin) TransferFuturesFundsToMainAccount(ctx context.Context, amount float64, currency, recAccountType string) (*TransferRes, error)

TransferFuturesFundsToMainAccount helps in transferring funds from futures to main/trade account

func (*Kucoin) TransferMainToSubAccount

func (ku *Kucoin) TransferMainToSubAccount(ctx context.Context, clientOID, ccy, amount, direction, accountType, subAccountType, subUserID string) (string, error)

TransferMainToSubAccount used to transfer funds from main account to sub-account

func (*Kucoin) Unsubscribe

func (ku *Kucoin) Unsubscribe(subscriptions []subscription.Subscription) error

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

func (*Kucoin) UpdateAccountInfo

func (ku *Kucoin) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies

func (*Kucoin) UpdateLocalBuffer

func (ku *Kucoin) UpdateLocalBuffer(wsdp *WsOrderbook, assetType asset.Item) (bool, error)

UpdateLocalBuffer updates orderbook buffer and checks status if the book is Initial Sync being via the REST protocol.

func (*Kucoin) UpdateOrderExecutionLimits

func (ku *Kucoin) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error

UpdateOrderExecutionLimits updates order execution limits

func (*Kucoin) UpdateOrderbook

func (ku *Kucoin) UpdateOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Kucoin) UpdateTicker

func (ku *Kucoin) UpdateTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Kucoin) UpdateTickers

func (ku *Kucoin) UpdateTickers(ctx context.Context, assetType asset.Item) error

UpdateTickers updates all currency pairs of a given asset type

func (*Kucoin) UpdateTradablePairs

func (ku *Kucoin) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

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

func (*Kucoin) ValidateAPICredentials

func (ku *Kucoin) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper functionality

func (*Kucoin) ValidateCredentials

func (ku *Kucoin) ValidateCredentials(ctx context.Context, assetType asset.Item) error

ValidateCredentials validates current credentials used for wrapper

func (*Kucoin) WithdrawCryptocurrencyFunds

func (ku *Kucoin) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted The endpoint was deprecated for futures, please transfer assets from the FUTURES account to the MAIN account first, and then withdraw from the MAIN account

func (*Kucoin) WithdrawFiatFunds

func (ku *Kucoin) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Kucoin) WithdrawFiatFundsToInternationalBank

func (ku *Kucoin) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Kucoin) WsConnect

func (ku *Kucoin) WsConnect() error

WsConnect creates a new websocket connection.

type LedgerInfo

type LedgerInfo struct {
	ID          string               `json:"id"`
	Currency    string               `json:"currency"`
	Amount      float64              `json:"amount,string"`
	Fee         float64              `json:"fee,string"`
	Balance     float64              `json:"balance,string"`
	AccountType string               `json:"accountType"`
	BizType     string               `json:"bizType"`
	Direction   string               `json:"direction"`
	CreatedAt   convert.ExchangeTime `json:"createdAt"`
	Context     string               `json:"context"`
}

LedgerInfo represents account ledger information.

type LendMarketData

type LendMarketData struct {
	DailyIntRate float64 `json:"dailyIntRate,string"`
	Term         int64   `json:"term"`
	Size         float64 `json:"size,string"`
}

LendMarketData stores lend market data

type LendOrder

type LendOrder struct {
	OrderID      string               `json:"orderId"`
	Currency     string               `json:"currency"`
	Size         float64              `json:"size,string"`
	FilledSize   float64              `json:"filledSize,string"`
	DailyIntRate float64              `json:"dailyIntRate,string"`
	Term         int64                `json:"term"`
	CreatedAt    convert.ExchangeTime `json:"createdAt"`
}

LendOrder stores lend order

type LendOrderHistory

type LendOrderHistory struct {
	LendOrder
	Status string `json:"status"`
}

LendOrderHistory stores lend order history

type LendRecord

type LendRecord struct {
	Currency        string  `json:"currency"`
	Outstanding     float64 `json:"outstanding,string"`
	FilledSize      float64 `json:"filledSize,string"`
	AccruedInterest float64 `json:"accruedInterest,string"`
	RealizedProfit  float64 `json:"realizedProfit,string"`
	IsAutoLend      bool    `json:"isAutoLend"`
}

LendRecord stores lend record

type Level2Depth5Or20

type Level2Depth5Or20 struct {
	Asks      [][2]types.Number `json:"asks"`
	Bids      [][2]types.Number `json:"bids"`
	Timestamp int64             `json:"timestamp"`
}

Level2Depth5Or20 stores the orderbook data for the level 5 or level 20 orderbook

type ListFills

type ListFills struct {
	CurrentPage int64  `json:"currentPage"`
	PageSize    int64  `json:"pageSize"`
	TotalNumber int64  `json:"totalNum"`
	TotalPage   int64  `json:"totalPage"`
	Items       []Fill `json:"items"`
}

ListFills represents fills response list detail.

type MainAccountInfo

type MainAccountInfo struct {
	BaseCurrency      string  `json:"baseCurrency"`
	BaseCurrencyPrice float64 `json:"baseCurrencyPrice,string"`
	BaseAmount        float64 `json:"baseAmount,string"`
	// contains filtered or unexported fields
}

MainAccountInfo represents main account detailed information.

type MarginAccount

type MarginAccount struct {
	AvailableBalance float64 `json:"availableBalance,string"`
	Currency         string  `json:"currency"`
	HoldBalance      float64 `json:"holdBalance,string"`
	Liability        float64 `json:"liability,string"`
	MaxBorrowSize    float64 `json:"maxBorrowSize,string"`
	TotalBalance     float64 `json:"totalBalance,string"`
}

MarginAccount stores margin account data

type MarginAccounts

type MarginAccounts struct {
	Accounts  []MarginAccount `json:"accounts"`
	DebtRatio float64         `json:"debtRatio,string"`
}

MarginAccounts stores margin accounts data

type MarginConfiguration

type MarginConfiguration struct {
	CurrencyList     []string `json:"currencyList"`
	WarningDebtRatio float64  `json:"warningDebtRatio,string"`
	LiqDebtRatio     float64  `json:"liqDebtRatio,string"`
	MaxLeverage      float64  `json:"maxLeverage"`
}

MarginConfiguration stores margin configuration

type MarginOrderParam

type MarginOrderParam struct {
	ClientOrderID       string        `json:"clientOid"`
	Side                string        `json:"side"`
	Symbol              currency.Pair `json:"symbol"`
	OrderType           string        `json:"type,omitempty"`
	TradeType           string        `json:"tradeType,omitempty"` // [Optional] The type of trading : TRADE(Spot Trade), MARGIN_TRADE (Margin Trade). Default is TRADE.
	Remark              string        `json:"remark,omitempty"`
	SelfTradePrevention string        `json:"stp,omitempty"`         // [Optional] self trade prevention , CN, CO, CB or DC. `CN` for Cancel newest, `DC` for Decrease and Cancel, `CO` for cancel oldest, and `CB` for Cancel both
	MarginMode          string        `json:"marginModel,omitempty"` // [Optional] The type of trading, including cross (cross mode) and isolated (isolated mode). It is set at cross by default.
	AutoBorrow          bool          `json:"autoBorrow,omitempty"`  // [Optional] Auto-borrow to place order. The system will first borrow you funds at the optimal interest rate and then place an order for you. Currently autoBorrow parameter only supports cross mode, not isolated mode. When add this param, stop profit and stop loss are not supported
	Size                float64       `json:"size,omitempty,string"`
	Price               float64       `json:"price,string,omitempty"`
	TimeInForce         string        `json:"timeInForce,omitempty"` // [Optional] GTC, GTT, IOC, or FOK (default is GTC)
	CancelAfter         int64         `json:"cancelAfter,omitempty"` // [Optional] cancel after n seconds, requires timeInForce to be GTT
	PostOnly            bool          `json:"postOnly,omitempty"`
	Hidden              bool          `json:"hidden,omitempty"`
	Iceberg             bool          `json:"iceberg,omitempty"`
	VisibleSize         float64       `json:"visibleSize,omitempty,string"`
	Funds               float64       `json:"funds,string,omitempty"`
}

MarginOrderParam represents the margin place order request parameters.

type MarginRiskLimit

type MarginRiskLimit struct {
	Currency            string  `json:"currency"`
	MaximumBorrowAmount float64 `json:"borrowMaxAmount,string"`
	MaxumumBuyAmount    float64 `json:"buyMaxAmount,string"`
	MaximumHoldAmount   float64 `json:"holdMaxAmount,string"`
	Precision           int64   `json:"precision"`
}

MarginRiskLimit stores margin risk limit

type MarginTradeData

type MarginTradeData struct {
	TradeID      string               `json:"tradeId"`
	Currency     string               `json:"currency"`
	Size         float64              `json:"size,string"`
	DailyIntRate float64              `json:"dailyIntRate,string"`
	Term         int64                `json:"term"`
	Timestamp    convert.ExchangeTime `json:"timestamp"`
}

MarginTradeData stores margin trade data

type MarkPrice

type MarkPrice struct {
	Symbol      string               `json:"symbol"`
	Granularity int64                `json:"granularity"`
	TimePoint   convert.ExchangeTime `json:"timePoint"`
	Value       float64              `json:"value"`
}

MarkPrice stores mark price data

type OrderDetail

type OrderDetail struct {
	OrderRequest
	Channel       string               `json:"channel"`
	ID            string               `json:"id"`
	OperationType string               `json:"opType"` // operation type: DEAL
	Funds         string               `json:"funds"`
	DealFunds     string               `json:"dealFunds"`
	DealSize      float64              `json:"dealSize,string"`
	Fee           float64              `json:"fee,string"`
	FeeCurrency   string               `json:"feeCurrency"`
	StopTriggered bool                 `json:"stopTriggered"`
	Tags          string               `json:"tags"`
	IsActive      bool                 `json:"isActive"`
	CancelExist   bool                 `json:"cancelExist"`
	CreatedAt     convert.ExchangeTime `json:"createdAt"`
	TradeType     string               `json:"tradeType"`
}

OrderDetail represents order detail

type OrderRequest

type OrderRequest struct {
	ClientOID   string  `json:"clientOid"`
	Symbol      string  `json:"symbol"`
	Side        string  `json:"side"`
	Type        string  `json:"type,omitempty"`             // optional
	Remark      string  `json:"remark,omitempty"`           // optional
	Stop        string  `json:"stop,omitempty"`             // optional
	StopPrice   float64 `json:"stopPrice,string,omitempty"` // optional
	STP         string  `json:"stp,omitempty"`              // optional
	Price       float64 `json:"price,string,omitempty"`
	Size        float64 `json:"size,string,omitempty"`
	TimeInForce string  `json:"timeInForce,omitempty"` // optional
	CancelAfter int64   `json:"cancelAfter,omitempty"` // optional
	PostOnly    bool    `json:"postOnly,omitempty"`    // optional
	Hidden      bool    `json:"hidden,omitempty"`      // optional
	Iceberg     bool    `json:"iceberg,omitempty"`     // optional
	VisibleSize string  `json:"visibleSize,omitempty"` // optional
}

OrderRequest represents place order request parameters

type Orderbook

type Orderbook struct {
	Sequence int64
	Bids     []orderbook.Tranche
	Asks     []orderbook.Tranche
	Time     time.Time
}

Orderbook stores the orderbook data

type OrderbookChanges

type OrderbookChanges struct {
	Asks [][]string `json:"asks"`
	Bids [][]string `json:"bids"`
}

OrderbookChanges represents orderbook ask and bid changes.

type OrdersListResponse

type OrdersListResponse struct {
	CurrentPage int64         `json:"currentPage"`
	PageSize    int64         `json:"pageSize"`
	TotalNum    int64         `json:"totalNum"`
	TotalPage   int64         `json:"totalPage"`
	Items       []OrderDetail `json:"items"`
}

OrdersListResponse represents an order list response.

type OutstandingRecord

type OutstandingRecord struct {
	AccruedInterest float64              `json:"accruedInterest,string"`
	Liability       float64              `json:"liability,string"`
	MaturityTime    convert.ExchangeTime `json:"maturityTime"`
	CreatedAt       convert.ExchangeTime `json:"createdAt"`
	// contains filtered or unexported fields
}

OutstandingRecord stores outstanding record

type OutstandingRecordResponse

type OutstandingRecordResponse struct {
	CurrentPage int64               `json:"currentPage"`
	PageSize    int64               `json:"pageSize"`
	TotalNumber int64               `json:"totalNum"`
	TotalPage   int64               `json:"totalPage"`
	Items       []OutstandingRecord `json:"items"` // lists
}

OutstandingRecordResponse represents outstanding record detail.

type OutstandingRepaymentRecord

type OutstandingRepaymentRecord struct {
	LiabilityBalance float64              `json:"liabilityBalance,string"`
	MaturityTime     convert.ExchangeTime `json:"maturityTime"`
	// contains filtered or unexported fields
}

OutstandingRepaymentRecord represents an outstanding repayment records of isolated margin positions

type OutstandingRepaymentRecordsResponse

type OutstandingRepaymentRecordsResponse struct {
	CurrentPage int64                        `json:"currentPage"`
	PageSize    int64                        `json:"pageSize"`
	TotalNum    int64                        `json:"totalNum"`
	TotalPage   int64                        `json:"totalPage"`
	Items       []OutstandingRepaymentRecord `json:"items"`
}

OutstandingRepaymentRecordsResponse represents an outstanding repayment records of isolated margin positions list

type PostBorrowOrderResp

type PostBorrowOrderResp struct {
	OrderID  string `json:"orderId"`
	Currency string `json:"currency"`
}

PostBorrowOrderResp stores borrow order response

type PostBulkOrderResp

type PostBulkOrderResp struct {
	OrderRequest
	Channel string `json:"channel"`
	ID      string `json:"id"`
	Status  string `json:"status"`
	FailMsg string `json:"failMsg"`
}

PostBulkOrderResp response data for submitting a bulk order

type PostMarginOrderResp

type PostMarginOrderResp struct {
	OrderID     string  `json:"orderId"`
	BorrowSize  float64 `json:"borrowSize"`
	LoanApplyID string  `json:"loanApplyId"`
}

PostMarginOrderResp represents response data for placing margin orders

type RateLimit

type RateLimit struct {
	RetrieveAccountLedger              *rate.Limiter
	MasterSubUserTransfer              *rate.Limiter
	RetrieveDepositList                *rate.Limiter
	RetrieveV1HistoricalDepositList    *rate.Limiter
	RetrieveWithdrawalList             *rate.Limiter
	RetrieveV1HistoricalWithdrawalList *rate.Limiter
	PlaceOrder                         *rate.Limiter
	PlaceMarginOrders                  *rate.Limiter
	PlaceBulkOrders                    *rate.Limiter
	CancelOrder                        *rate.Limiter
	CancelAllOrders                    *rate.Limiter
	ListOrders                         *rate.Limiter
	ListFills                          *rate.Limiter
	RetrieveFullOrderbook              *rate.Limiter
	RetrieveMarginAccount              *rate.Limiter
	SpotRate                           *rate.Limiter
	FuturesRate                        *rate.Limiter

	FRetrieveAccountOverviewRate     *rate.Limiter
	FRetrieveTransactionHistoryRate  *rate.Limiter
	FPlaceOrderRate                  *rate.Limiter
	FCancelAnOrderRate               *rate.Limiter
	FLimitOrderMassCancelationRate   *rate.Limiter
	FRetrieveOrderListRate           *rate.Limiter
	FRetrieveFillsRate               *rate.Limiter
	FRecentFillsRate                 *rate.Limiter
	FRetrievePositionListRate        *rate.Limiter
	FRetrieveFundingHistoryRate      *rate.Limiter
	FRetrieveFullOrderbookLevel2Rate *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns a RateLimit instance, which implements the request.Limiter interface.

func (*RateLimit) Limit

func (r *RateLimit) Limit(ctx context.Context, epl request.EndpointLimit) error

Limit executes rate limiting functionality for Kucoin

type RepaidRecord

type RepaidRecord struct {
	Interest  float64              `json:"interest,string"`
	RepayTime convert.ExchangeTime `json:"repayTime"`
	// contains filtered or unexported fields
}

RepaidRecord stores repaid record

type RepaidRecordsResponse

type RepaidRecordsResponse struct {
	CurrentPage int64          `json:"currentPage"`
	PageSize    int64          `json:"pageSize"`
	TotalNumber int64          `json:"totalNum"`
	TotalPage   int64          `json:"totalPage"`
	Items       []RepaidRecord `json:"items"`
}

RepaidRecordsResponse stores list of repaid record details.

type Response

type Response struct {
	Data interface{} `json:"data"`
	Error
}

Response represents response model and implements UnmarshalTo interface.

type ServiceStatus

type ServiceStatus struct {
	Status  string `json:"status"`
	Message string `json:"msg"`
}

ServiceStatus represents a service status message.

type SettleLendOrder

type SettleLendOrder struct {
	TradeID      string               `json:"tradeId"`
	Currency     string               `json:"currency"`
	Size         float64              `json:"size,string"`
	Interest     float64              `json:"interest,string"`
	Repaid       float64              `json:"repaid,string"`
	DailyIntRate float64              `json:"dailyIntRate,string"`
	Term         int64                `json:"term"`
	SettledAt    convert.ExchangeTime `json:"settledAt"`
	Note         string               `json:"note"`
}

SettleLendOrder stores settled lend order

type SpotAPISubAccount

type SpotAPISubAccount struct {
	SubName     string               `json:"subName"`
	Remark      string               `json:"remark"`
	APIKey      string               `json:"apiKey"`
	APISecret   string               `json:"apiSecret"`
	Passphrase  string               `json:"passphrase"`
	Permission  string               `json:"permission"`
	IPWhitelist string               `json:"ipWhitelist"`
	CreatedAt   convert.ExchangeTime `json:"createdAt"`
}

SpotAPISubAccount represents a Spot APIs for sub-accounts.

type SpotAPISubAccountParams

type SpotAPISubAccountParams struct {
	SubAccountName string `json:"subName"`
	Passphrase     string `json:"passphrase"`
	Remark         string `json:"remark"`
	Permission     string `json:"permission,omitempty"`    // Permissions(Only "General" and "Trade" permissions can be set, such as "General, Trade". The default is "General")
	IPWhitelist    string `json:"ipWhitelist,omitempty"`   // IP whitelist(You may add up to 20 IPs. Use a halfwidth comma to each IP)
	Expire         int64  `json:"expire,string,omitempty"` // API expiration time; Never expire(default)-1,30Day30,90Day90,180Day180,360Day360
}

SpotAPISubAccountParams parameters for Spot APIs for sub-accounts

type SpotOrderParam

type SpotOrderParam struct {
	ClientOrderID       string        `json:"clientOid"`
	Side                string        `json:"side"`
	Symbol              currency.Pair `json:"symbol"`
	OrderType           string        `json:"type,omitempty"`
	TradeType           string        `json:"tradeType,omitempty"` // [Optional] The type of trading : TRADE(Spot Trade), MARGIN_TRADE (Margin Trade). Default is TRADE.
	Remark              string        `json:"remark,omitempty"`
	SelfTradePrevention string        `json:"stp,omitempty"`         // [Optional] self trade prevention , CN, CO, CB or DC. `CN` for Cancel newest, `DC` for Decrease and Cancel, `CO` for cancel oldest, and `CB` for Cancel both
	TimeInForce         string        `json:"timeInForce,omitempty"` // [Optional] GTC, GTT, IOC, or FOK (default is GTC)
	PostOnly            bool          `json:"postOnly,omitempty"`
	Hidden              bool          `json:"hidden,omitempty"`
	Iceberg             bool          `json:"iceberg,omitempty"`
	ReduceOnly          bool          `json:"reduceOnly,omitempty"`
	CancelAfter         int64         `json:"cancelAfter,omitempty"`
	Size                float64       `json:"size,omitempty,string"`
	Price               float64       `json:"price,string,omitempty"`
	VisibleSize         float64       `json:"visibleSize,omitempty,string"`
	Funds               float64       `json:"funds,string,omitempty"`
}

SpotOrderParam represents the spot place order request parameters.

type Stats24hrs

type Stats24hrs struct {
	Time convert.ExchangeTime `json:"time"`
	// contains filtered or unexported fields
}

Stats24hrs stores 24 hrs statistics

type StopOrder

type StopOrder struct {
	OrderRequest
	ID              string               `json:"id"`
	UserID          string               `json:"userId"`
	Status          string               `json:"status"`
	Funds           float64              `json:"funds,string"`
	Channel         string               `json:"channel"`
	Tags            string               `json:"tags"`
	DomainID        string               `json:"domainId"`
	TradeSource     string               `json:"tradeSource"`
	TradeType       string               `json:"tradeType"`
	FeeCurrency     string               `json:"feeCurrency"`
	TakerFeeRate    string               `json:"takerFeeRate"`
	MakerFeeRate    string               `json:"makerFeeRate"`
	CreatedAt       convert.ExchangeTime `json:"createdAt"`
	OrderTime       convert.ExchangeTime `json:"orderTime"`
	StopTriggerTime convert.ExchangeTime `json:"stopTriggerTime"`
}

StopOrder holds a stop order detail

type StopOrderListResponse

type StopOrderListResponse struct {
	CurrentPage int64       `json:"currentPage"`
	PageSize    int64       `json:"pageSize"`
	TotalNumber int64       `json:"totalNum"`
	TotalPage   int64       `json:"totalPage"`
	Items       []StopOrder `json:"items"`
}

StopOrderListResponse represents a list of spot orders details.

type SubAccount

type SubAccount struct {
	UserID    string               `json:"userId"`
	SubName   string               `json:"subName"`
	Type      int64                `json:"type"` //type:1-rebot  or type:0-nomal
	Remarks   string               `json:"remarks"`
	UID       int64                `json:"uid"`
	Status    int64                `json:"status"`
	Access    string               `json:"access"`
	CreatedAt convert.ExchangeTime `json:"createdAt"`
}

SubAccount represents sub-user

type SubAccountCreatedResponse

type SubAccountCreatedResponse struct {
	UID     int64  `json:"uid"`
	SubName string `json:"subName"`
	Remarks string `json:"remarks"`
	Access  string `json:"access"`
}

SubAccountCreatedResponse represents the sub-account response.

type SubAccountInfo

type SubAccountInfo struct {
	SubUserID      string            `json:"subUserId"`
	SubName        string            `json:"subName"`
	MainAccounts   []MainAccountInfo `json:"mainAccounts"`
	TradeAccounts  []MainAccountInfo `json:"tradeAccounts"`
	MarginAccounts []MainAccountInfo `json:"marginAccounts"`
}

SubAccountInfo holds subaccount data for main, spot(trade), and margin accounts.

type SubAccountResponse

type SubAccountResponse struct {
	CurrentPage int64        `json:"currentPage"`
	PageSize    int64        `json:"pageSize"`
	TotalNum    int64        `json:"totalNum"`
	TotalPage   int64        `json:"totalPage"`
	Items       []SubAccount `json:"items"`
}

SubAccountResponse represents the sub-user detail.

type SubAccountsResponse

type SubAccountsResponse struct {
	CurrentPage int64            `json:"currentPage"`
	PageSize    int64            `json:"pageSize"`
	TotalNumber int64            `json:"totalNum"`
	TotalPage   int64            `json:"totalPage"`
	Items       []SubAccountInfo `json:"items"`
}

SubAccountsResponse represents a sub-accounts items response instance.

func (*SubAccountsResponse) UnmarshalJSON

func (a *SubAccountsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON valid data to SubAccountsResponse of return nil if the data is empty list. this is added to handle the empty list returned when there are no accounts.

type SymbolInfo

type SymbolInfo struct {
	Symbol          string  `json:"symbol"`
	Name            string  `json:"name"`
	BaseCurrency    string  `json:"baseCurrency"`
	QuoteCurrency   string  `json:"quoteCurrency"`
	FeeCurrency     string  `json:"feeCurrency"`
	Market          string  `json:"market"`
	BaseMinSize     float64 `json:"baseMinSize,string"`
	QuoteMinSize    float64 `json:"quoteMinSize,string"`
	BaseMaxSize     float64 `json:"baseMaxSize,string"`
	QuoteMaxSize    float64 `json:"quoteMaxSize,string"`
	BaseIncrement   float64 `json:"baseIncrement,string"`
	QuoteIncrement  float64 `json:"quoteIncrement,string"`
	PriceIncrement  float64 `json:"priceIncrement,string"`
	PriceLimitRate  float64 `json:"priceLimitRate,string"`
	MinFunds        float64 `json:"minFunds,string"`
	IsMarginEnabled bool    `json:"isMarginEnabled"`
	EnableTrading   bool    `json:"enableTrading"`
}

SymbolInfo stores symbol information

type Ticker

type Ticker struct {
	Sequence    string               `json:"sequence"`
	BestAsk     float64              `json:"bestAsk,string"`
	Size        float64              `json:"size,string"`
	Price       float64              `json:"price,string"`
	BestBidSize float64              `json:"bestBidSize,string"`
	BestBid     float64              `json:"bestBid,string"`
	BestAskSize float64              `json:"bestAskSize,string"`
	Time        convert.ExchangeTime `json:"time"`
}

Ticker stores ticker data

type TickerInfo

type TickerInfo struct {
	SymbolName string `json:"symbolName"`
	// contains filtered or unexported fields
}

TickerInfo stores ticker information

type TickersResponse

type TickersResponse struct {
	Time    convert.ExchangeTime `json:"time"`
	Tickers []TickerInfo         `json:"ticker"`
}

TickersResponse represents list of tickers and update timestamp information.

type Trade

type Trade struct {
	Sequence string               `json:"sequence"`
	Price    float64              `json:"price,string"`
	Size     float64              `json:"size,string"`
	Side     string               `json:"side"`
	Time     convert.ExchangeTime `json:"time"`
}

Trade stores trade data

type Transfer

type Transfer struct {
	TransferBase
	Offset int64 `json:"offset"`
}

Transfer represents a transfer detail.

type TransferBase

type TransferBase struct {
	ApplyID   string               `json:"applyId"`
	Currency  string               `json:"currency"`
	RecRemark string               `json:"recRemark"`
	RecSystem string               `json:"recSystem"`
	Status    string               `json:"status"`
	Amount    float64              `json:"amount,string"`
	Reason    string               `json:"reason"`
	CreatedAt convert.ExchangeTime `json:"createdAt"`
	Remark    string               `json:"remark"`
}

TransferBase represents transfer base information.

type TransferListsResponse

type TransferListsResponse struct {
	CurrentPage int64      `json:"currentPage"`
	PageSize    int64      `json:"pageSize"`
	TotalNum    int64      `json:"totalNum"`
	TotalPage   int64      `json:"totalPage"`
	Items       []Transfer `json:"items"`
}

TransferListsResponse represents a transfer lists detail.

type TransferRes

type TransferRes struct {
	TransferBase
	BizNo          string               `json:"bizNo"`
	PayAccountType string               `json:"payAccountType"`
	PayTag         string               `json:"payTag"`
	RecAccountType string               `json:"recAccountType"`
	RecTag         string               `json:"recTag"`
	Fee            float64              `json:"fee,string"`
	Serial         int64                `json:"sn"`
	UpdatedAt      convert.ExchangeTime `json:"updatedAt"`
}

TransferRes represents a transfer response

type TransferableBalanceInfo

type TransferableBalanceInfo struct {
	Transferable float64 `json:"transferable,string"`
	// contains filtered or unexported fields
}

TransferableBalanceInfo represents transferable balance information

type UnmarshalTo

type UnmarshalTo interface {
	GetError() error
}

UnmarshalTo acts as interface to exchange API response

type UnsettleLendOrder

type UnsettleLendOrder struct {
	TradeID         string               `json:"tradeId"`
	Currency        string               `json:"currency"`
	Size            float64              `json:"size,string"`
	AccruedInterest float64              `json:"accruedInterest,string"`
	Repaid          float64              `json:"repaid,string"`
	DailyIntRate    float64              `json:"dailyIntRate,string"`
	Term            int64                `json:"term"`
	MaturityTime    convert.ExchangeTime `json:"maturityTime"`
}

UnsettleLendOrder stores unsettle lend order

type WSConnMessages

type WSConnMessages struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

WSConnMessages represents response messages ping, pong, and welcome message structures.

type WSInstanceServers

type WSInstanceServers struct {
	Token           string           `json:"token"`
	InstanceServers []InstanceServer `json:"instanceServers"`
}

WSInstanceServers response connection token and websocket instance server information.

type Withdrawal

type Withdrawal struct {
	Deposit
	ID string `json:"id"`
}

Withdrawal represents withdrawal funding information.

type WithdrawalQuota

type WithdrawalQuota struct {
	Currency            string  `json:"currency"`
	LimitBTCAmount      float64 `json:"limitBTCAmount,string"`
	UsedBTCAmount       float64 `json:"usedBTCAmount,string"`
	RemainAmount        float64 `json:"remainAmount,string"`
	AvailableAmount     float64 `json:"availableAmount,string"`
	WithdrawMinFee      float64 `json:"withdrawMinFee,string"`
	InnerWithdrawMinFee float64 `json:"innerWithdrawMinFee,string"`
	WithdrawMinSize     float64 `json:"withdrawMinSize,string"`
	IsWithdrawEnabled   bool    `json:"isWithdrawEnabled"`
	Precision           int64   `json:"precision"`
	Chain               string  `json:"chain"`
}

WithdrawalQuota represents withdrawal quota detail information.

type WithdrawalsResponse

type WithdrawalsResponse struct {
	CurrentPage int64        `json:"currentPage"`
	PageSize    int64        `json:"pageSize"`
	TotalNum    int64        `json:"totalNum"`
	TotalPage   int64        `json:"totalPage"`
	Items       []Withdrawal `json:"items"`
}

WithdrawalsResponse represents a withdrawals list of items details.

type WsAccountBalance

type WsAccountBalance struct {
	Total           float64 `json:"total,string"`
	Available       float64 `json:"available,string"`
	AvailableChange float64 `json:"availableChange,string"`
	Currency        string  `json:"currency"`
	Hold            float64 `json:"hold,string"`
	HoldChange      float64 `json:"holdChange,string"`
	RelationEvent   string  `json:"relationEvent"`
	RelationEventID string  `json:"relationEventId"`
	RelationContext struct {
		Symbol  string `json:"symbol"`
		TradeID string `json:"tradeId"`
		OrderID string `json:"orderId"`
	} `json:"relationContext"`
	Time convert.ExchangeTime `json:"time"`
}

WsAccountBalance represents a Account Balance push data.

type WsCandlestick

type WsCandlestick struct {
	Symbol  string `json:"symbol"`
	Candles struct {
		StartTime         time.Time
		OpenPrice         float64
		ClosePrice        float64
		HighPrice         float64
		LowPrice          float64
		TransactionVolume float64
		TransactionAmount float64
	} `json:"candles"`
	Time time.Time `json:"time"`
}

WsCandlestick represents candlestick information push data for a symbol.

type WsCandlestickData

type WsCandlestickData struct {
	Symbol  string               `json:"symbol"`
	Candles [7]string            `json:"candles"`
	Time    convert.ExchangeTime `json:"time"`
}

WsCandlestickData represents candlestick information push data for a symbol.

type WsDebtRatioChange

type WsDebtRatioChange struct {
	DebtRatio float64              `json:"debtRatio"`
	TotalDebt float64              `json:"totalDebt,string"`
	DebtList  map[string]string    `json:"debtList"`
	Timestamp convert.ExchangeTime `json:"timestamp"`
}

WsDebtRatioChange represents a push data

type WsFundingRate

type WsFundingRate struct {
	Symbol      string               `json:"symbol"`
	Granularity int64                `json:"granularity"`
	FundingRate float64              `json:"fundingRate"`
	Timestamp   convert.ExchangeTime `json:"timestamp"`
}

WsFundingRate represents the funding rate push data information through the websocket channel.

type WsFuturesAvailableBalance

type WsFuturesAvailableBalance struct {
	AvailableBalance float64              `json:"availableBalance"`
	HoldBalance      float64              `json:"holdBalance"`
	Currency         string               `json:"currency"`
	Timestamp        convert.ExchangeTime `json:"timestamp"`
}

WsFuturesAvailableBalance represents an available balance push data for futures account.

type WsFuturesExecutionData

type WsFuturesExecutionData struct {
	Sequence         int64                `json:"sequence"`
	FilledQuantity   float64              `json:"matchSize"` // Filled quantity
	UnfilledQuantity float64              `json:"size"`
	FilledPrice      float64              `json:"price"`
	TradeID          string               `json:"tradeId"`
	MakerUserID      string               `json:"makerUserId"`
	Symbol           string               `json:"symbol"`
	Side             string               `json:"side"`
	TakerOrderID     string               `json:"takerOrderId"`
	MakerOrderID     string               `json:"makerOrderId"`
	TakerUserID      string               `json:"takerUserId"`
	Timestamp        convert.ExchangeTime `json:"ts"`
}

WsFuturesExecutionData represents execution data for symbol.

type WsFuturesFundingBegin

type WsFuturesFundingBegin struct {
	Subject     string               `json:"subject"`
	Symbol      string               `json:"symbol"`
	FundingTime convert.ExchangeTime `json:"fundingTime"`
	FundingRate float64              `json:"fundingRate"`
	Timestamp   convert.ExchangeTime `json:"timestamp"`
}

WsFuturesFundingBegin represents the Start Funding Fee Settlement.

type WsFuturesMarkPriceAndIndexPrice

type WsFuturesMarkPriceAndIndexPrice struct {
	Symbol      string               `json:"symbol"`
	Granularity int64                `json:"granularity"`
	IndexPrice  float64              `json:"indexPrice"`
	MarkPrice   float64              `json:"markPrice"`
	Timestamp   convert.ExchangeTime `json:"timestamp"`
}

WsFuturesMarkPriceAndIndexPrice represents mark price and index price information.

type WsFuturesMarkPricePositionChanges

type WsFuturesMarkPricePositionChanges struct {
	MarkPrice         float64              `json:"markPrice"`         // Mark price
	MarkValue         float64              `json:"markValue"`         // Mark value
	MaintMargin       float64              `json:"maintMargin"`       // Position margin
	RealLeverage      float64              `json:"realLeverage"`      // Leverage of the order
	UnrealisedPnl     float64              `json:"unrealisedPnl"`     // Unrealised profit and lost
	UnrealisedRoePcnt float64              `json:"unrealisedRoePcnt"` // Rate of return on investment
	UnrealisedPnlPcnt float64              `json:"unrealisedPnlPcnt"` // Position profit and loss ratio
	DelevPercentage   float64              `json:"delevPercentage"`   // ADL ranking percentile
	CurrentTimestamp  convert.ExchangeTime `json:"currentTimestamp"`  // Current timestamp
	SettleCurrency    string               `json:"settleCurrency"`    // Currency used to clear and settle the trades
}

WsFuturesMarkPricePositionChanges represents futures account position change caused by mark price.

type WsFuturesOrderMarginEvent

type WsFuturesOrderMarginEvent struct {
	OrderMargin float64              `json:"orderMargin"`
	Currency    string               `json:"currency"`
	Timestamp   convert.ExchangeTime `json:"timestamp"`
}

WsFuturesOrderMarginEvent represents an order margin account balance event.

type WsFuturesOrderbokInfo

type WsFuturesOrderbokInfo struct {
	Sequence  int64                `json:"sequence"`
	Change    string               `json:"change"`
	Timestamp convert.ExchangeTime `json:"timestamp"`
}

WsFuturesOrderbokInfo represents Level 2 order book information.

type WsFuturesPosition

type WsFuturesPosition struct {
	RealisedGrossPnl  float64              `json:"realisedGrossPnl"` // Accumulated realised profit and loss
	Symbol            string               `json:"symbol"`
	CrossMode         bool                 `json:"crossMode"`        // Cross mode or not
	LiquidationPrice  float64              `json:"liquidationPrice"` // Liquidation price
	PosLoss           float64              `json:"posLoss"`          // Manually added margin amount
	AvgEntryPrice     float64              `json:"avgEntryPrice"`    // Average entry price
	UnrealisedPnl     float64              `json:"unrealisedPnl"`    // Unrealised profit and loss
	MarkPrice         float64              `json:"markPrice"`        // Mark price
	PosMargin         float64              `json:"posMargin"`        // Position margin
	AutoDeposit       bool                 `json:"autoDeposit"`      // Auto deposit margin or not
	RiskLimit         float64              `json:"riskLimit"`
	UnrealisedCost    float64              `json:"unrealisedCost"`    // Unrealised value
	PosComm           float64              `json:"posComm"`           // Bankruptcy cost
	PosMaint          float64              `json:"posMaint"`          // Maintenance margin
	PosCost           float64              `json:"posCost"`           // Position value
	MaintMarginReq    float64              `json:"maintMarginReq"`    // Maintenance margin rate
	BankruptPrice     float64              `json:"bankruptPrice"`     // Bankruptcy price
	RealisedCost      float64              `json:"realisedCost"`      // Currently accumulated realised position value
	MarkValue         float64              `json:"markValue"`         // Mark value
	PosInit           float64              `json:"posInit"`           // Position margin
	RealisedPnl       float64              `json:"realisedPnl"`       // Realised profit and loss
	MaintMargin       float64              `json:"maintMargin"`       // Position margin
	RealLeverage      float64              `json:"realLeverage"`      // Leverage of the order
	ChangeReason      string               `json:"changeReason"`      // changeReason:marginChange、positionChange、liquidation、autoAppendMarginStatusChange、adl
	CurrentCost       float64              `json:"currentCost"`       // Current position value
	OpeningTimestamp  convert.ExchangeTime `json:"openingTimestamp"`  // Open time
	CurrentQty        float64              `json:"currentQty"`        // Current position
	DelevPercentage   float64              `json:"delevPercentage"`   // ADL ranking percentile
	CurrentComm       float64              `json:"currentComm"`       // Current commission
	RealisedGrossCost float64              `json:"realisedGrossCost"` // Accumulated realised gross profit value
	IsOpen            bool                 `json:"isOpen"`            // Opened position or not
	PosCross          float64              `json:"posCross"`          // Manually added margin
	CurrentTimestamp  convert.ExchangeTime `json:"currentTimestamp"`  // Current timestamp
	UnrealisedRoePcnt float64              `json:"unrealisedRoePcnt"` // Rate of return on investment
	UnrealisedPnlPcnt float64              `json:"unrealisedPnlPcnt"` // Position profit and loss ratio
	SettleCurrency    string               `json:"settleCurrency"`    // Currency used to clear and settle the trades
}

WsFuturesPosition represents futures account position change event.

type WsFuturesPositionFundingSettlement

type WsFuturesPositionFundingSettlement struct {
	PositionSize     float64              `json:"qty"`
	MarkPrice        float64              `json:"markPrice"`
	FundingRate      float64              `json:"fundingRate"`
	FundingFee       float64              `json:"fundingFee"`
	FundingTime      convert.ExchangeTime `json:"fundingTime"`
	CurrentTimestamp convert.ExchangeTime `json:"ts"`
	SettleCurrency   string               `json:"settleCurrency"`
}

WsFuturesPositionFundingSettlement represents futures account position funding settlement push data.

type WsFuturesTicker

type WsFuturesTicker struct {
	Symbol       string               `json:"symbol"`
	Sequence     int64                `json:"sequence"`
	Side         string               `json:"side"`
	FilledPrice  float64              `json:"price"`
	FilledSize   float64              `json:"size"`
	TradeID      string               `json:"tradeId"`
	BestBidSize  float64              `json:"bestBidSize"`
	BestBidPrice types.Number         `json:"bestBidPrice"`
	BestAskPrice types.Number         `json:"bestAskPrice"`
	BestAskSize  float64              `json:"bestAskSize"`
	FilledTime   convert.ExchangeTime `json:"ts"`
}

WsFuturesTicker represents a futures ticker push data.

type WsFuturesTradeOrder

type WsFuturesTradeOrder struct {
	OrderID          string               `json:"orderId"`
	Symbol           string               `json:"symbol"`
	Type             string               `json:"type"`       // Message Type: "open", "match", "filled", "canceled", "update"
	Status           string               `json:"status"`     // Order Status: "match", "open", "done"
	MatchSize        string               `json:"matchSize"`  // Match Size (when the type is "match")
	MatchPrice       string               `json:"matchPrice"` // Match Price (when the type is "match")
	OrderType        string               `json:"orderType"`  // Order Type, "market" indicates market order, "limit" indicates limit order
	Side             string               `json:"side"`       // Trading direction,include buy and sell
	OrderPrice       float64              `json:"price,string"`
	OrderSize        float64              `json:"size,string"`
	RemainSize       float64              `json:"remainSize,string"`
	FilledSize       float64              `json:"filledSize,string"`   // Remaining Size for Trading
	CanceledSize     float64              `json:"canceledSize,string"` // In the update message, the Size of order reduced
	TradeID          string               `json:"tradeId"`             // Trade ID (when the type is "match")
	ClientOid        string               `json:"clientOid"`           // Client supplied order id.
	OrderTime        convert.ExchangeTime `json:"orderTime"`
	OldSize          string               `json:"oldSize "`  // Size Before Update (when the type is "update")
	TradingDirection string               `json:"liquidity"` // Liquidity, Trading direction, buy or sell in taker
	Timestamp        convert.ExchangeTime `json:"ts"`
}

WsFuturesTradeOrder represents trade order information according to the market.

type WsFuturesTransactionStatisticsTimeEvent

type WsFuturesTransactionStatisticsTimeEvent struct {
	Symbol                   string               `json:"symbol"`
	Volume24H                float64              `json:"volume"`
	Turnover24H              float64              `json:"turnover"`
	LastPrice                int64                `json:"lastPrice"`
	PriceChangePercentage24H float64              `json:"priceChgPct"`
	SnapshotTime             convert.ExchangeTime `json:"ts"`
}

WsFuturesTransactionStatisticsTimeEvent represents transaction statistics data.

type WsFuturesWithdrawalAmountAndTransferOutAmountEvent

type WsFuturesWithdrawalAmountAndTransferOutAmountEvent struct {
	WithdrawHold float64              `json:"withdrawHold"` // Current frozen amount for withdrawal
	Currency     string               `json:"currency"`
	Timestamp    convert.ExchangeTime `json:"timestamp"`
}

WsFuturesWithdrawalAmountAndTransferOutAmountEvent represents Withdrawal Amount & Transfer-Out Amount Event push data.

type WsMarginFundingBook

type WsMarginFundingBook struct {
	Sequence           int64                `json:"sequence"`
	Currency           string               `json:"currency"`
	DailyInterestRate  float64              `json:"dailyIntRate"`
	AnnualInterestRate float64              `json:"annualIntRate"`
	Term               int64                `json:"term"`
	Size               float64              `json:"size"`
	Side               string               `json:"side"`
	Timestamp          convert.ExchangeTime `json:"ts"` // In Nanosecond

}

WsMarginFundingBook represents order book changes on margin.

type WsMarginTradeOrderDoneEvent

type WsMarginTradeOrderDoneEvent struct {
	Currency  string               `json:"currency"`
	OrderID   string               `json:"orderId"`
	Reason    string               `json:"reason"`
	Side      string               `json:"side"`
	Timestamp convert.ExchangeTime `json:"ts"`
}

WsMarginTradeOrderDoneEvent represents a push message to the lenders when the order is completed.

type WsMarginTradeOrderEntersEvent

type WsMarginTradeOrderEntersEvent struct {
	Currency     string               `json:"currency"`
	OrderID      string               `json:"orderId"`      // Trade ID
	DailyIntRate float64              `json:"dailyIntRate"` // Daily interest rate.
	Term         int64                `json:"term"`         // Term (Unit: Day)
	Size         float64              `json:"size"`         // Size
	LentSize     float64              `json:"lentSize"`     // Size executed -- filled when the subject is order.update
	Side         string               `json:"side"`         // Lend or borrow. Currently, only "Lend" is available
	Timestamp    convert.ExchangeTime `json:"ts"`           // Timestamp (nanosecond)
}

WsMarginTradeOrderEntersEvent represents a push data to the lenders when the order enters the order book or when the order is executed.

type WsOrderbook

type WsOrderbook struct {
	Changes       OrderbookChanges     `json:"changes"`
	SequenceEnd   int64                `json:"sequenceEnd"`
	SequenceStart int64                `json:"sequenceStart"`
	Symbol        string               `json:"symbol"`
	TimeMS        convert.ExchangeTime `json:"time"`
}

WsOrderbook represents orderbook information.

type WsOrderbookDepth

type WsOrderbookDepth struct {
	Asks   [][]string           `json:"asks"`
	Bids   [][]string           `json:"bids"`
	Symbol string               `json:"symbol"`
	TimeMS convert.ExchangeTime `json:"timestamp"`
}

WsOrderbookDepth represents orderbook information.

type WsOrderbookLevel5

type WsOrderbookLevel5 struct {
	Sequence      int64                `json:"sequence"`
	Asks          []orderbook.Tranche  `json:"asks"`
	Bids          []orderbook.Tranche  `json:"bids"`
	PushTimestamp convert.ExchangeTime `json:"ts"`
	Timestamp     convert.ExchangeTime `json:"timestamp"`
}

WsOrderbookLevel5 represents an orderbook push data with depth level 5.

type WsOrderbookLevel5Response

type WsOrderbookLevel5Response struct {
	Timestamp     convert.ExchangeTime `json:"timestamp"`
	Sequence      int64                `json:"sequence"`
	Bids          [][2]types.Number    `json:"bids"`
	Asks          [][2]types.Number    `json:"asks"`
	PushTimestamp convert.ExchangeTime `json:"ts"`
}

WsOrderbookLevel5Response represents a response data for an orderbook push data with depth level 5.

func (*WsOrderbookLevel5Response) ExtractOrderbookItems

func (a *WsOrderbookLevel5Response) ExtractOrderbookItems() *WsOrderbookLevel5

ExtractOrderbookItems returns WsOrderbookLevel5 instance from WsOrderbookLevel5Response

type WsPositionStatus

type WsPositionStatus struct {
	Type        string               `json:"type"`
	TimestampMS convert.ExchangeTime `json:"timestamp"`
}

WsPositionStatus represents a position status push data.

type WsPriceIndicator

type WsPriceIndicator struct {
	Symbol      string               `json:"symbol"`
	Granularity float64              `json:"granularity"`
	Timestamp   convert.ExchangeTime `json:"timestamp"`
	Value       float64              `json:"value"`
}

WsPriceIndicator represents index price or mark price indicator push data.

type WsPushData

type WsPushData struct {
	ID          string          `json:"id"`
	Type        string          `json:"type"`
	Topic       string          `json:"topic"`
	UserID      string          `json:"userId"`
	Subject     string          `json:"subject"`
	ChannelType string          `json:"channelType"`
	Data        json.RawMessage `json:"data"`
}

WsPushData represents a push data from a server.

type WsSnapshot

type WsSnapshot struct {
	Sequence types.Number     `json:"sequence"`
	Data     WsSnapshotDetail `json:"data"`
}

WsSnapshot represents a spot ticker push data.

type WsSnapshotDetail

type WsSnapshotDetail struct {
	AveragePrice     float64              `json:"averagePrice"`
	BaseCurrency     string               `json:"baseCurrency"`
	Board            int64                `json:"board"`
	Buy              float64              `json:"buy"`
	ChangePrice      float64              `json:"changePrice"`
	ChangeRate       float64              `json:"changeRate"`
	Close            float64              `json:"close"`
	Datetime         convert.ExchangeTime `json:"datetime"`
	High             float64              `json:"high"`
	LastTradedPrice  float64              `json:"lastTradedPrice"`
	Low              float64              `json:"low"`
	MakerCoefficient float64              `json:"makerCoefficient"`
	MakerFeeRate     float64              `json:"makerFeeRate"`
	MarginTrade      bool                 `json:"marginTrade"`
	Mark             float64              `json:"mark"`
	Market           string               `json:"market"`
	Markets          []string             `json:"markets"`
	Open             float64              `json:"open"`
	QuoteCurrency    string               `json:"quoteCurrency"`
	Sell             float64              `json:"sell"`
	Sort             int64                `json:"sort"`
	Symbol           string               `json:"symbol"`
	SymbolCode       string               `json:"symbolCode"`
	TakerCoefficient float64              `json:"takerCoefficient"`
	TakerFeeRate     float64              `json:"takerFeeRate"`
	Trading          bool                 `json:"trading"`
	Vol              float64              `json:"vol"`
	VolValue         float64              `json:"volValue"`
}

WsSnapshotDetail represents the detail of a spot ticker data. This represents all websocket ticker information pushed as a result of subscription to /market/snapshot:{symbol}, and /market/snapshot:{currency,market}

type WsStopOrder

type WsStopOrder struct {
	CreatedAt      convert.ExchangeTime `json:"createdAt"`
	OrderID        string               `json:"orderId"`
	OrderPrice     float64              `json:"orderPrice,string"`
	OrderType      string               `json:"orderType"`
	Side           string               `json:"side"`
	Size           float64              `json:"size,string"`
	Stop           string               `json:"stop"`
	StopPrice      float64              `json:"stopPrice,string"`
	Symbol         string               `json:"symbol"`
	TradeType      string               `json:"tradeType"`
	TriggerSuccess bool                 `json:"triggerSuccess"`
	Timestamp      convert.ExchangeTime `json:"ts"`
	Type           string               `json:"type"`
}

WsStopOrder represents a stop order. When a stop order is received by the system, you will receive a message with "open" type. It means that this order entered the system and waited to be triggered.

type WsStopOrderLifecycleEvent

type WsStopOrderLifecycleEvent struct {
	OrderID        string               `json:"orderId"`
	Symbol         string               `json:"symbol"`
	Type           string               `json:"type"`
	OrderType      string               `json:"orderType"`
	Side           string               `json:"side"`
	Size           float64              `json:"size,string"`
	OrderPrice     float64              `json:"orderPrice,string"`
	Stop           string               `json:"stop"`
	StopPrice      float64              `json:"stopPrice,string"`
	StopPriceType  string               `json:"stopPriceType"`
	TriggerSuccess bool                 `json:"triggerSuccess"`
	Error          string               `json:"error"`
	CreatedAt      convert.ExchangeTime `json:"createdAt"`
	Timestamp      convert.ExchangeTime `json:"ts"`
}

WsStopOrderLifecycleEvent represents futures stop order lifecycle event.

type WsSubscriptionInput

type WsSubscriptionInput struct {
	ID             string `json:"id"`
	Type           string `json:"type"`
	Topic          string `json:"topic"`
	PrivateChannel bool   `json:"privateChannel"`
	Response       bool   `json:"response,omitempty"`
}

WsSubscriptionInput represents a subscription information structure.

type WsTicker

type WsTicker struct {
	Sequence    string               `json:"sequence"`
	BestAsk     float64              `json:"bestAsk,string"`
	Size        float64              `json:"size,string"`
	BestBidSize float64              `json:"bestBidSize,string"`
	Price       float64              `json:"price,string"`
	BestAskSize float64              `json:"bestAskSize,string"`
	BestBid     float64              `json:"bestBid,string"`
	Timestamp   convert.ExchangeTime `json:"time"`
}

WsTicker represents a ticker push data from server.

type WsTrade

type WsTrade struct {
	Sequence     string               `json:"sequence"`
	Type         string               `json:"type"`
	Symbol       string               `json:"symbol"`
	Side         string               `json:"side"`
	Price        float64              `json:"price,string"`
	Size         float64              `json:"size,string"`
	TradeID      string               `json:"tradeId"`
	TakerOrderID string               `json:"takerOrderId"`
	MakerOrderID string               `json:"makerOrderId"`
	Time         convert.ExchangeTime `json:"time"`
}

WsTrade represents a trade push data.

type WsTradeOrder

type WsTradeOrder struct {
	Symbol     string               `json:"symbol"`
	OrderType  string               `json:"orderType"`
	Side       string               `json:"side"`
	OrderID    string               `json:"orderId"`
	Type       string               `json:"type"`
	OrderTime  convert.ExchangeTime `json:"orderTime"`
	Size       float64              `json:"size,string"`
	FilledSize float64              `json:"filledSize,string"`
	Price      float64              `json:"price,string"`
	ClientOid  string               `json:"clientOid"`
	RemainSize float64              `json:"remainSize,string"`
	Status     string               `json:"status"`
	Timestamp  convert.ExchangeTime `json:"ts"`
	Liquidity  string               `json:"liquidity"`
	MatchPrice string               `json:"matchPrice"`
	MatchSize  string               `json:"matchSize"`
	TradeID    string               `json:"tradeId"`
	OldSize    string               `json:"oldSize"`
}

WsTradeOrder represents a private trade order push data.

Jump to

Keyboard shortcuts

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