Documentation ¶
Overview ¶
Package kumex provides two kinds of APIs: `RESTful API` and `WebSocket feed`. The official document: https://docs.kucoin.com/futures
Index ¶
- Constants
- Variables
- func IntToString(i int64) string
- func SetLoggerDirectory(directory string)
- func ToJsonString(v interface{}) string
- type AccountModel
- type AccountsModel
- type ApiResponse
- type ApiService
- func (as *ApiService) AccountOverview(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) ActiveContracts() (*ApiResponse, error)
- func (as *ApiService) ApplyWithdrawal(currency, address, amount string, options map[string]string) (*ApiResponse, error)
- func (as *ApiService) AutoDepositStatus(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) Call(request *Request) (*ApiResponse, error)
- func (as *ApiService) CancelOrder(orderId string) (*ApiResponse, error)
- func (as *ApiService) CancelOrders(symbol string) (*ApiResponse, error)
- func (as *ApiService) CancelTransfer(applyId string) (*ApiResponse, error)
- func (as *ApiService) CancelWithdrawal(withdrawalId string) (*ApiResponse, error)
- func (as *ApiService) ChangeRiskLimitLevel(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) Contracts(symbol string) (*ApiResponse, error)
- func (as *ApiService) ContractsRiskLimitLevel(symbol string) (*ApiResponse, error)
- func (as *ApiService) CreateOrder(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) DepositAddresses(currency string) (*ApiResponse, error)
- func (as *ApiService) DepositMargin(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) Deposits(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) Fills(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) FundingHistory(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) FundingRate(Symbol string) (*ApiResponse, error)
- func (as *ApiService) IndexQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) InterestQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) KLines(symbol, granularity string, startAt, endAt int64) (*ApiResponse, error)
- func (as *ApiService) Level2MessageQuery(symbol string, start, end int64) (*ApiResponse, error)
- func (as *ApiService) Level2Snapshot(symbol string) (*ApiResponse, error)
- func (as *ApiService) Level3MessageQuery(symbol string, start, end int64) (*ApiResponse, error)
- func (as *ApiService) Level3Snapshot(symbol string) (*ApiResponse, error)
- func (as *ApiService) Level3SnapshotV2(symbol string) (*ApiResponse, error)
- func (as *ApiService) MarkPrice(Symbol string) (*ApiResponse, error)
- func (as *ApiService) NewWebSocketClient(token *WebSocketTokenModel) *WebSocketClient
- func (as *ApiService) OpenOrderStatistics(symbol string) (*ApiResponse, error)
- func (as *ApiService) Order(orderId string) (*ApiResponse, error)
- func (as *ApiService) OrderByClientOid(clientOid string) (*ApiResponse, error)
- func (as *ApiService) Orders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) Position(symbol string) (*ApiResponse, error)
- func (as *ApiService) Positions() (*ApiResponse, error)
- func (as *ApiService) PremiumQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) RecentDoneOrders() (*ApiResponse, error)
- func (as *ApiService) RecentFills() (*ApiResponse, error)
- func (as *ApiService) ServerTime() (*ApiResponse, error)
- func (as *ApiService) ServiceStatus() (*ApiResponse, error)
- func (as *ApiService) StopOrders(symbol string) (*ApiResponse, error)
- func (as *ApiService) Ticker(symbol string) (*ApiResponse, error)
- func (as *ApiService) TradeHistory(symbol string) (*ApiResponse, error)
- func (as *ApiService) TransactionHistory(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) TransferList(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) TransferOut(bizNo, amount string) (*ApiResponse, error)
- func (as *ApiService) TransferOutV2(bizNo, amount, currency string) (*ApiResponse, error)
- func (as *ApiService) WebSocketPrivateToken() (*ApiResponse, error)
- func (as *ApiService) WebSocketPublicToken() (*ApiResponse, error)
- func (as *ApiService) WithdrawalQuotas(currency string) (*ApiResponse, error)
- func (as *ApiService) Withdrawals(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- type ApiServiceOption
- func ApiBaseURIOption(uri string) ApiServiceOption
- func ApiKeyOption(key string) ApiServiceOption
- func ApiKeyVersionOption(apiKeyVersion string) ApiServiceOption
- func ApiPassPhraseOption(passPhrase string) ApiServiceOption
- func ApiSecretOption(secret string) ApiServiceOption
- func ApiSkipVerifyTlsOption(skipVerifyTls bool) ApiServiceOption
- type ApplyWithdrawalResultModel
- type BasicRequester
- type CancelOrderResultModel
- type CancelTransferModel
- type CancelWithdrawalResultModel
- type ContractsModel
- type ContractsModels
- type ContractsRiskLimitLevelModel
- type CreateOrderResultModel
- type DepositAddressModel
- type DepositAddressesModel
- type DepositModel
- type DepositsModel
- type FillModel
- type FillsModel
- type FundingListModel
- type FundingModel
- type FundingRateModel
- type IndexModel
- type IndexQueryModel
- type InterestModel
- type InterestsModel
- type KLineModel
- type KLinesModel
- type KcSigner
- type Level2MessageQueryListModel
- type Level2MessageQueryModel
- type Level2SnapshotModel
- type Level3MessageQueryListModel
- type Level3MessageQueryModel
- type Level3SnapshotModel
- type Level3SnapshotV2Model
- type MarkPriceModel
- type OpenOrderStatisticsModel
- type OrderModel
- type OrdersModel
- type PaginationModel
- type PaginationParam
- type PositionModel
- type PremiumModel
- type PremiumsModel
- type Request
- type Requester
- type Response
- type RiskLimitLevelModel
- type ServiceStatusModel
- type Sha256Signer
- type Signer
- type TickerLevel1Model
- type TradeHistoryModel
- type TradesHistoryModel
- type TransactionHistoryListModel
- type TransactionHistoryModel
- type TransferModel
- type TransferOutModel
- type TransferOutV2Model
- type TransfersModel
- type WebSocketClient
- type WebSocketDownstreamMessage
- type WebSocketMessage
- type WebSocketServerModel
- type WebSocketServersModel
- type WebSocketSubscribeMessage
- type WebSocketTokenModel
- type WebSocketUnsubscribeMessage
- type WithdrawalModel
- type WithdrawalQuotasModel
- type WithdrawalsModel
Constants ¶
const ( WelcomeMessage = "welcome" PingMessage = "ping" PongMessage = "pong" SubscribeMessage = "subscribe" AckMessage = "ack" UnsubscribeMessage = "unsubscribe" ErrorMessage = "error" Message = "message" Notice = "notice" Command = "command" )
All message types of WebSocket.
const ApiKeyVersionV1 = "1"
ApiKeyVersionV1 is v1 api key version
const ApiKeyVersionV2 = "2"
ApiKeyVersionV2 is v2 api key version
const (
ApiSuccess = "200000"
)
The predefined API codes
const ProductionApiBaseURI = "https://api-futures.kucoin.com"
ProductionApiBaseURI is api base uri for production.
Variables ¶
var ( // Version is SDK version. Version = "1.0.5" // DebugMode will record the logs of API and WebSocket to files in the directory "kumex.LogDirectory" according to the minimum log level "kumex.LogLevel". DebugMode = os.Getenv("API_DEBUG_MODE") == "1" )
Functions ¶
func SetLoggerDirectory ¶
func SetLoggerDirectory(directory string)
SetLoggerDirectory sets the directory for logrus output.
func ToJsonString ¶
func ToJsonString(v interface{}) string
ToJsonString converts any value to JSON string.
Types ¶
type AccountModel ¶
type AccountModel struct { AccountEquity float64 `json:"accountEquity"` UnrealisedPNL float64 `json:"unrealisedPNL"` MarginBalance float64 `json:"marginBalance"` PositionMargin float64 `json:"positionMargin"` OrderMargin float64 `json:"orderMargin"` FrozenFunds float64 `json:"frozenFunds"` AvailableBalance float64 `json:"availableBalance"` Currency string `json:"currency"` }
An AccountModel represents an account.
type AccountsModel ¶
type AccountsModel []*AccountModel
An AccountsModel is the set of *AccountModel.
type ApiResponse ¶
type ApiResponse struct { Code string `json:"code"` RawData jsoniter.RawMessage `json:"data"` // delay parsing Message string `json:"msg"` // contains filtered or unexported fields }
An ApiResponse represents a API response wrapped Response.
func (*ApiResponse) ApiSuccessful ¶
func (ar *ApiResponse) ApiSuccessful() bool
ApiSuccessful judges the success of API.
func (*ApiResponse) HttpSuccessful ¶
func (ar *ApiResponse) HttpSuccessful() bool
HttpSuccessful judges the success of http.
func (*ApiResponse) ReadData ¶
func (ar *ApiResponse) ReadData(v interface{}) error
ReadData read the api response `data` as JSON into v.
func (*ApiResponse) ReadPaginationData ¶
func (ar *ApiResponse) ReadPaginationData(v interface{}) (*PaginationModel, error)
ReadPaginationData read the data `items` as JSON into v, and returns *PaginationModel.
type ApiService ¶
type ApiService struct {
// contains filtered or unexported fields
}
An ApiService provides a HTTP client and a signer to make a HTTP request with the signature to KuCoin API.
func NewApiService ¶
func NewApiService(opts ...ApiServiceOption) *ApiService
NewApiService creates a instance of ApiService by passing ApiServiceOptions, then you can call methods.
func NewApiServiceFromEnv ¶
func NewApiServiceFromEnv() *ApiService
NewApiServiceFromEnv creates a instance of ApiService by environmental variables such as `API_BASE_URI` `API_KEY` `API_SECRET` `API_PASSPHRASE`, then you can call the methods of ApiService.
func (*ApiService) AccountOverview ¶
func (as *ApiService) AccountOverview(params map[string]string) (*ApiResponse, error)
AccountOverview returns a list of accounts. See the Deposits section for documentation on how to deposit funds to begin trading.
func (*ApiService) ActiveContracts ¶
func (as *ApiService) ActiveContracts() (*ApiResponse, error)
ActiveContracts Get Open Contract List.
func (*ApiService) ApplyWithdrawal ¶
func (as *ApiService) ApplyWithdrawal(currency, address, amount string, options map[string]string) (*ApiResponse, error)
ApplyWithdrawal applies a withdrawal.
func (*ApiService) AutoDepositStatus ¶
func (as *ApiService) AutoDepositStatus(params map[string]string) (*ApiResponse, error)
AutoDepositStatus Enable/Disable of Auto-Deposit Margin.
func (*ApiService) Call ¶
func (as *ApiService) Call(request *Request) (*ApiResponse, error)
Call calls the API by passing *Request and returns *ApiResponse.
func (*ApiService) CancelOrder ¶
func (as *ApiService) CancelOrder(orderId string) (*ApiResponse, error)
CancelOrder cancels a previously placed order.
func (*ApiService) CancelOrders ¶
func (as *ApiService) CancelOrders(symbol string) (*ApiResponse, error)
CancelOrders cancels all orders of the symbol. With best effort, cancel all open orders. The response is a list of ids of the canceled orders.
func (*ApiService) CancelTransfer ¶
func (as *ApiService) CancelTransfer(applyId string) (*ApiResponse, error)
CancelTransfer Cancel Transfer-Out Request.
func (*ApiService) CancelWithdrawal ¶
func (as *ApiService) CancelWithdrawal(withdrawalId string) (*ApiResponse, error)
CancelWithdrawal cancels a withdrawal by withdrawalId.
func (*ApiService) ChangeRiskLimitLevel ¶
func (as *ApiService) ChangeRiskLimitLevel(params map[string]string) (*ApiResponse, error)
ContractsRiskLimit adjust contract risk limit level
func (*ApiService) Contracts ¶
func (as *ApiService) Contracts(symbol string) (*ApiResponse, error)
Contracts Get Order Info. of the Contract.
func (*ApiService) ContractsRiskLimitLevel ¶
func (as *ApiService) ContractsRiskLimitLevel(symbol string) (*ApiResponse, error)
ContractsRiskLimitLevel obtain information about risk limit level of a specific contract
func (*ApiService) CreateOrder ¶
func (as *ApiService) CreateOrder(params map[string]string) (*ApiResponse, error)
CreateOrder places a new order.
func (*ApiService) DepositAddresses ¶
func (as *ApiService) DepositAddresses(currency string) (*ApiResponse, error)
DepositAddresses returns the deposit address of currency for deposit. If return data is empty, you may need create a deposit address first.
func (*ApiService) DepositMargin ¶
func (as *ApiService) DepositMargin(params map[string]string) (*ApiResponse, error)
DepositMargin Add Margin Manually.
func (*ApiService) Deposits ¶
func (as *ApiService) Deposits(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
Deposits returns a list of deposit.
func (*ApiService) Fills ¶
func (as *ApiService) Fills(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
Fills returns a list of recent fills.
func (*ApiService) FundingHistory ¶
func (as *ApiService) FundingHistory(params map[string]string) (*ApiResponse, error)
FundingHistory Get Funding History.
func (*ApiService) FundingRate ¶
func (as *ApiService) FundingRate(Symbol string) (*ApiResponse, error)
FundingRate Get Current Funding Rate.
func (*ApiService) IndexQuery ¶
func (as *ApiService) IndexQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
IndexQuery Get Index List.
func (*ApiService) InterestQuery ¶
func (as *ApiService) InterestQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
InterestQuery Get Interest Rate List .
func (*ApiService) KLines ¶
func (as *ApiService) KLines(symbol, granularity string, startAt, endAt int64) (*ApiResponse, error)
Data are returned in grouped buckets based on requested type. Parameter #2 granularity is the type of granularity patterns(minute). Parameter #3 #4 startAt, endAt is millisecond.
func (*ApiService) Level2MessageQuery ¶
func (as *ApiService) Level2MessageQuery(symbol string, start, end int64) (*ApiResponse, error)
Level2MessageQuery Level 2 Pulling Messages.
func (*ApiService) Level2Snapshot ¶
func (as *ApiService) Level2Snapshot(symbol string) (*ApiResponse, error)
Level2Snapshot Get Full Order Book - Level 2.
func (*ApiService) Level3MessageQuery ¶
func (as *ApiService) Level3MessageQuery(symbol string, start, end int64) (*ApiResponse, error)
Level3MessageQuery Level 3 Pulling Messages.
func (*ApiService) Level3Snapshot ¶
func (as *ApiService) Level3Snapshot(symbol string) (*ApiResponse, error)
Level3Snapshot Get Full Order Book - Level 3.
func (*ApiService) Level3SnapshotV2 ¶
func (as *ApiService) Level3SnapshotV2(symbol string) (*ApiResponse, error)
Level3SnapshotV2 Get Full Order Book - Level 3.
func (*ApiService) MarkPrice ¶
func (as *ApiService) MarkPrice(Symbol string) (*ApiResponse, error)
MarkPrice Get Current Mark Price
func (*ApiService) NewWebSocketClient ¶
func (as *ApiService) NewWebSocketClient(token *WebSocketTokenModel) *WebSocketClient
NewWebSocketClient creates an instance of WebSocketClient.
func (*ApiService) OpenOrderStatistics ¶
func (as *ApiService) OpenOrderStatistics(symbol string) (*ApiResponse, error)
OpenOrderStatistics Active Order Value Calculation.
func (*ApiService) Order ¶
func (as *ApiService) Order(orderId string) (*ApiResponse, error)
Order returns a single order by order id.
func (*ApiService) OrderByClientOid ¶
func (as *ApiService) OrderByClientOid(clientOid string) (*ApiResponse, error)
Order returns a single order by client Oid.
func (*ApiService) Orders ¶
func (as *ApiService) Orders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
Orders returns a list your current orders.
func (*ApiService) Position ¶
func (as *ApiService) Position(symbol string) (*ApiResponse, error)
Position Get Position Details.
func (*ApiService) Positions ¶
func (as *ApiService) Positions() (*ApiResponse, error)
Positions Get Position List.
func (*ApiService) PremiumQuery ¶
func (as *ApiService) PremiumQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
PremiumQuery Get Premium Index.
func (*ApiService) RecentDoneOrders ¶
func (as *ApiService) RecentDoneOrders() (*ApiResponse, error)
RecentDoneOrders returns the recent orders of the latest transactions within 24 hours.
func (*ApiService) RecentFills ¶
func (as *ApiService) RecentFills() (*ApiResponse, error)
RecentFills returns the recent fills of the latest transactions within 24 hours.
func (*ApiService) ServerTime ¶
func (as *ApiService) ServerTime() (*ApiResponse, error)
ServerTime returns the API server time.
func (*ApiService) ServiceStatus ¶
func (as *ApiService) ServiceStatus() (*ApiResponse, error)
ServiceStatus returns the service status.
func (*ApiService) StopOrders ¶
func (as *ApiService) StopOrders(symbol string) (*ApiResponse, error)
StopOrders represents an order.
func (*ApiService) Ticker ¶
func (as *ApiService) Ticker(symbol string) (*ApiResponse, error)
Ticker Get Real-Time Ticker.
func (*ApiService) TradeHistory ¶
func (as *ApiService) TradeHistory(symbol string) (*ApiResponse, error)
TradeHistory returns a list the latest trades for a symbol.
func (*ApiService) TransactionHistory ¶
func (as *ApiService) TransactionHistory(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
TransactionHistory returns a list of ledgers. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first.
func (*ApiService) TransferList ¶
func (as *ApiService) TransferList(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
TransferList returns a list of deposit.
func (*ApiService) TransferOut ¶
func (as *ApiService) TransferOut(bizNo, amount string) (*ApiResponse, error)
TransferOut Transfer Funds to KuCoin-Main Account.
func (*ApiService) TransferOutV2 ¶
func (as *ApiService) TransferOutV2(bizNo, amount, currency string) (*ApiResponse, error)
TransferOut Transfer Funds to KuCoin-Main Account.
func (*ApiService) WebSocketPrivateToken ¶
func (as *ApiService) WebSocketPrivateToken() (*ApiResponse, error)
WebSocketPrivateToken returns the token for private channel.
func (*ApiService) WebSocketPublicToken ¶
func (as *ApiService) WebSocketPublicToken() (*ApiResponse, error)
WebSocketPublicToken returns the token for public channel.
func (*ApiService) WithdrawalQuotas ¶
func (as *ApiService) WithdrawalQuotas(currency string) (*ApiResponse, error)
WithdrawalQuotas returns the quotas of withdrawal.
func (*ApiService) Withdrawals ¶
func (as *ApiService) Withdrawals(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
Withdrawals returns a list of withdrawals.
type ApiServiceOption ¶
type ApiServiceOption func(service *ApiService)
An ApiServiceOption is a option parameter to create the instance of ApiService.
func ApiBaseURIOption ¶
func ApiBaseURIOption(uri string) ApiServiceOption
ApiBaseURIOption creates a instance of ApiServiceOption about apiBaseURI.
func ApiKeyOption ¶
func ApiKeyOption(key string) ApiServiceOption
ApiKeyOption creates a instance of ApiServiceOption about apiKey.
func ApiKeyVersionOption ¶
func ApiKeyVersionOption(apiKeyVersion string) ApiServiceOption
ApiKeyVersionOption creates a instance of ApiServiceOption about apiKeyVersion.
func ApiPassPhraseOption ¶
func ApiPassPhraseOption(passPhrase string) ApiServiceOption
ApiPassPhraseOption creates a instance of ApiServiceOption about apiPassPhrase.
func ApiSecretOption ¶
func ApiSecretOption(secret string) ApiServiceOption
ApiSecretOption creates a instance of ApiServiceOption about apiSecret.
func ApiSkipVerifyTlsOption ¶
func ApiSkipVerifyTlsOption(skipVerifyTls bool) ApiServiceOption
ApiSkipVerifyTlsOption creates a instance of ApiServiceOption about apiSkipVerifyTls.
type ApplyWithdrawalResultModel ¶
type ApplyWithdrawalResultModel struct {
WithdrawalId string `json:"withdrawalId"`
}
ApplyWithdrawalResultModel represents the result of ApplyWithdrawal().
type BasicRequester ¶
type BasicRequester struct { }
A BasicRequester represents a basic implement of Requester by http.Client.
type CancelOrderResultModel ¶
type CancelOrderResultModel struct {
CancelledOrderIds []string `json:"cancelledOrderIds"`
}
A CancelOrderResultModel represents the result of CancelOrder().
type CancelTransferModel ¶
type CancelTransferModel struct {
ApplyId string `json:"applyId"`
}
CancelTransferModel represents the result of CancelWithdrawal().
type CancelWithdrawalResultModel ¶
type CancelWithdrawalResultModel struct {
CancelledWithdrawIds []string `json:"cancelledWithdrawIds"`
}
CancelWithdrawalResultModel represents the result of CancelWithdrawal().
type ContractsModel ¶
type ContractsModel struct { BaseCurrency string `json:"baseCurrency"` FairMethod string `json:"fairMethod"` FundingBaseSymbol string `json:"fundingBaseSymbol"` FundingQuoteSymbol string `json:"fundingQuoteSymbol"` FundingRateSymbol string `json:"fundingRateSymbol"` IndexSymbol string `json:"indexSymbol"` InitialMargin float32 `json:"initialMargin"` IsDeleverage bool `json:"isDeleverage"` IsInverse bool `json:"isInverse"` IsQuanto bool `json:"isQuanto"` LotSize float32 `json:"lotSize"` MaintainMargin float32 `json:"maintainMargin"` MakerFeeRate float32 `json:"makerFeeRate"` MakerFixFee float32 `json:"makerFixFee"` MarkMethod string `json:"markMethod"` MaxOrderQty float32 `json:"maxOrderQty"` MaxPrice float32 `json:"maxPrice"` MaxRiskLimit float32 `json:"maxRiskLimit"` MinRiskLimit float32 `json:"minRiskLimit"` Multiplier float32 `json:"multiplier"` QuoteCurrency string `json:"quoteCurrency"` RiskStep int `json:"riskStep"` RootSymbol string `json:"rootSymbol"` Status string `json:"status"` Symbol string `json:"symbol"` TakerFeeRate float32 `json:"takerFeeRate"` TakerFixFee float32 `json:"takerFixFee"` TickSize float32 `json:"tickSize"` Type string `json:"type"` MaxLeverage float32 `json:"maxLeverage"` VolumeOf24h float64 `json:"volumeOf24h"` TurnoverOf24h float64 `json:"turnoverOf24h"` OpenInterest string `json:"openInterest"` }
A ContractsModel is the struct.
type ContractsModels ¶
type ContractsModels []*ContractsModel
type ContractsRiskLimitLevelModel ¶
type ContractsRiskLimitLevelModel []*RiskLimitLevelModel
ContractRiskLimitLevelModel represents a Contract risk limit level info.
type CreateOrderResultModel ¶
type CreateOrderResultModel struct {
OrderId string `json:"orderId"`
}
A CreateOrderResultModel represents the result of CreateOrder().
type DepositAddressModel ¶
A DepositAddressModel represents a deposit address of currency for deposit.
type DepositAddressesModel ¶
type DepositAddressesModel []*DepositAddressModel
A DepositAddressesModel is the set of *DepositAddressModel.
type DepositModel ¶
type DepositModel struct { Currency string `json:"currency"` Status string `json:"status"` Address string `json:"address"` IsInner bool `json:"isInner"` Amount string `json:"amount"` Fee string `json:"fee"` WalletTxId string `json:"walletTxId"` CreatedAt int64 `json:"createdAt"` }
A DepositModel represents a deposit record.
type FillModel ¶
type FillModel struct { Symbol string `json:"symbol"` TradeId string `json:"tradeId"` OrderId string `json:"orderId"` Side string `json:"side"` Liquidity string `json:"liquidity"` Price string `json:"price"` Size float64 `json:"size"` Value string `json:"value"` FeeRate string `json:"feeRate"` FixFee string `json:"fixFee"` FeeCurrency string `json:"feeCurrency"` Stop string `json:"stop"` Fee string `json:"fee"` OrderType string `json:"orderType"` TradeType string `json:"tradeType"` CreatedAt int64 `json:"createdAt"` SettleCurrency string `json:"settleCurrency"` TradeTime int64 `json:"tradeTime"` }
A FillModel represents the structure of fill.
type FundingListModel ¶
type FundingListModel struct { HasMore bool `json:"hasMore"` DataList []*FundingModel `json:"dataList"` // delay parsing }
A FundingListModel is the set of *FundingModel.
type FundingModel ¶
type FundingModel struct { Id int64 `json:"id"` Symbol string `json:"symbol"` TimePoint int64 `json:"timePoint"` FundingRate float64 `json:"fundingRate"` MarkPrice float64 `json:"markPrice"` PositionQty float32 `json:"positionQty"` PositionCost float64 `json:"positionCost"` Funding float64 `json:"funding"` SettleCurrency string `json:"settleCurrency"` }
A FundingModel represents a funding record.
type FundingRateModel ¶
type FundingRateModel struct { Symbol string `json:"symbol"` Granularity int64 `json:"granularity"` TimePoint int64 `json:"timePoint"` Value float32 `json:"value"` PredictedValue float32 `json:"predictedValue"` }
A FundingRateModel is the struct.
type IndexModel ¶
type IndexModel struct { Symbol string `json:"symbol"` Granularity int `json:"granularity"` TimePoint int64 `json:"timePoint"` Value float32 `json:"value"` DecomposionList [][]interface{} `json:"decomposionList"` }
IndexModel is the struct.
type IndexQueryModel ¶
type IndexQueryModel struct { HasMore bool `json:"hasMore"` DataList []*IndexModel `json:"dataList"` // delay parsing }
A IndexQueryModel is the set of *IndexModel.
type InterestModel ¶
type InterestModel struct { Symbol string `json:"symbol"` Granularity int `json:"granularity"` TimePoint int64 `json:"timePoint"` Value float32 `json:"value"` }
InterestModel is the struct.
type InterestsModel ¶
type InterestsModel struct { HasMore bool `json:"hasMore"` DataList []*InterestModel `json:"dataList"` // delay parsing }
InterestsModel is the set of *InterestModel.
type KcSigner ¶
type KcSigner struct { Sha256Signer // contains filtered or unexported fields }
KcSigner is the implement of Signer for kumex.
func NewKcSigner ¶
NewKcSigner creates a instance of KcSigner.
func NewKcSignerV2 ¶
NewKcSignerV2 creates a instance of KcSigner.
type Level2MessageQueryListModel ¶
type Level2MessageQueryListModel []*Level2MessageQueryModel
Level2MessageQueryListModel the set of *Level2MessageQueryModel.
type Level2MessageQueryModel ¶
type Level2MessageQueryModel struct { Symbol string `json:"symbol"` Sequence int `json:"sequence"` Change string `json:"change"` }
Level2MessageQueryModel represents level2 ticker message.
type Level2SnapshotModel ¶
type Level2SnapshotModel struct { Symbol string `json:"symbol"` Sequence int `json:"sequence"` Asks [][]float32 `json:"asks"` Bids [][]float32 `json:"bids"` }
Level2SnapshotModel represents level2 ticker.
type Level3MessageQueryListModel ¶
type Level3MessageQueryListModel []*Level3MessageQueryModel
Level3MessageQueryListModel is the set of *Level3MessageQueryModel
type Level3MessageQueryModel ¶
type Level3MessageQueryModel struct { Symbol string `json:"symbol"` Sequence int `json:"sequence"` Side string `json:"side"` OrderTime int64 `json:"orderTime"` Size int `json:"size"` OrderId string `json:"orderId"` Price string `json:"price"` Type string `json:"type"` ClientOid string `json:"clientOid"` Ts int64 `json:"ts"` }
Level3MessageQueryModel represents level3 ticker message.
type Level3SnapshotModel ¶
type Level3SnapshotModel struct { Symbol string `json:"symbol"` Sequence int `json:"sequence"` Asks [][]interface{} `json:"asks"` Bids [][]interface{} `json:"bids"` }
Level3SnapshotModel represents level3 ticker message.
type Level3SnapshotV2Model ¶
type Level3SnapshotV2Model struct { Symbol string `json:"symbol"` Sequence int `json:"sequence"` Asks [][]interface{} `json:"asks"` Bids [][]interface{} `json:"bids"` Ts int64 `json:"ts"` }
Level3SnapshotV2Model represents level3 ticker message.
type MarkPriceModel ¶
type MarkPriceModel struct { Symbol string `json:"symbol"` Granularity float32 `json:"granularity"` TimePoint int64 `json:"timePoint"` Value float32 `json:"value"` IndexPrice float32 `json:"indexPrice"` }
A MarkPriceModel is the struct.
type OpenOrderStatisticsModel ¶
type OpenOrderStatisticsModel struct { OpenOrderBuySize int32 `json:"openOrderBuySize"` OpenOrderSellSize int32 `json:"openOrderSellSize"` OpenOrderBuyCost string `json:"openOrderBuyCost"` OpenOrderSellCost string `json:"openOrderSellCost"` SettleCurrency string `json:"settleCurrency"` }
A OpenOrderStatisticsModel represents the struct of fill.
type OrderModel ¶
type OrderModel struct { Id string `json:"id"` Symbol string `json:"symbol"` Type string `json:"type"` Side string `json:"side"` Price string `json:"price"` Size int64 `json:"size"` Value string `json:"value"` DealValue string `json:"dealValue"` DealSize int64 `json:"dealSize"` Stp string `json:"stp"` Stop string `json:"stop"` StopPriceType string `json:"stopPriceType"` StopTriggered bool `json:"stopTriggered"` StopPrice string `json:"stopPrice"` TimeInForce string `json:"timeInForce"` PostOnly bool `json:"postOnly"` Hidden bool `json:"hidden"` IceBerg bool `json:"iceberg"` VisibleSize string `json:"visibleSize"` Leverage string `json:"leverage"` ForceHold bool `json:"forceHold"` CloseOrder bool `json:"closeOrder"` CloseOnly bool `json:"closeOnly"` ClientOid string `json:"clientOid"` Remark string `json:"remark"` IsActive bool `json:"isActive"` CancelExist bool `json:"cancelExist"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` SettleCurrency string `json:"settleCurrency"` Status string `json:"status"` }
An OrderModel represents an order.
type PaginationModel ¶
type PaginationModel struct { CurrentPage int64 `json:"currentPage"` PageSize int64 `json:"pageSize"` TotalNum int64 `json:"totalNum"` TotalPage int64 `json:"totalPage"` RawItems json.RawMessage `json:"items"` // delay parsing }
A PaginationModel represents the pagination in a response.
func (*PaginationModel) ReadItems ¶
func (p *PaginationModel) ReadItems(v interface{}) error
ReadItems read the `items` into v.
type PaginationParam ¶
A PaginationParam represents the pagination parameters `currentPage` `pageSize` in a request .
func (*PaginationParam) ReadParam ¶
func (p *PaginationParam) ReadParam(params map[string]string)
ReadParam read pagination parameters into params.
type PositionModel ¶
type PositionModel struct { Id string `json:"id"` Symbol string `json:"symbol"` AutoDeposit bool `json:"autoDeposit"` MaintMarginReq string `json:"maintMarginReq"` RiskLimit string `json:"riskLimit"` RealLeverage string `json:"realLeverage"` CrossMode bool `json:"crossMode"` DelevPercentage string `json:"delevPercentage"` OpeningTimestamp string `json:"openingTimestamp"` CurrentTimestamp string `json:"currentTimestamp"` CurrentQty string `json:"currentQty"` CurrentCost string `json:"currentCost"` CurrentComm string `json:"currentComm"` UnrealisedCost string `json:"unrealisedCost"` RealisedGrossCost string `json:"realisedGrossCost"` RealisedCost string `json:"realisedCost"` IsOpen bool `json:"isOpen"` MarkPrice string `json:"markPrice"` MarkValue string `json:"markValue"` PosCost string `json:"posCost"` PosCross string `json:"posCross"` PosInit string `json:"posInit"` PosComm string `json:"posComm"` PosLoss string `json:"posLoss"` PosMargin string `json:"posMargin"` PosMaint string `json:"posMaint"` MaintMargin string `json:"maintMargin"` RealisedGrossPnl string `json:"realisedGrossPnl"` RealisedPnl string `json:"realisedPnl"` UnrealisedPnl string `json:"unrealisedPnl"` UnrealisedPnlPcnt string `json:"unrealisedPnlPcnt"` UnrealisedRoePcnt string `json:"unrealisedRoePcnt"` AvgEntryPrice string `json:"avgEntryPrice"` LiquidationPrice string `json:"liquidationPrice"` BankruptPrice string `json:"bankruptPrice"` SettleCurrency string `json:"settleCurrency"` }
A PositionModel represents a position info.
type PremiumModel ¶
type PremiumModel struct { Symbol string `json:"symbol"` Granularity string `json:"granularity"` TimePoint string `json:"timePoint"` Value string `json:"value"` }
A PremiumModel is the struct.
type PremiumsModel ¶
type PremiumsModel struct { HasMore bool `json:"hasMore"` DataList []*PremiumModel `json:"dataList"` // delay parsing }
A PremiumsModel is the set of *PremiumModel.
type Request ¶
type Request struct { BaseURI string Method string Path string Query url.Values Body []byte Header http.Header Timeout time.Duration SkipVerifyTls bool // contains filtered or unexported fields }
A Request represents a HTTP request.
func NewRequest ¶
NewRequest creates a instance of Request.
func (*Request) HttpRequest ¶
HttpRequest creates a instance of *http.Request.
func (*Request) RequestURI ¶
RequestURI returns the request uri.
type Response ¶
A Response represents a HTTP response.
func (*Response) ReadJsonBody ¶
ReadJsonBody read the response data as JSON into v.
type RiskLimitLevelModel ¶
type RiskLimitLevelModel struct { Symbol string `json:"symbol"` Level int64 `json:"level"` MaxRiskLimit int64 `json:"maxRiskLimit"` MinRiskLimit int64 `json:"minRiskLimit"` MaxLeverage int64 `json:"maxLeverage"` InitialMargin float64 `json:"initialMargin"` MaintainMargin float64 `json:"maintainMargin"` }
RiskLimitLevelModel represents a Contract risk limit level info.
type ServiceStatusModel ¶
A ServiceStatusModel represents the structure of service status.
type Sha256Signer ¶
type Sha256Signer struct {
// contains filtered or unexported fields
}
Sha256Signer is the sha256 Signer.
func (*Sha256Signer) Sign ¶
func (ss *Sha256Signer) Sign(plain []byte) []byte
Sign makes a signature by sha256.
type TickerLevel1Model ¶
type TickerLevel1Model struct { Sequence int `json:"sequence"` Symbol string `json:"symbol"` Side string `json:"side"` Size int `json:"size"` Price string `json:"price"` BestBidSize int `json:"bestBidSize"` BestBidPrice string `json:"bestBidPrice"` BestAskSize int `json:"bestAskSize"` BestAskPrice string `json:"bestAskPrice"` TradeId string `json:"tradeId"` Ts int64 `json:"ts"` }
A TickerLevel1Model represents ticker include only the inside (i.e. best) bid and ask data, last price and last trade size.
type TradeHistoryModel ¶
type TradeHistoryModel struct { Sequence int `json:"sequence"` TradeId string `json:"tradeId"` TakerOrderId string `json:"takerOrderId"` MakerOrderId string `json:"makerOrderId"` Price string `json:"price"` Size int `json:"size"` Side string `json:"side"` Time int64 `json:"t"` }
TradeHistoryModel represents a the latest trades for a symbol.
type TradesHistoryModel ¶
type TradesHistoryModel []*TradeHistoryModel
TradesHistoryModel is the set of *TradeHistoryModel.
type TransactionHistoryListModel ¶
type TransactionHistoryListModel []*TransactionHistoryModel
An TransactionHistoryListModel the set of *TransactionHistoryModel.
type TransactionHistoryModel ¶
type TransactionHistoryModel struct { Time string `json:"time"` Type string `json:"type"` Amount string `json:"amount"` Fee string `json:"fee"` AccountEquity string `json:"accountEquity"` Status string `json:"status"` Remarks string `json:"remark"` Offset string `json:"offset"` Currency string `json:"currency"` }
A TransactionHistoryModel represents a sub-account user.
type TransferModel ¶
type TransferModel struct { ApplyId string `json:"applyId"` Currency string `json:"currency"` Status string `json:"status"` Amount string `json:"amount"` Reason string `json:"reason"` Offset int64 `json:"offset"` CreatedAt int64 `json:"createdAt"` }
A TransferModel represents a transfer record.
type TransferOutModel ¶
type TransferOutModel struct {
ApplyId string `json:"applyId"`
}
A TransferOutModel represents a transfer out record.
type TransferOutV2Model ¶
type TransferOutV2Model struct {
ApplyId string `json:"applyId"`
}
A TransferOutModel represents a transfer out record.
type TransfersModel ¶
type TransfersModel []*TransferModel
A TransfersModel represents a transfer list.
type WebSocketClient ¶
type WebSocketClient struct {
// contains filtered or unexported fields
}
A WebSocketClient represents a connection to WebSocket server.
func (*WebSocketClient) Connect ¶
func (wc *WebSocketClient) Connect() (<-chan *WebSocketDownstreamMessage, <-chan error, error)
Connect connects the WebSocket server.
func (*WebSocketClient) Stop ¶
func (wc *WebSocketClient) Stop()
Stop stops subscribing the specified channel, all goroutines quit.
func (*WebSocketClient) Subscribe ¶
func (wc *WebSocketClient) Subscribe(channels ...*WebSocketSubscribeMessage) error
Subscribe subscribes the specified channel.
func (*WebSocketClient) Unsubscribe ¶
func (wc *WebSocketClient) Unsubscribe(channels ...*WebSocketUnsubscribeMessage) error
Unsubscribe unsubscribes the specified channel.
type WebSocketDownstreamMessage ¶
type WebSocketDownstreamMessage struct { *WebSocketMessage Sn string `json:"sn"` Topic string `json:"topic"` Subject string `json:"subject"` RawData json.RawMessage `json:"data"` }
A WebSocketDownstreamMessage represents a message from the WebSocket server to client.
func (*WebSocketDownstreamMessage) ReadData ¶
func (m *WebSocketDownstreamMessage) ReadData(v interface{}) error
ReadData read the data in channel.
type WebSocketMessage ¶
A WebSocketMessage represents a message between the WebSocket client and server.
func NewPingMessage ¶
func NewPingMessage() *WebSocketMessage
NewPingMessage creates a ping message instance.
type WebSocketServerModel ¶
type WebSocketServerModel struct { PingInterval int64 `json:"pingInterval"` Endpoint string `json:"endpoint"` Protocol string `json:"protocol"` Encrypt bool `json:"encrypt"` PingTimeout int64 `json:"pingTimeout"` }
A WebSocketServerModel contains some servers for WebSocket feed.
type WebSocketServersModel ¶
type WebSocketServersModel []*WebSocketServerModel
A WebSocketServersModel is the set of *WebSocketServerModel.
func (WebSocketServersModel) RandomServer ¶
func (s WebSocketServersModel) RandomServer() (*WebSocketServerModel, error)
RandomServer returns a server randomly.
type WebSocketSubscribeMessage ¶
type WebSocketSubscribeMessage struct { *WebSocketMessage Topic string `json:"topic"` PrivateChannel bool `json:"privateChannel"` Response bool `json:"response"` }
A WebSocketSubscribeMessage represents a message to subscribe the public/private channel.
func NewSubscribeMessage ¶
func NewSubscribeMessage(topic string, privateChannel bool) *WebSocketSubscribeMessage
NewSubscribeMessage creates a subscribe message instance.
type WebSocketTokenModel ¶
type WebSocketTokenModel struct { Token string `json:"token"` Servers WebSocketServersModel `json:"instanceServers"` AcceptUserMessage bool `json:"acceptUserMessage"` }
A WebSocketTokenModel contains a token and some servers for WebSocket feed.
type WebSocketUnsubscribeMessage ¶
type WebSocketUnsubscribeMessage WebSocketSubscribeMessage
A WebSocketUnsubscribeMessage represents a message to unsubscribe the public/private channel.
func NewUnsubscribeMessage ¶
func NewUnsubscribeMessage(topic string, privateChannel bool) *WebSocketUnsubscribeMessage
NewUnsubscribeMessage creates a unsubscribe message instance.
type WithdrawalModel ¶
type WithdrawalModel 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 string `json:"amount"` Fee string `json:"fee"` WalletTxId string `json:"walletTxId"` CreatedAt int64 `json:"createdAt"` Remark string `json:"remark"` Reason string `json:"reason"` }
A WithdrawalModel represents a withdrawal.
type WithdrawalQuotasModel ¶
type WithdrawalQuotasModel struct { Currency string `json:"currency"` LimitAmount float32 `json:"limitAmount"` UsedAmount float32 `json:"usedAmount"` RemainAmount float32 `json:"remainAmount"` AvailableAmount float32 `json:"availableAmount"` WithdrawMinSize float32 `json:"withdrawMinSize"` InnerWithdrawMinFee float32 `json:"innerWithdrawMinFee"` WithdrawMinFee float32 `json:"withdrawMinFee"` IsWithdrawEnabled bool `json:"isWithdrawEnabled"` Precision uint8 `json:"precision"` }
A WithdrawalQuotasModel represents the quotas for a currency.
type WithdrawalsModel ¶
type WithdrawalsModel []*WithdrawalModel
A WithdrawalsModel is the set of *WithdrawalModel.