Documentation ¶
Overview ¶
Package kucoin provides two kinds of APIs: `RESTful API` and `WebSocket feed`. The official document: https://docs.kucoin.com
Index ¶
- Constants
- Variables
- func IntToString(i int64) string
- func SetLoggerDirectory(directory string)
- func ToJsonString(v interface{}) string
- type AccountHoldModel
- type AccountHoldsModel
- type AccountLedgerModel
- type AccountLedgersModel
- type AccountModel
- type AccountsModel
- type AccountsTransferableModel
- type ApiResponse
- type ApiService
- func (as *ApiService) Account(accountId string) (*ApiResponse, error)
- func (as *ApiService) AccountHolds(accountId string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) AccountLedgers(accountId string, startAt, endAt int64, options map[string]string, ...) (*ApiResponse, error)
- func (as *ApiService) AccountLedgersV2(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) Accounts(currency, typo string) (*ApiResponse, error)
- func (as *ApiService) AccountsTransferable(currency, typo string) (*ApiResponse, error)
- func (as *ApiService) ActualFee(symbols string) (*ApiResponse, error)
- func (as *ApiService) AggregatedFullOrderBook(symbol string) (*ApiResponse, error)
- func (as *ApiService) AggregatedFullOrderBookV3(symbol string) (*ApiResponse, error)
- func (as *ApiService) AggregatedPartOrderBook(symbol string, depth int64) (*ApiResponse, error)
- func (as *ApiService) ApplyWithdrawal(currency, address, amount string, options map[string]string) (*ApiResponse, error)
- func (as *ApiService) AtomicFullOrderBook(symbol string) (*ApiResponse, error)
- func (as *ApiService) AtomicFullOrderBookV2(symbol string) (*ApiResponse, error)
- func (as *ApiService) BaseFee() (*ApiResponse, error)
- func (as *ApiService) BorrowOrder(orderId string) (*ApiResponse, error)
- func (as *ApiService) BorrowOutstandingRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) BorrowRepaidRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) Call(request *Request) (*ApiResponse, error)
- func (as *ApiService) CancelLendOrder(orderId string) (*ApiResponse, error)
- func (as *ApiService) CancelOrder(orderId string) (*ApiResponse, error)
- func (as *ApiService) CancelOrderByClient(clientOid string) (*ApiResponse, error)
- func (as *ApiService) CancelOrders(p map[string]string) (*ApiResponse, error)
- func (as *ApiService) CancelStopOrder(orderId string) (*ApiResponse, error)
- func (as *ApiService) CancelStopOrderBy(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) CancelStopOrderByClient(clientOid string, p map[string]string) (*ApiResponse, error)
- func (as *ApiService) CancelWithdrawal(withdrawalId string) (*ApiResponse, error)
- func (as *ApiService) CreateAccount(typo, currency string) (*ApiResponse, error)
- func (as *ApiService) CreateBorrowOrder(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) CreateDepositAddress(currency, chain string) (*ApiResponse, error)
- func (as *ApiService) CreateLendOrder(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) CreateMarginOrder(o *CreateOrderModel) (*ApiResponse, error)
- func (as *ApiService) CreateMultiOrder(symbol string, orders []*CreateOrderModel) (*ApiResponse, error)
- func (as *ApiService) CreateOrder(o *CreateOrderModel) (*ApiResponse, error)
- func (as *ApiService) CreateStopOrder(o *CreateOrderModel) (*ApiResponse, error)
- func (as *ApiService) Currencies() (*ApiResponse, error)
- func (as *ApiService) Currency(currency string, chain string) (*ApiResponse, error)
- func (as *ApiService) CurrencyV2(currency string, chain string) (*ApiResponse, error)
- func (as *ApiService) CurrentMarkPrice(symbol string) (*ApiResponse, error)
- func (as *ApiService) DepositAddresses(currency, chain string) (*ApiResponse, error)
- func (as *ApiService) DepositAddressesV2(currency 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) InnerTransferV2(clientOid, currency, from, to, amount string) (*ApiResponse, error)
- func (as *ApiService) KLines(symbol, typo string, startAt, endAt int64) (*ApiResponse, error)
- func (as *ApiService) LendActiveOrders(currency string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) LendAssets(currency string) (*ApiResponse, error)
- func (as *ApiService) LendDoneOrders(currency string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) LendTradeSettledRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) LendTradeUnsettledRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) MarginAccount() (*ApiResponse, error)
- func (as *ApiService) MarginConfig() (*ApiResponse, error)
- func (as *ApiService) MarginMarkets(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) MarginRiskLimit(marginModel string) (*ApiResponse, error)
- func (as *ApiService) MarginTradeLast(currency string) (*ApiResponse, error)
- func (as *ApiService) Markets() (*ApiResponse, error)
- func (as *ApiService) NewWebSocketClient(token *WebSocketTokenModel) *WebSocketClient
- func (as *ApiService) NewWebSocketClientOpts(opts WebSocketClientOpts) *WebSocketClient
- func (as *ApiService) Order(orderId string) (*ApiResponse, error)
- func (as *ApiService) OrderByClient(clientOid string) (*ApiResponse, error)
- func (as *ApiService) Orders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) Prices(base, currencies string) (*ApiResponse, error)
- func (as *ApiService) RecentFills() (*ApiResponse, error)
- func (as *ApiService) RecentOrders() (*ApiResponse, error)
- func (as *ApiService) RepayAll(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) RepaySingle(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) ServerTime() (*ApiResponse, error)
- func (as *ApiService) ServiceStatus() (*ApiResponse, error)
- func (as *ApiService) Stats24hr(symbol string) (*ApiResponse, error)
- func (as *ApiService) StopOrder(orderId string) (*ApiResponse, error)
- func (as *ApiService) StopOrderByClient(clientOid string, p map[string]string) (*ApiResponse, error)
- func (as *ApiService) StopOrders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) SubAccount(subUserId string) (*ApiResponse, error)
- func (as *ApiService) SubAccountUsers() (*ApiResponse, error)
- func (as *ApiService) SubAccounts() (*ApiResponse, error)
- func (as *ApiService) SubTransfer(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) SubTransferV2(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) Symbols(market string) (*ApiResponse, error)
- func (as *ApiService) TickerLevel1(symbol string) (*ApiResponse, error)
- func (as *ApiService) Tickers() (*ApiResponse, error)
- func (as *ApiService) ToggleAutoLend(params map[string]string) (*ApiResponse, error)
- func (as *ApiService) TradeHistories(symbol string) (*ApiResponse, error)
- func (as *ApiService) V1Deposits(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) V1Orders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) V1Withdrawals(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
- func (as *ApiService) WebSocketPrivateToken() (*ApiResponse, error)
- func (as *ApiService) WebSocketPublicToken() (*ApiResponse, error)
- func (as *ApiService) WithdrawalQuotas(currency, chain 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 ApiRequesterOption(requester Requester) ApiServiceOption
- func ApiSecretOption(secret string) ApiServiceOption
- func ApiSkipVerifyTlsOption(skipVerifyTls bool) ApiServiceOption
- type ApplyWithdrawalResultModel
- type BaseFeeModel
- type BasicRequester
- type BorrowOrderModel
- type BorrowOutstandingRecordModel
- type BorrowOutstandingRecordsModel
- type BorrowRepaidRecordModel
- type BorrowRepaidRecordsModel
- type CancelOrderByClientResultModel
- type CancelOrderResultModel
- type CancelStopOrderByClientModel
- type CancelWithdrawalResultModel
- type ChainsModel
- type CreateAccountModel
- type CreateBorrowOrderResultModel
- type CreateLendOrderResultModel
- type CreateMultiOrderResultModel
- type CreateOrderModel
- type CreateOrderResultModel
- type CurrenciesModel
- type CurrencyModel
- type CurrencyV2Model
- type DepositAddressModel
- type DepositAddressesModel
- type DepositAddressesV2Model
- type DepositModel
- type DepositsModel
- type FillModel
- type FillsModel
- type FullOrderBookModel
- type FullOrderBookV2Model
- type InnerTransferResultModel
- type KLineModel
- type KLinesModel
- type KcSigner
- type LendActiveOrderModel
- type LendActiveOrdersModel
- type LendAssetModel
- type LendAssetsModel
- type LendDoneOrderModel
- type LendDoneOrdersModel
- type LendOrderBaseModel
- type LendTradeSettledRecordModel
- type LendTradeSettledRecordsModel
- type LendTradeUnsettledRecordModel
- type LendTradeUnsettledRecordsModel
- type MarginAccountModel
- type MarginConfigModel
- type MarginMarketModel
- type MarginMarketsModel
- type MarginRiskLimitItemModel
- type MarginRiskLimitModel
- type MarginTradeModel
- type MarginTradesModel
- type MarkPriceModel
- type MarketsModel
- type OrderModel
- type OrdersModel
- type PaginationModel
- type PaginationParam
- type PartOrderBookModel
- type PricesModel
- type Request
- type Requester
- type Response
- type ServerTimeModel
- type ServiceStatusModel
- type Sha256Signer
- type Signer
- type Stats24hrModel
- type StopOrderListModel
- type StopOrderModel
- type SubAccountModel
- type SubAccountUserModel
- type SubAccountUsersModel
- type SubAccountsModel
- type SubTransferResultModel
- type SymbolModel
- type SymbolsModel
- type TickerLevel1Model
- type TickerModel
- type TickersModel
- type TickersResponseModel
- type TradeFeesResultModel
- type TradeHistoriesModel
- type TradeHistoryModel
- type V1DepositModel
- type V1DepositsModel
- type V1OrderModel
- type V1OrdersModel
- type V1WithdrawalModel
- type V1WithdrawalsModel
- type WebSocketClient
- type WebSocketClientOpts
- 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.kucoin.com"
ProductionApiBaseURI is api base uri for production.
Variables ¶
var ( // Version is SDK version. Version = "1.2.10" // DebugMode will record the logs of API and WebSocket to files in the directory "kucoin.LogDirectory" according to the minimum log level "kucoin.LogLevel". DebugMode = os.Getenv("API_DEBUG_MODE") == "1" )
Functions ¶
func SetLoggerDirectory ¶ added in v1.2.13
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 AccountHoldModel ¶
type AccountHoldModel struct { Currency string `json:"currency"` HoldAmount string `json:"holdAmount"` BizType string `json:"bizType"` OrderId string `json:"orderId"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
An AccountHoldModel represents the holds on an account for any active orders or pending withdraw requests. As an order is filled, the hold amount is updated. If an order is canceled, any remaining hold is removed. For a withdraw, once it is completed, the hold is removed.
type AccountHoldsModel ¶
type AccountHoldsModel []*AccountHoldModel
An AccountHoldsModel is the set of *AccountHoldModel.
type AccountLedgerModel ¶ added in v1.0.3
type AccountLedgerModel struct { ID string `json:"id"` Currency string `json:"currency"` Amount string `json:"amount"` Fee string `json:"fee"` Balance string `json:"balance"` AccountType string `json:"accountType"` BizType string `json:"bizType"` Direction string `json:"direction"` CreatedAt int64 `json:"createdAt"` Context json.RawMessage `json:"context"` }
An AccountLedgerModel represents account activity either increases or decreases your account balance.
type AccountLedgersModel ¶ added in v1.0.3
type AccountLedgersModel []*AccountLedgerModel
An AccountLedgersModel the set of *AccountLedgerModel.
type AccountModel ¶
type AccountModel struct { Id string `json:"id"` Currency string `json:"currency"` Type string `json:"type"` Balance string `json:"balance"` Available string `json:"available"` Holds string `json:"holds"` }
An AccountModel represents an account.
type AccountsModel ¶
type AccountsModel []*AccountModel
An AccountsModel is the set of *AccountModel.
type AccountsTransferableModel ¶ added in v1.2.13
type AccountsTransferableModel struct { Currency string `json:"currency"` Balance string `json:"balance"` Available string `json:"available"` Holds string `json:"holds"` Transferable string `json:"transferable"` }
AccountsTransferableModel RESPONSES of AccountsTransferable
type ApiResponse ¶
type ApiResponse struct { Code string `json:"code"` RawData json.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) Account ¶
func (as *ApiService) Account(accountId string) (*ApiResponse, error)
Account returns an account when you know the accountId.
func (*ApiService) AccountHolds ¶
func (as *ApiService) AccountHolds(accountId string, pagination *PaginationParam) (*ApiResponse, error)
AccountHolds returns a list of currency hold. Holds are placed on an account for any active orders or pending withdraw requests. As an order is filled, the hold amount is updated. If an order is canceled, any remaining hold is removed. For a withdraw, once it is completed, the hold is removed.
func (*ApiService) AccountLedgers ¶ added in v1.0.3
func (as *ApiService) AccountLedgers(accountId string, startAt, endAt int64, options map[string]string, pagination *PaginationParam) (*ApiResponse, error)
AccountLedgers returns a list of ledgers. Deprecated: This interface was discontinued on Nov 05, 2020. Please use AccountLedgersV2. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first. Deprecated
func (*ApiService) AccountLedgersV2 ¶ added in v1.2.13
func (as *ApiService) AccountLedgersV2(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
AccountLedgersV2 returns a list of ledgers. Recommended for use on Nov 05, 2020. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first.
func (*ApiService) Accounts ¶
func (as *ApiService) Accounts(currency, typo string) (*ApiResponse, error)
Accounts returns a list of accounts. See the Deposits section for documentation on how to deposit funds to begin trading.
func (*ApiService) AccountsTransferable ¶ added in v1.2.13
func (as *ApiService) AccountsTransferable(currency, typo string) (*ApiResponse, error)
AccountsTransferable returns the transferable balance of a specified account.
func (*ApiService) ActualFee ¶ added in v1.2.13
func (as *ApiService) ActualFee(symbols string) (*ApiResponse, error)
ActualFee returns the actual fee rate of the trading pair. You can inquire about fee rates of 10 trading pairs each time at most.
func (*ApiService) AggregatedFullOrderBook ¶
func (as *ApiService) AggregatedFullOrderBook(symbol string) (*ApiResponse, error)
AggregatedFullOrderBook returns a list of open orders(aggregated) for a symbol. Deprecated: Use AggregatedFullOrderBookV3/WebSocket instead.
func (*ApiService) AggregatedFullOrderBookV3 ¶ added in v1.2.13
func (as *ApiService) AggregatedFullOrderBookV3(symbol string) (*ApiResponse, error)
AggregatedFullOrderBookV3 returns a list of open orders(aggregated) for a symbol.
func (*ApiService) AggregatedPartOrderBook ¶ added in v1.0.3
func (as *ApiService) AggregatedPartOrderBook(symbol string, depth int64) (*ApiResponse, error)
AggregatedPartOrderBook returns a list of open orders(aggregated) for a symbol.
func (*ApiService) ApplyWithdrawal ¶
func (as *ApiService) ApplyWithdrawal(currency, address, amount string, options map[string]string) (*ApiResponse, error)
ApplyWithdrawal applies a withdrawal.
func (*ApiService) AtomicFullOrderBook ¶
func (as *ApiService) AtomicFullOrderBook(symbol string) (*ApiResponse, error)
AtomicFullOrderBook returns a list of open orders for a symbol. Level-3 order book includes all bids and asks (non-aggregated, each item in Level-3 means a single order).
func (*ApiService) AtomicFullOrderBookV2 ¶ added in v1.2.13
func (as *ApiService) AtomicFullOrderBookV2(symbol string) (*ApiResponse, error)
AtomicFullOrderBookV2 returns a list of open orders for a symbol. Level-3 order book includes all bids and asks (non-aggregated, each item in Level-3 means a single order).
func (*ApiService) BaseFee ¶ added in v1.2.13
func (as *ApiService) BaseFee() (*ApiResponse, error)
BaseFee returns the basic fee rate of users.
func (*ApiService) BorrowOrder ¶ added in v1.2.13
func (as *ApiService) BorrowOrder(orderId string) (*ApiResponse, error)
BorrowOrder returns a specific borrow order
func (*ApiService) BorrowOutstandingRecords ¶ added in v1.2.13
func (as *ApiService) BorrowOutstandingRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
BorrowOutstandingRecords returns borrow outstanding records
func (*ApiService) BorrowRepaidRecords ¶ added in v1.2.13
func (as *ApiService) BorrowRepaidRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
BorrowRepaidRecords returns repaid borrow records
func (*ApiService) Call ¶
func (as *ApiService) Call(request *Request) (*ApiResponse, error)
Call calls the API by passing *Request and returns *ApiResponse.
func (*ApiService) CancelLendOrder ¶ added in v1.2.13
func (as *ApiService) CancelLendOrder(orderId string) (*ApiResponse, error)
CancelLendOrder cancel a lend order
func (*ApiService) CancelOrder ¶
func (as *ApiService) CancelOrder(orderId string) (*ApiResponse, error)
CancelOrder cancels a previously placed order.
func (*ApiService) CancelOrderByClient ¶ added in v1.2.13
func (as *ApiService) CancelOrderByClient(clientOid string) (*ApiResponse, error)
CancelOrderByClient cancels a previously placed order by client ID.
func (*ApiService) CancelOrders ¶
func (as *ApiService) CancelOrders(p map[string]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) CancelStopOrder ¶ added in v1.2.13
func (as *ApiService) CancelStopOrder(orderId string) (*ApiResponse, error)
CancelStopOrder cancels a previously placed stop-order.
func (*ApiService) CancelStopOrderBy ¶ added in v1.2.13
func (as *ApiService) CancelStopOrderBy(params map[string]string) (*ApiResponse, error)
CancelStopOrderBy returns a list your current orders.
func (*ApiService) CancelStopOrderByClient ¶ added in v1.2.13
func (as *ApiService) CancelStopOrderByClient(clientOid string, p map[string]string) (*ApiResponse, error)
CancelStopOrderByClient cancels a previously placed stop-order by client ID.
func (*ApiService) CancelWithdrawal ¶
func (as *ApiService) CancelWithdrawal(withdrawalId string) (*ApiResponse, error)
CancelWithdrawal cancels a withdrawal by withdrawalId.
func (*ApiService) CreateAccount ¶
func (as *ApiService) CreateAccount(typo, currency string) (*ApiResponse, error)
CreateAccount creates an account according to type(main|trade) and currency Parameter #1 typo is type of account.
func (*ApiService) CreateBorrowOrder ¶ added in v1.2.13
func (as *ApiService) CreateBorrowOrder(params map[string]string) (*ApiResponse, error)
CreateBorrowOrder returns the result of create a borrow order
func (*ApiService) CreateDepositAddress ¶
func (as *ApiService) CreateDepositAddress(currency, chain string) (*ApiResponse, error)
CreateDepositAddress creates a deposit address.
func (*ApiService) CreateLendOrder ¶ added in v1.2.13
func (as *ApiService) CreateLendOrder(params map[string]string) (*ApiResponse, error)
CreateLendOrder returns the result of create a lend order
func (*ApiService) CreateMarginOrder ¶ added in v1.2.13
func (as *ApiService) CreateMarginOrder(o *CreateOrderModel) (*ApiResponse, error)
CreateMarginOrder places a new margin order.
func (*ApiService) CreateMultiOrder ¶ added in v1.2.13
func (as *ApiService) CreateMultiOrder(symbol string, orders []*CreateOrderModel) (*ApiResponse, error)
CreateMultiOrder places bulk orders.
func (*ApiService) CreateOrder ¶
func (as *ApiService) CreateOrder(o *CreateOrderModel) (*ApiResponse, error)
CreateOrder places a new order.
func (*ApiService) CreateStopOrder ¶ added in v1.2.13
func (as *ApiService) CreateStopOrder(o *CreateOrderModel) (*ApiResponse, error)
CreateStopOrder places a new stop-order.
func (*ApiService) Currencies ¶
func (as *ApiService) Currencies() (*ApiResponse, error)
Currencies returns a list of known currencies.
func (*ApiService) Currency ¶
func (as *ApiService) Currency(currency string, chain string) (*ApiResponse, error)
Currency returns the details of the currency. Deprecated: Use CurrencyV2 instead.
func (*ApiService) CurrencyV2 ¶ added in v1.2.13
func (as *ApiService) CurrencyV2(currency string, chain string) (*ApiResponse, error)
CurrencyV2 returns the details of the currency.
func (*ApiService) CurrentMarkPrice ¶ added in v1.2.13
func (as *ApiService) CurrentMarkPrice(symbol string) (*ApiResponse, error)
CurrentMarkPrice returns current mark price of the input symbol
func (*ApiService) DepositAddresses ¶
func (as *ApiService) DepositAddresses(currency, chain 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) DepositAddressesV2 ¶ added in v1.2.13
func (as *ApiService) DepositAddressesV2(currency string) (*ApiResponse, error)
DepositAddressesV2 Get all deposit addresses for the currency you intend to deposit. If the returned data is empty, you may need to create a deposit address first.
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) InnerTransferV2 ¶ added in v1.2.13
func (as *ApiService) InnerTransferV2(clientOid, currency, from, to, amount string) (*ApiResponse, error)
InnerTransferV2 makes a currency transfer internally. Recommended for use on June 5, 2019. The inner transfer interface is used for transferring assets between the accounts of a user and is free of charges. For example, a user could transfer assets from their main account to their trading account on the platform.
func (*ApiService) KLines ¶ added in v1.0.5
func (as *ApiService) KLines(symbol, typo string, startAt, endAt int64) (*ApiResponse, error)
KLines returns the k lines for a symbol. Data are returned in grouped buckets based on requested type. Parameter #2 typo is the type of candlestick patterns.
func (*ApiService) LendActiveOrders ¶ added in v1.2.13
func (as *ApiService) LendActiveOrders(currency string, pagination *PaginationParam) (*ApiResponse, error)
LendActiveOrders returns the active lend orders
func (*ApiService) LendAssets ¶ added in v1.2.13
func (as *ApiService) LendAssets(currency string) (*ApiResponse, error)
LendAssets returns account lend assets
func (*ApiService) LendDoneOrders ¶ added in v1.2.13
func (as *ApiService) LendDoneOrders(currency string, pagination *PaginationParam) (*ApiResponse, error)
LendDoneOrders returns the history lend orders
func (*ApiService) LendTradeSettledRecords ¶ added in v1.2.13
func (as *ApiService) LendTradeSettledRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
LendTradeSettledRecords returns settled lend records
func (*ApiService) LendTradeUnsettledRecords ¶ added in v1.2.13
func (as *ApiService) LendTradeUnsettledRecords(currency string, pagination *PaginationParam) (*ApiResponse, error)
LendTradeUnsettledRecords returns unsettled lend records
func (*ApiService) MarginAccount ¶ added in v1.2.13
func (as *ApiService) MarginAccount() (*ApiResponse, error)
MarginAccount returns a margin account information
func (*ApiService) MarginConfig ¶ added in v1.2.13
func (as *ApiService) MarginConfig() (*ApiResponse, error)
MarginConfig returns a margin configuration
func (*ApiService) MarginMarkets ¶ added in v1.2.13
func (as *ApiService) MarginMarkets(params map[string]string) (*ApiResponse, error)
MarginMarkets returns lending market data
func (*ApiService) MarginRiskLimit ¶ added in v1.2.13
func (as *ApiService) MarginRiskLimit(marginModel string) (*ApiResponse, error)
func (*ApiService) MarginTradeLast ¶ added in v1.2.13
func (as *ApiService) MarginTradeLast(currency string) (*ApiResponse, error)
MarginTradeLast returns latest lending market trade datas
func (*ApiService) Markets ¶
func (as *ApiService) Markets() (*ApiResponse, error)
Markets returns the transaction currencies for the entire trading market.
func (*ApiService) NewWebSocketClient ¶
func (as *ApiService) NewWebSocketClient(token *WebSocketTokenModel) *WebSocketClient
NewWebSocketClient creates an instance of WebSocketClient.
func (*ApiService) NewWebSocketClientOpts ¶ added in v1.2.13
func (as *ApiService) NewWebSocketClientOpts(opts WebSocketClientOpts) *WebSocketClient
NewWebSocketClientOpts creates an instance of WebSocketClient with the parsed options.
func (*ApiService) Order ¶
func (as *ApiService) Order(orderId string) (*ApiResponse, error)
Order returns a single order by order id.
func (*ApiService) OrderByClient ¶ added in v1.2.13
func (as *ApiService) OrderByClient(clientOid string) (*ApiResponse, error)
OrderByClient returns a single order by client id.
func (*ApiService) Orders ¶
func (as *ApiService) Orders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
Orders returns a list your current orders.
func (*ApiService) Prices ¶ added in v1.0.4
func (as *ApiService) Prices(base, currencies string) (*ApiResponse, error)
Prices returns the fiat prices for currency.
func (*ApiService) RecentFills ¶ added in v1.0.1
func (as *ApiService) RecentFills() (*ApiResponse, error)
RecentFills returns the recent fills of the latest transactions within 24 hours.
func (*ApiService) RecentOrders ¶ added in v1.0.1
func (as *ApiService) RecentOrders() (*ApiResponse, error)
RecentOrders returns the recent orders of the latest transactions within 24 hours.
func (*ApiService) RepayAll ¶ added in v1.2.13
func (as *ApiService) RepayAll(params map[string]string) (*ApiResponse, error)
RepayAll repay borrow orders of one currency
func (*ApiService) RepaySingle ¶ added in v1.2.13
func (as *ApiService) RepaySingle(params map[string]string) (*ApiResponse, error)
RepaySingle repay a single borrow order
func (*ApiService) ServerTime ¶
func (as *ApiService) ServerTime() (*ApiResponse, error)
ServerTime returns the API server time.
func (*ApiService) ServiceStatus ¶ added in v1.2.13
func (as *ApiService) ServiceStatus() (*ApiResponse, error)
ServiceStatus returns the service status.
func (*ApiService) Stats24hr ¶
func (as *ApiService) Stats24hr(symbol string) (*ApiResponse, error)
Stats24hr returns 24 hr stats for the symbol. volume is in base currency units. open, high, low are in quote currency units.
func (*ApiService) StopOrder ¶ added in v1.2.13
func (as *ApiService) StopOrder(orderId string) (*ApiResponse, error)
StopOrder returns a single order by stop-order id.
func (*ApiService) StopOrderByClient ¶ added in v1.2.13
func (as *ApiService) StopOrderByClient(clientOid string, p map[string]string) (*ApiResponse, error)
StopOrderByClient returns a single stop-order by client id.
func (*ApiService) StopOrders ¶ added in v1.2.13
func (as *ApiService) StopOrders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
StopOrders returns a list your current orders.
func (*ApiService) SubAccount ¶ added in v1.2.13
func (as *ApiService) SubAccount(subUserId string) (*ApiResponse, error)
SubAccount returns the detail of a sub-account.
func (*ApiService) SubAccountUsers ¶ added in v1.2.13
func (as *ApiService) SubAccountUsers() (*ApiResponse, error)
SubAccountUsers returns a list of sub-account user.
func (*ApiService) SubAccounts ¶ added in v1.2.13
func (as *ApiService) SubAccounts() (*ApiResponse, error)
SubAccounts returns the aggregated balance of all sub-accounts of the current user.
func (*ApiService) SubTransfer ¶ added in v1.2.13
func (as *ApiService) SubTransfer(params map[string]string) (*ApiResponse, error)
SubTransfer transfers between master account and sub-account. Deprecated: This interface was discontinued on Oct 28, 2020. Please use SubTransferV2.
func (*ApiService) SubTransferV2 ¶ added in v1.2.13
func (as *ApiService) SubTransferV2(params map[string]string) (*ApiResponse, error)
SubTransferV2 transfers between master account and sub-account. Recommended for use on Oct 28, 2020.
func (*ApiService) Symbols ¶
func (as *ApiService) Symbols(market string) (*ApiResponse, error)
Symbols returns a list of available currency pairs for trading.
func (*ApiService) TickerLevel1 ¶ added in v1.0.3
func (as *ApiService) TickerLevel1(symbol string) (*ApiResponse, error)
TickerLevel1 returns the ticker include only the inside (i.e. best) bid and ask data, last price and last trade size.
func (*ApiService) Tickers ¶ added in v1.0.3
func (as *ApiService) Tickers() (*ApiResponse, error)
Tickers returns all tickers as TickersResponseModel for all trading pairs in the market (including 24h volume).
func (*ApiService) ToggleAutoLend ¶ added in v1.2.13
func (as *ApiService) ToggleAutoLend(params map[string]string) (*ApiResponse, error)
ToggleAutoLend set auto lend rules
func (*ApiService) TradeHistories ¶
func (as *ApiService) TradeHistories(symbol string) (*ApiResponse, error)
TradeHistories returns a list the latest trades for a symbol.
func (*ApiService) V1Deposits ¶ added in v1.2.13
func (as *ApiService) V1Deposits(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
V1Deposits returns a list of v1 historical deposits.
func (*ApiService) V1Orders ¶ added in v1.2.13
func (as *ApiService) V1Orders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
V1Orders returns a list of v1 historical orders.
func (*ApiService) V1Withdrawals ¶ added in v1.2.13
func (as *ApiService) V1Withdrawals(params map[string]string, pagination *PaginationParam) (*ApiResponse, error)
V1Withdrawals returns a list of v1 historical withdrawals.
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, chain 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 ¶ added in v1.2.13
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 ApiRequesterOption ¶ added in v1.2.13
func ApiRequesterOption(requester Requester) ApiServiceOption
ApiRequesterOption creates a instance of ApiServiceOption about requester.
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 BaseFeeModel ¶ added in v1.2.13
type BaseFeeModel struct { TakerFeeRate string `json:"takerFeeRate"` MakerFeeRate string `json:"makerFeeRate"` }
BaseFeeModel RESPONSES of BaseFee endpoint
type BasicRequester ¶
type BasicRequester struct {
Transport http.RoundTripper
}
A BasicRequester represents a basic implement of Requester by http.Client.
type BorrowOrderModel ¶ added in v1.2.13
type BorrowOrderModel struct { OrderId string `json:"orderId"` Currency string `json:"currency"` Size json.Number `json:"size"` Filled json.Number `json:"filled"` Status string `json:"status"` MatchList []struct { Currency string `json:"currency"` DailyIntRate json.Number `json:"dailyIntRate"` Size json.Number `json:"size"` Term json.Number `json:"term"` Timestamp json.Number `json:"timestamp"` TradeId string `json:"tradeId"` } `json:"matchList"` }
BorrowOrderModel represents a borrow order
type BorrowOutstandingRecordModel ¶ added in v1.2.13
type BorrowOutstandingRecordModel struct { Currency string `json:"currency"` TradeId string `json:"tradeId"` Liability json.Number `json:"liability"` Principal json.Number `json:"principal"` AccruedInterest json.Number `json:"accruedInterest"` CreatedAt json.Number `json:"createdAt"` MaturityTime json.Number `json:"maturityTime"` Term json.Number `json:"term"` RepaidSize json.Number `json:"repaidSize"` DailyIntRate json.Number `json:"dailyIntRate"` }
BorrowOutstandingRecordModel represents borrow outstanding record
type BorrowOutstandingRecordsModel ¶ added in v1.2.13
type BorrowOutstandingRecordsModel []*BorrowOutstandingRecordModel
BorrowOutstandingRecordsModel is a list of *BorrowOutstandingRecordModel
type BorrowRepaidRecordModel ¶ added in v1.2.13
type BorrowRepaidRecordModel struct { Currency string `json:"currency"` DailyIntRate json.Number `json:"dailyIntRate"` Interest json.Number `json:"interest"` Principal json.Number `json:"principal"` RepaidSize json.Number `json:"repaidSize"` RepayTime json.Number `json:"repayTime"` Term json.Number `json:"term"` TradeId string `json:"tradeId"` }
BorrowRepaidRecordModel represents a repaid borrow record
type BorrowRepaidRecordsModel ¶ added in v1.2.13
type BorrowRepaidRecordsModel []*BorrowRepaidRecordModel
BorrowRepaidRecordsModel is a list of *BorrowRepaidRecordModel
type CancelOrderByClientResultModel ¶ added in v1.2.13
type CancelOrderByClientResultModel struct { CancelledOrderId string `json:"cancelledOrderId"` ClientOid string `json:"clientOid"` }
A CancelOrderByClientResultModel represents the result of CancelOrderByClient().
type CancelOrderResultModel ¶
type CancelOrderResultModel struct {
CancelledOrderIds []string `json:"cancelledOrderIds"`
}
A CancelOrderResultModel represents the result of CancelOrder().
type CancelStopOrderByClientModel ¶ added in v1.2.13
type CancelStopOrderByClientModel struct { CancelledOrderId string `json:"cancelledOrderId"` ClientOid string `json:"clientOid"` }
CancelStopOrderByClientModel returns Model of CancelStopOrderByClient API
type CancelWithdrawalResultModel ¶
type CancelWithdrawalResultModel struct {
CancelledWithdrawIds []string `json:"cancelledWithdrawIds"`
}
CancelWithdrawalResultModel represents the result of CancelWithdrawal().
type ChainsModel ¶ added in v1.2.13
type ChainsModel struct { ChainName string `json:"chainName"` WithdrawalMinSize string `json:"withdrawalMinSize"` WithdrawalMinFee string `json:"withdrawalMinFee"` IsWithdrawEnabled bool `json:"isWithdrawEnabled"` IsDepositEnabled bool `json:"isDepositEnabled"` Confirms int64 `json:"confirms"` ContractAddress string `json:"contractAddress"` }
ChainsModel Chains Model
type CreateAccountModel ¶ added in v1.2.13
type CreateAccountModel struct {
Id string `json:"id"`
}
CreateAccountModel represents The account id returned from creating an account
type CreateBorrowOrderResultModel ¶ added in v1.2.13
type CreateBorrowOrderResultModel struct { OrderId string `json:"orderId"` Currency string `json:"currency"` }
CreateBorrowOrderResultModel represents the result of create a borrow order
type CreateLendOrderResultModel ¶ added in v1.2.13
type CreateLendOrderResultModel struct {
OrderId string `json:"orderId"`
}
CreateLendOrderResultModel the result of create a lend order
type CreateMultiOrderResultModel ¶ added in v1.2.13
type CreateMultiOrderResultModel struct {
Data OrdersModel `json:"data"`
}
A CreateMultiOrderResultModel represents the result of CreateMultiOrder().
type CreateOrderModel ¶ added in v1.2.13
type CreateOrderModel struct { // BASE PARAMETERS ClientOid string `json:"clientOid"` Side string `json:"side"` Symbol string `json:"symbol,omitempty"` Type string `json:"type,omitempty"` Remark string `json:"remark,omitempty"` Stop string `json:"stop,omitempty"` StopPrice string `json:"stopPrice,omitempty"` STP string `json:"stp,omitempty"` TradeType string `json:"tradeType,omitempty"` // LIMIT ORDER PARAMETERS Price string `json:"price,omitempty"` Size string `json:"size,omitempty"` TimeInForce string `json:"timeInForce,omitempty"` CancelAfter int64 `json:"cancelAfter,omitempty"` PostOnly bool `json:"postOnly,omitempty"` Hidden bool `json:"hidden,omitempty"` IceBerg bool `json:"iceberg,omitempty"` VisibleSize string `json:"visibleSize,omitempty"` // MARKET ORDER PARAMETERS // Size string `json:"size"` Funds string `json:"funds,omitempty"` // MARGIN ORDER PARAMETERS MarginMode string `json:"marginMode,omitempty"` AutoBorrow bool `json:"autoBorrow,omitempty"` }
A CreateOrderModel is the input parameter of CreateOrder().
type CreateOrderResultModel ¶
type CreateOrderResultModel struct {
OrderId string `json:"orderId"`
}
A CreateOrderResultModel represents the result of CreateOrder().
type CurrenciesModel ¶
type CurrenciesModel []*CurrencyModel
A CurrenciesModel is the set of *CurrencyModel.
type CurrencyModel ¶
type CurrencyModel struct { Name string `json:"name"` Currency string `json:"currency"` FullName string `json:"fullName"` Precision uint8 `json:"precision"` Confirms int64 `json:"confirms"` ContractAddress string `json:"contractAddress"` WithdrawalMinSize string `json:"withdrawalMinSize"` WithdrawalMinFee string `json:"withdrawalMinFee"` IsWithdrawEnabled bool `json:"isWithdrawEnabled"` IsDepositEnabled bool `json:"isDepositEnabled"` IsMarginEnabled bool `json:"isMarginEnabled"` IsDebitEnabled bool `json:"isDebitEnabled"` }
A CurrencyModel represents a model of known currency.
type CurrencyV2Model ¶ added in v1.2.13
type CurrencyV2Model struct { Name string `json:"name"` Currency string `json:"currency"` FullName string `json:"fullName"` Precision uint8 `json:"precision"` Confirms int64 `json:"confirms"` ContractAddress string `json:"contractAddress"` IsMarginEnabled bool `json:"isMarginEnabled"` IsDebitEnabled bool `json:"isDebitEnabled"` Chains []*ChainsModel `json:"chains"` }
CurrencyV2Model CurrencyV2 Model
type DepositAddressModel ¶
type DepositAddressModel struct { Address string `json:"address"` Memo string `json:"memo"` Chain string `json:"chain"` }
A DepositAddressModel represents a deposit address of currency for deposit.
type DepositAddressesModel ¶
type DepositAddressesModel DepositAddressModel
A DepositAddressesModel is the set of *DepositAddressModel.
type DepositAddressesV2Model ¶ added in v1.2.13
type DepositAddressesV2Model []*depositAddressV2Model
type DepositModel ¶
type DepositModel struct { Address string `json:"address"` Memo string `json:"memo"` Amount string `json:"amount"` Fee string `json:"fee"` Currency string `json:"currency"` IsInner bool `json:"isInner"` WalletTxId string `json:"walletTxId"` Status string `json:"status"` Remark string `json:"remark"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
A DepositModel represents a deposit record.
type DepositsModel ¶
type DepositsModel []*DepositModel
A DepositsModel is the set of *DepositModel.
type FillModel ¶
type FillModel 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 string `json:"price"` Size string `json:"size"` Funds string `json:"funds"` Fee string `json:"fee"` FeeRate string `json:"feeRate"` FeeCurrency string `json:"feeCurrency"` Stop string `json:"stop"` Type string `json:"type"` CreatedAt int64 `json:"createdAt"` TradeType string `json:"tradeType"` }
A FillModel represents the structure of fill.
type FullOrderBookModel ¶
type FullOrderBookModel struct { Sequence string `json:"sequence"` Time int64 `json:"time"` Bids [][]string `json:"bids"` Asks [][]string `json:"asks"` }
A FullOrderBookModel represents a list of open orders for a symbol, with full depth.
type FullOrderBookV2Model ¶ added in v1.2.13
type FullOrderBookV2Model struct { Sequence int64 `json:"sequence"` Time int64 `json:"time"` Bids [][]interface{} `json:"bids"` Asks [][]interface{} `json:"asks"` }
A FullOrderBookV2Model represents a list of open orders for a symbol, with full depth.
type InnerTransferResultModel ¶ added in v1.2.13
type InnerTransferResultModel struct {
OrderId string `json:"orderId"`
}
An InnerTransferResultModel represents the result of a inner-transfer operation.
type KLineModel ¶ added in v1.0.5
type KLineModel []string
KLineModel represents the k lines for a symbol. Rates are returned in grouped buckets based on requested type.
type KLinesModel ¶ added in v1.0.5
type KLinesModel []*KLineModel
A KLinesModel is the set of *KLineModel.
type KcSigner ¶
type KcSigner struct { Sha256Signer // contains filtered or unexported fields }
KcSigner is the implement of Signer for KuCoin.
func NewKcSigner ¶
NewKcSigner creates a instance of KcSigner.
func NewKcSignerV2 ¶ added in v1.2.13
NewKcSignerV2 creates a instance of KcSigner.
type LendActiveOrderModel ¶ added in v1.2.13
type LendActiveOrderModel struct {
LendOrderBaseModel
}
LendActiveOrderModel represents a active lend order
type LendActiveOrdersModel ¶ added in v1.2.13
type LendActiveOrdersModel []*LendActiveOrderModel
LendActiveOrdersModel is a list of *LendActiveOrderModel
type LendAssetModel ¶ added in v1.2.13
type LendAssetModel struct { Currency string `json:"currency"` Outstanding json.Number `json:"outstanding"` FilledSize json.Number `json:"filledSize"` AccruedInterest json.Number `json:"accruedInterest"` RealizedProfit json.Number `json:"realizedProfit"` IsAutoLend bool `json:"isAutoLend"` }
LendAssetModel represents account lend asset
type LendAssetsModel ¶ added in v1.2.13
type LendAssetsModel []*LendAssetModel
LendAssetsModel is a list of *LendAssetModel
type LendDoneOrderModel ¶ added in v1.2.13
type LendDoneOrderModel struct { LendOrderBaseModel Status string `json:"status"` }
LendDoneOrderModel represents a history lend order
type LendDoneOrdersModel ¶ added in v1.2.13
type LendDoneOrdersModel []*LendDoneOrderModel
LendDoneOrdersModel is a list of *LendDoneOrderModel
type LendOrderBaseModel ¶ added in v1.2.13
type LendOrderBaseModel struct { OrderId string `json:"orderId"` Currency string `json:"currency"` Size json.Number `json:"size"` FilledSize json.Number `json:"filledSize"` DailyIntRate json.Number `json:"dailyIntRate"` Term json.Number `json:"term"` CreatedAt json.Number `json:"createdAt"` }
LendOrderBaseModel represents Base model of lend order
type LendTradeSettledRecordModel ¶ added in v1.2.13
type LendTradeSettledRecordModel struct { TradeId string `json:"tradeId"` Currency string `json:"currency"` Size json.Number `json:"size"` Interest json.Number `json:"interest"` Repaid json.Number `json:"repaid"` DailyIntRate json.Number `json:"dailyIntRate"` Term json.Number `json:"term"` SettledAt json.Number `json:"settledAt"` Note string `json:"note"` }
LendTradeSettledRecordModel represents a settled lend record
type LendTradeSettledRecordsModel ¶ added in v1.2.13
type LendTradeSettledRecordsModel []*LendTradeSettledRecordModel
LendTradeSettledRecordsModel is a list of *LendTradeSettledRecordModel
type LendTradeUnsettledRecordModel ¶ added in v1.2.13
type LendTradeUnsettledRecordModel struct { TradeId string `json:"tradeId"` Currency string `json:"currency"` Size json.Number `json:"size"` AccruedInterest json.Number `json:"accruedInterest"` Repaid json.Number `json:"repaid"` DailyIntRate json.Number `json:"dailyIntRate"` Term json.Number `json:"term"` MaturityTime json.Number `json:"maturityTime"` }
LendTradeUnsettledRecordModel represents a unsettled lend record
type LendTradeUnsettledRecordsModel ¶ added in v1.2.13
type LendTradeUnsettledRecordsModel []*LendTradeUnsettledRecordModel
LendTradeUnsettledRecordsModel is a list of *LendTradeUnsettledRecordModel
type MarginAccountModel ¶ added in v1.2.13
type MarginAccountModel struct { Accounts []struct { AvailableBalance json.Number `json:"availableBalance"` Currency string `json:"currency"` HoldBalance json.Number `json:"holdBalance"` Liability json.Number `json:"liability"` MaxBorrowSize json.Number `json:"maxBorrowSize"` TotalBalance json.Number `json:"totalBalance"` } `json:"accounts"` DebtRatio json.Number `json:"debtRatio"` }
MarginAccountModel represents a margin account information
type MarginConfigModel ¶ added in v1.2.13
type MarginConfigModel struct { CurrencyList []string `json:"currencyList"` WarningDebtRatio json.Number `json:"warningDebtRatio"` LiqDebtRatio json.Number `json:"liqDebtRatio"` MaxLeverage json.Number `json:"maxLeverage"` }
MarginConfigModel represents a margin configuration
type MarginMarketModel ¶ added in v1.2.13
type MarginMarketModel struct { DailyIntRate json.Number `json:"dailyIntRate"` Term json.Number `json:"term"` Size json.Number `json:"size"` }
MarginMarketModel represents lending market data
type MarginMarketsModel ¶ added in v1.2.13
type MarginMarketsModel []*MarginMarketModel
MarginMarketsModel is a list of *MarginMarketModel
type MarginRiskLimitItemModel ¶ added in v1.2.13
type MarginRiskLimitItemModel struct { Currency string `json:"currency"` BorrowMaxAmount string `json:"borrowMaxAmount"` BuyMaxAmount string `json:"buyMaxAmount"` Precision json.Number `json:"precision"` }
MarginRiskLimitItemModel is item of *MarginRiskLimitModel
type MarginRiskLimitModel ¶ added in v1.2.13
type MarginRiskLimitModel []*MarginRiskLimitItemModel
MarginRiskLimitModel is a list of *MarginRiskLimitModel
type MarginTradeModel ¶ added in v1.2.13
type MarginTradeModel struct { TradeId string `json:"tradeId"` Currency string `json:"currency"` Size json.Number `json:"size"` DailyIntRate json.Number `json:"dailyIntRate"` Term json.Number `json:"term"` Timestamp json.Number `json:"timestamp"` }
MarginTradeModel represents lending market trade data
type MarginTradesModel ¶ added in v1.2.13
type MarginTradesModel []*MarginTradeModel
MarginTradesModel is a list of *MarginTradeModel
type MarkPriceModel ¶ added in v1.2.13
type MarkPriceModel struct { Symbol string `json:"symbol"` Granularity json.Number `json:"granularity"` TimePoint json.Number `json:"timePoint"` Value json.Number `json:"value"` }
MarkPriceModel represents mark price of a symbol
type MarketsModel ¶ added in v1.2.13
type MarketsModel []string
MarketsModel returns Model of Markets API.
type OrderModel ¶
type OrderModel struct { Id string `json:"id"` Symbol string `json:"symbol"` OpType string `json:"opType"` Type string `json:"type"` Side string `json:"side"` Price string `json:"price"` Size string `json:"size"` Funds string `json:"funds"` DealFunds string `json:"dealFunds"` DealSize string `json:"dealSize"` Fee string `json:"fee"` FeeCurrency string `json:"feeCurrency"` Stp string `json:"stp"` Stop string `json:"stop"` 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"` CancelAfter int64 `json:"cancelAfter"` Channel string `json:"channel"` ClientOid string `json:"clientOid"` Remark string `json:"remark"` Tags string `json:"tags"` IsActive bool `json:"isActive"` CancelExist bool `json:"cancelExist"` CreatedAt int64 `json:"createdAt"` TradeType string `json:"tradeType"` }
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 PartOrderBookModel ¶
type PartOrderBookModel struct { Sequence string `json:"sequence"` Time int64 `json:"time"` Bids [][]string `json:"bids"` Asks [][]string `json:"asks"` }
A PartOrderBookModel represents a list of open orders for a symbol, a part of Order Book within 100 depth for each side(ask or bid).
type PricesModel ¶ added in v1.2.13
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 NewResponse ¶ added in v1.2.13
NewResponse Creates a new Response
func (*Response) ReadJsonBody ¶
ReadJsonBody read the response data as JSON into v.
type ServerTimeModel ¶ added in v1.2.13
type ServerTimeModel int64
type ServiceStatusModel ¶ added in v1.2.13
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 Stats24hrModel ¶
type Stats24hrModel struct { Time int64 `json:"time"` Symbol string `json:"symbol"` Buy string `json:"buy"` Sell string `json:"sell"` ChangeRate string `json:"changeRate"` ChangePrice string `json:"changePrice"` High string `json:"high"` Low string `json:"low"` Vol string `json:"vol"` VolValue string `json:"volValue"` Last string `json:"last"` AveragePrice string `json:"averagePrice"` TakerFeeRate string `json:"takerFeeRate"` MakerFeeRate string `json:"makerFeeRate"` TakerCoefficient string `json:"takerCoefficient"` MakerCoefficient string `json:"makerCoefficient"` }
A Stats24hrModel represents 24 hr stats for the symbol. Volume is in base currency units. Open, high, low are in quote currency units.
type StopOrderListModel ¶ added in v1.2.13
type StopOrderListModel []*StopOrderModel
StopOrderListModel StopOrderByClient model
type StopOrderModel ¶ added in v1.2.13
type StopOrderModel struct { Id string `json:"id"` Symbol string `json:"symbol"` UserId string `json:"userId"` Status string `json:"status"` Type string `json:"type"` Side string `json:"side"` Price string `json:"price"` Size string `json:"size"` Funds string `json:"funds"` Stp string `json:"stp"` TimeInForce string `json:"timeInForce"` CancelAfter int64 `json:"cancelAfter"` PostOnly bool `json:"postOnly"` Hidden bool `json:"hidden"` IceBerg bool `json:"iceberg"` VisibleSize string `json:"visibleSize"` Channel string `json:"channel"` ClientOid string `json:"clientOid"` Remark string `json:"remark"` Tags string `json:"tags"` OrderTime int64 `json:"orderTime"` 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 int64 `json:"createdAt"` Stop string `json:"stop"` StopTriggerTime string `json:"stopTriggerTime"` StopPrice string `json:"stopPrice"` }
StopOrderModel RESPONSES of StopOrder
type SubAccountModel ¶ added in v1.2.13
type SubAccountModel struct { SubUserId string `json:"subUserId"` SubName string `json:"subName"` MainAccounts []struct { Currency string `json:"currency"` Balance string `json:"balance"` Available string `json:"available"` Holds string `json:"holds"` BaseCurrency string `json:"baseCurrency"` BaseCurrencyPrice string `json:"baseCurrencyPrice"` BaseAmount string `json:"baseAmount"` } `json:"mainAccounts"` TradeAccounts []struct { Currency string `json:"currency"` Balance string `json:"balance"` Available string `json:"available"` Holds string `json:"holds"` BaseCurrency string `json:"baseCurrency"` BaseCurrencyPrice string `json:"baseCurrencyPrice"` BaseAmount string `json:"baseAmount"` } `json:"tradeAccounts"` MarginAccounts []struct { Currency string `json:"currency"` Balance string `json:"balance"` Available string `json:"available"` Holds string `json:"holds"` BaseCurrency string `json:"baseCurrency"` BaseCurrencyPrice string `json:"baseCurrencyPrice"` BaseAmount string `json:"baseAmount"` } `json:"marginAccounts"` }
A SubAccountModel represents the balance of a sub-account user.
type SubAccountUserModel ¶ added in v1.2.13
type SubAccountUserModel struct { UserId string `json:"userId"` SubName string `json:"subName"` Remarks string `json:"remarks"` Type int `json:"type"` }
A SubAccountUserModel represents a sub-account user.
type SubAccountUsersModel ¶ added in v1.2.13
type SubAccountUsersModel []*SubAccountUserModel
A SubAccountUsersModel is the set of *SubAccountUserModel.
type SubAccountsModel ¶ added in v1.2.13
type SubAccountsModel []*SubAccountModel
A SubAccountsModel is the set of *SubAccountModel.
type SubTransferResultModel ¶ added in v1.2.13
type SubTransferResultModel InnerTransferResultModel
A SubTransferResultModel represents the result of a sub-transfer operation.
type SymbolModel ¶
type SymbolModel struct { Symbol string `json:"symbol"` Name string `json:"name"` BaseCurrency string `json:"baseCurrency"` QuoteCurrency string `json:"quoteCurrency"` Market string `json:"market"` BaseMinSize string `json:"baseMinSize"` QuoteMinSize string `json:"quoteMinSize"` BaseMaxSize string `json:"baseMaxSize"` QuoteMaxSize string `json:"quoteMaxSize"` BaseIncrement string `json:"baseIncrement"` QuoteIncrement string `json:"quoteIncrement"` PriceIncrement string `json:"priceIncrement"` FeeCurrency string `json:"feeCurrency"` EnableTrading bool `json:"enableTrading"` IsMarginEnabled bool `json:"isMarginEnabled"` PriceLimitRate string `json:"priceLimitRate"` }
A SymbolModel represents an available currency pairs for trading.
type TickerLevel1Model ¶ added in v1.0.3
type TickerLevel1Model struct { Sequence string `json:"sequence"` Price string `json:"price"` Size string `json:"size"` BestBid string `json:"bestBid"` BestBidSize string `json:"bestBidSize"` BestAsk string `json:"bestAsk"` BestAskSize string `json:"bestAskSize"` Time int64 `json:"time"` }
A TickerLevel1Model represents ticker include only the inside (i.e. best) bid and ask data, last price and last trade size.
type TickerModel ¶
type TickerModel struct { Symbol string `json:"symbol"` SymbolName string `json:"symbolName"` Buy string `json:"buy"` Sell string `json:"sell"` ChangeRate string `json:"changeRate"` ChangePrice string `json:"changePrice"` High string `json:"high"` Low string `json:"low"` Vol string `json:"vol"` VolValue string `json:"volValue"` Last string `json:"last"` AveragePrice string `json:"averagePrice"` TakerFeeRate string `json:"takerFeeRate"` MakerFeeRate string `json:"makerFeeRate"` TakerCoefficient string `json:"takerCoefficient"` MakerCoefficient string `json:"makerCoefficient"` }
A TickerModel represents a market ticker for all trading pairs in the market (including 24h volume).
type TickersModel ¶ added in v1.0.3
type TickersModel []*TickerModel
A TickersModel is the set of *MarketTickerModel.
type TickersResponseModel ¶ added in v1.0.3
type TickersResponseModel struct { Time int64 `json:"time"` Tickers TickersModel `json:"ticker"` }
TickersResponseModel represents the response model of MarketTickers().
type TradeFeesResultModel ¶ added in v1.2.13
type TradeHistoriesModel ¶
type TradeHistoriesModel []*TradeHistoryModel
A TradeHistoriesModel is the set of *TradeHistoryModel.
type TradeHistoryModel ¶
type TradeHistoryModel struct { Sequence string `json:"sequence"` Price string `json:"price"` Size string `json:"size"` Side string `json:"side"` Time int64 `json:"time"` }
A TradeHistoryModel represents a the latest trades for a symbol.
type V1DepositModel ¶ added in v1.2.13
type V1DepositModel struct { Amount string `json:"amount"` Currency string `json:"currency"` IsInner bool `json:"isInner"` WalletTxId string `json:"walletTxId"` Status string `json:"status"` CreateAt int64 `json:"createAt"` }
A V1DepositModel represents a v1 deposit record.
type V1DepositsModel ¶ added in v1.2.13
type V1DepositsModel []*V1DepositModel
A V1DepositsModel is the set of *V1DepositModel.
type V1OrderModel ¶ added in v1.2.13
type V1OrderModel struct { Symbol string `json:"symbol"` DealPrice string `json:"dealPrice"` DealValue string `json:"dealValue"` Amount string `json:"amount"` Fee string `json:"fee"` Side string `json:"side"` CreatedAt int64 `json:"createdAt"` }
A V1OrderModel represents a v1 order.
type V1OrdersModel ¶ added in v1.2.13
type V1OrdersModel []*V1OrderModel
A V1OrdersModel is the set of *V1OrderModel.
type V1WithdrawalModel ¶ added in v1.2.13
type V1WithdrawalModel struct { Address string `json:"address"` Amount string `json:"amount"` Currency string `json:"currency"` IsInner bool `json:"isInner"` WalletTxId string `json:"walletTxId"` Status string `json:"status"` CreateAt int64 `json:"createAt"` }
A V1WithdrawalModel represents a v1 historical withdrawal.
type V1WithdrawalsModel ¶ added in v1.2.13
type V1WithdrawalsModel []*V1WithdrawalModel
A V1WithdrawalsModel is the set of *V1WithdrawalModel.
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 ¶ added in v1.0.6
func (wc *WebSocketClient) Unsubscribe(channels ...*WebSocketUnsubscribeMessage) error
Unsubscribe unsubscribes the specified channel.
type WebSocketClientOpts ¶ added in v1.2.13
type WebSocketClientOpts struct { Token *WebSocketTokenModel TLSSkipVerify bool Timeout time.Duration }
WebSocketClientOpts defines the options for the client during the websocket connection.
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:"accept_user_message"` }
A WebSocketTokenModel contains a token and some servers for WebSocket feed.
type WebSocketUnsubscribeMessage ¶ added in v1.0.6
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 { Id string `json:"id"` Address string `json:"address"` Memo string `json:"memo"` Currency string `json:"currency"` Amount string `json:"amount"` Fee string `json:"fee"` WalletTxId string `json:"walletTxId"` IsInner bool `json:"isInner"` Status string `json:"status"` Remark string `json:"remark"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
A WithdrawalModel represents a withdrawal.
type WithdrawalQuotasModel ¶
type WithdrawalQuotasModel struct { Currency string `json:"currency"` AvailableAmount string `json:"availableAmount"` RemainAmount string `json:"remainAmount"` WithdrawMinSize string `json:"withdrawMinSize"` LimitBTCAmount string `json:"limitBTCAmount"` InnerWithdrawMinFee string `json:"innerWithdrawMinFee"` UsedBTCAmount string `json:"usedBTCAmount"` IsWithdrawEnabled bool `json:"isWithdrawEnabled"` WithdrawMinFee string `json:"withdrawMinFee"` Precision uint8 `json:"precision"` Chain string `json:"chain"` }
A WithdrawalQuotasModel represents the quotas for a currency.
type WithdrawalsModel ¶
type WithdrawalsModel []*WithdrawalModel
A WithdrawalsModel is the set of *WithdrawalModel.