Documentation ¶
Overview ¶
Package kucoin is an implementation of the Kucoin API in Golang.
Index ¶
- Variables
- type AccountHistory
- type ActiveMapOrder
- type ActiveOrder
- type Coin
- type CoinBalance
- type CoinDepositAddress
- type CoinPair
- type Kucoin
- func (k *Kucoin) AccountHistory(coin, side, status string, page int) (accountHistory AccountHistory, err error)
- func (k *Kucoin) CancelAllOrders(symbol, side string) error
- func (k *Kucoin) CancelOrder(symbol, orderOid, side string) error
- func (k *Kucoin) CancelWithdrawal(coin, txOid string) (withdrawal Withdrawal, err error)
- func (k *Kucoin) CreateOrder(symbol, side string, price, amount float64) (orderOid string, err error)
- func (k *Kucoin) CreateOrderByString(symbol, side, price, amount string) (orderOid string, err error)
- func (k *Kucoin) CreateWithdrawalApply(coin, address string, amount float64) (withdrawalApply Withdrawal, err error)
- func (k *Kucoin) GetCoin(c string) (coin Coin, err error)
- func (k *Kucoin) GetCoinBalance(coin string) (coinBalance CoinBalance, err error)
- func (k *Kucoin) GetCoinDepositAddress(coin string) (coinDepositAddress CoinDepositAddress, err error)
- func (k *Kucoin) GetCoins() (coins []Coin, err error)
- func (k *Kucoin) GetCoinsPairs() (coinPair []CoinPair, err error)
- func (k *Kucoin) GetOpenMarkets() (markets []string, err error)
- func (k *Kucoin) GetSymbol(s string) (symbol Symbol, err error)
- func (k *Kucoin) GetSymbols() (symbols []Symbol, err error)
- func (k *Kucoin) GetUserInfo() (userInfo UserInfo, err error)
- func (k *Kucoin) GetUserSymbols(market, symbol, filter string) (symbols []Symbol, err error)
- func (k *Kucoin) ListActiveMapOrders(symbol, side string) (activeMapOrders ActiveMapOrder, err error)
- func (k *Kucoin) ListActiveOrders(symbol, side string) (activeOrders ActiveOrder, err error)
- func (k *Kucoin) ListMergedDealtOrders(symbol, side string, limit, page int, since, before int64) (mergedDealtOrders MergedDealtOrder, err error)
- func (k *Kucoin) ListSpecificDealtOrders(symbol, side string, limit, page int) (specificDealtOrders SpecificDealtOrder, err error)
- func (k *Kucoin) OrderDetails(symbol, side, orderOid string, limit, page int) (orderDetails OrderDetails, err error)
- func (k *Kucoin) OrdersBook(symbol string, group, limit int, direction string) (ordersBook OrdersBook, err error)
- func (k *Kucoin) SetDebug(enable bool)
- type MergedDealtOrder
- type Order
- type OrderDetails
- type OrdersBook
- type SpecificDealtOrder
- type Symbol
- type UserInfo
- type Withdrawal
Constants ¶
This section is empty.
Variables ¶
var ( ErrSymbolRequired = errors.New("Symbol is required") ErrAllParamsRequired = errors.New("All parameters are required") ErrNonExistingSymbol = errors.New("Entered symbol doesn't exist in Kucoin") ErrNonExistingMarket = errors.New("Entered market doesn't exist in Kucoin") )
Custom errors used when an input is required
Functions ¶
This section is empty.
Types ¶
type AccountHistory ¶
type AccountHistory struct { Datas []struct { Fee float64 `json:"fee"` Oid string `json:"oid"` Type string `json:"type"` Amount float64 `json:"amount"` Remark string `json:"remark"` Status string `json:"status"` Address string `json:"address"` Context string `json:"context"` UserOid string `json:"userOid"` CoinType string `json:"coinType"` CreatedAt int64 `json:"createdAt"` DeletedAt interface{} `json:"deletedAt"` UpdatedAt int64 `json:"updatedAt"` OuterWalletTxid interface{} `json:"outerWalletTxid"` } `json:"datas"` Total int `json:"total"` Limit int `json:"limit"` PageNos int `json:"pageNos"` CurrPageNo int `json:"currPageNo"` CoinType string `json:"coinType"` Type interface{} `json:"type"` UserOid string `json:"userOid"` Status interface{} `json:"status"` FirstPage bool `json:"firstPage"` LastPage bool `json:"lastPage"` StartRow int `json:"startRow"` }
AccountHistory struct represents kucoin data model.
type ActiveMapOrder ¶
type ActiveMapOrder struct { SELL []struct { Oid string `json:"oid"` Type string `json:"type"` UserOid interface{} `json:"userOid"` CoinType string `json:"coinType"` CoinTypePair string `json:"coinTypePair"` Direction string `json:"direction"` Price float64 `json:"price"` DealAmount float64 `json:"dealAmount"` PendingAmount float64 `json:"pendingAmount"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } `json:"SELL"` BUY []struct { Oid string `json:"oid"` Type string `json:"type"` UserOid interface{} `json:"userOid"` CoinType string `json:"coinType"` CoinTypePair string `json:"coinTypePair"` Direction string `json:"direction"` Price float64 `json:"price"` DealAmount float64 `json:"dealAmount"` PendingAmount float64 `json:"pendingAmount"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } `json:"BUY"` }
ActiveMapOrder struct represents kucoin data model.
type ActiveOrder ¶
type ActiveOrder struct { SELL [][]interface{} `json:"SELL"` BUY [][]interface{} `json:"BUY"` }
ActiveOrder struct represents kucoin data model.
type Coin ¶
type Coin struct { WithdrawMinFee float64 `json:"withdrawMinFee"` WithdrawMinAmount float64 `json:"withdrawMinAmount"` WithdrawFeeRate float64 `json:"withdrawFeeRate"` ConfirmationCount int `json:"confirmationCount"` WithdrawRemark string `json:"withdrawRemark"` InfoURL interface{} `json:"infoUrl"` Name string `json:"name"` TradePrecision int `json:"tradePrecision"` DepositRemark interface{} `json:"depositRemark"` EnableWithdraw bool `json:"enableWithdraw"` EnableDeposit bool `json:"enableDeposit"` Coin string `json:"coin"` }
Coin struct represents kucoin data model.
type CoinBalance ¶
type CoinBalance struct { CoinType string `json:"coinType"` Balance float64 `json:"balance"` FreezeBalance float64 `json:"freezeBalance"` }
CoinBalance struct represents kucoin data model.
type CoinDepositAddress ¶
type CoinDepositAddress struct { Oid string `json:"oid"` Address string `json:"address"` Context interface{} `json:"context"` UserOid string `json:"userOid"` CoinType string `json:"coinType"` CreatedAt int64 `json:"createdAt"` DeletedAt interface{} `json:"deletedAt"` UpdatedAt int64 `json:"updatedAt"` LastReceivedAt int64 `json:"lastReceivedAt"` }
CoinDepositAddress struct represents kucoin data model.
type CoinPair ¶
type CoinPair struct {
CoinPair string `json:"coinPair"`
}
CoinPair struct represents coin-pair present in kucoin.
type Kucoin ¶
type Kucoin struct {
// contains filtered or unexported fields
}
Kucoin represent a Kucoin client.
func NewCustomClient ¶
NewCustomClient returns an instantiated Kucoin struct with custom http client.
func NewCustomTimeout ¶
NewCustomTimeout returns an instantiated Kucoin struct with custom timeout.
func (*Kucoin) AccountHistory ¶
func (k *Kucoin) AccountHistory(coin, side, status string, page int) (accountHistory AccountHistory, err error)
AccountHistory is used to get the information about list deposit & withdrawal at Kucoin along with other meta data. Coin, Side (type in Kucoin docs.) and Status are required parameters. Limit and page may be zeros. Example: - Coin (required) = KCS - Side (required) = DEPOSIT | WITHDRAW - Status (required) = FINISHED | CANCEL | PENDING - Page
func (*Kucoin) CancelAllOrders ¶
CancelAllOrders is used to cancel execution of all orders at Kucoin along with other meta data. Example: - Symbol (required) = KCS-BTC - Side = BUY | SELL
func (*Kucoin) CancelOrder ¶
CancelOrder is used to cancel execution of current order at Kucoin along with other meta data. Example: - Symbol (required) = KCS-BTC - OrderId (required) - Side (required) = BUY | SELL
func (*Kucoin) CancelWithdrawal ¶
func (k *Kucoin) CancelWithdrawal(coin, txOid string) (withdrawal Withdrawal, err error)
CancelWithdrawal used to cancel withdrawal for specific coin at Kucoin along with other meta data. Example: - Coin (required) = KCS - TxOid (required) Result: - Nothing.
func (*Kucoin) CreateOrder ¶
func (k *Kucoin) CreateOrder(symbol, side string, price, amount float64) (orderOid string, err error)
CreateOrder is used to create order at Kucoin along with other meta data. Example: - Symbol (required) = KCS-BTC - Side (required) = BUY | SELL - Price (required) = 0.0001700 - Amount (required) = 1.5
func (*Kucoin) CreateOrderByString ¶
func (k *Kucoin) CreateOrderByString(symbol, side, price, amount string) (orderOid string, err error)
CreateOrderByString is used to create order at Kucoin along with other meta data. This ByString version is fix precise problem. Example: - Symbol (required) = KCS-BTC - Side (required) = BUY | SELL - Price (required) = 0.0001700 - Amount (required) = 1.5
func (*Kucoin) CreateWithdrawalApply ¶
func (k *Kucoin) CreateWithdrawalApply(coin, address string, amount float64) (withdrawalApply Withdrawal, err error)
CreateWithdrawalApply is used to create withdrawal for specific coin at Kucoin along with other meta data. Example: - Coin (required) = KCS - Address (required) = - Amount (required) = 0.50 Result: - Nothing.
func (*Kucoin) GetCoin ¶
GetCoin is used to get the open and available trading coin at Kucoin along with other meta data. Example: - Coin (required) = BTC
func (*Kucoin) GetCoinBalance ¶
func (k *Kucoin) GetCoinBalance(coin string) (coinBalance CoinBalance, err error)
GetCoinBalance is used to get the balance at chosen coin at Kucoin along with other meta data. Example: - Coin (required) = BTC
func (*Kucoin) GetCoinDepositAddress ¶
func (k *Kucoin) GetCoinDepositAddress(coin string) (coinDepositAddress CoinDepositAddress, err error)
GetCoinDepositAddress is used to get the address at chosen coin at Kucoin along with other meta data.
func (*Kucoin) GetCoins ¶
GetCoins is used to get all open and available trading coins at Kucoin along with other meta data.
func (*Kucoin) GetCoinsPairs ¶
GetCoinsPairs is used to get the all available trading markets at Kucoin.
func (*Kucoin) GetOpenMarkets ¶
GetOpenMarkets is used to get all open markets.
func (*Kucoin) GetSymbol ¶
GetSymbol is used to get the open and available trading market at Kucoin along with other meta data. Trading symbol e.g. KCS-BTC. If not specified then you will get data of all symbols.
func (*Kucoin) GetSymbols ¶
GetSymbols is used to get the all open and available trading markets at Kucoin along with other meta data.
func (*Kucoin) GetUserInfo ¶
GetUserInfo is used to get the user information at Kucoin along with other meta data.
func (*Kucoin) GetUserSymbols ¶
GetUserSymbols is used to get the all open and available trading markets at Kucoin along with other meta data. The user should be logged to call this method. Example: - Market = BTC - Symbol = KCS-BTC - Filter = FAVOURITE | STICK
func (*Kucoin) ListActiveMapOrders ¶
func (k *Kucoin) ListActiveMapOrders(symbol, side string) (activeMapOrders ActiveMapOrder, err error)
ListActiveMapOrders is used to get the information about active orders in user-friendly view at Kucoin along with other meta data. Example: - Symbol (required) = KCS-BTC - Type = BUY | SELL
func (*Kucoin) ListActiveOrders ¶
func (k *Kucoin) ListActiveOrders(symbol, side string) (activeOrders ActiveOrder, err error)
ListActiveOrders is used to get the information about active orders in array mode at Kucoin along with other meta data. Example: - Symbol (required) = KCS-BTC - Type = BUY | SELL
func (*Kucoin) ListMergedDealtOrders ¶
func (k *Kucoin) ListMergedDealtOrders(symbol, side string, limit, page int, since, before int64) (mergedDealtOrders MergedDealtOrder, err error)
ListMergedDealtOrders is used to get the information about dealt orders for all symbols at Kucoin along with other meta data. All parameters are optional. Timestamp must be in milliseconds from Unix epoch. Example: - Symbol = KCS-BTC - Side = BUY | SELL - Limit - Page - Since - Before
func (*Kucoin) ListSpecificDealtOrders ¶
func (k *Kucoin) ListSpecificDealtOrders(symbol, side string, limit, page int) (specificDealtOrders SpecificDealtOrder, err error)
ListSpecificDealtOrders is used to get the information about dealt orders for specific symbol at Kucoin along with other meta data. Symbol, Side (type in Kucoin docs.) are required parameters. Limit and page may be zeros. Example: - Symbol (required) = KCS-BTC - Side = BUY | SELL - Limit - Page
func (*Kucoin) OrderDetails ¶
func (k *Kucoin) OrderDetails(symbol, side, orderOid string, limit, page int) (orderDetails OrderDetails, err error)
OrderDetails is used to get the information about orders for specific symbol at Kucoin along with other meta data. Symbol, Side (type in Kucoin docs.) are required parameters. Limit may be zero, and not greater than 20. Page may be zero and by default is equal to 1. Example: - Symbol (required) = KCS-BTC - Side (required) = BUY | SELL - OrderOid (required) - Limit - Page
func (*Kucoin) OrdersBook ¶
func (k *Kucoin) OrdersBook(symbol string, group, limit int, direction string) (ordersBook OrdersBook, err error)
OrdersBook is used to get the information about active orders at Kucoin along with other meta data. Example: - Symbol (required) = KCS-BTC - Group - Limit - Direction = BUY | SELL
type MergedDealtOrder ¶
type MergedDealtOrder struct { Total int `json:"total"` Datas []struct { CreatedAt int64 `json:"createdAt"` Amount float64 `json:"amount"` DealValue float64 `json:"dealValue"` DealPrice float64 `json:"dealPrice"` Fee float64 `json:"fee"` FeeRate float64 `json:"feeRate"` Oid string `json:"oid"` OrderOid string `json:"orderOid"` CoinType string `json:"coinType"` CoinTypePair string `json:"coinTypePair"` Direction string `json:"direction"` DealDirection string `json:"dealDirection"` } `json:"datas"` Limit int `json:"limit"` Page int `json:"page"` }
MergedDealtOrder struct represents kucoin data model.
type Order ¶
type Order struct {
OrderOid string `json:"orderOid"`
}
Order structs represents kucoin data model.
type OrderDetails ¶
type OrderDetails struct { CoinType string `json:"coinType"` DealValueTotal float64 `json:"dealValueTotal"` DealPriceAverage float64 `json:"dealPriceAverage"` FeeTotal float64 `json:"feeTotal"` UserOid string `json:"userOid"` DealAmount float64 `json:"dealAmount"` DealOrders struct { Total int `json:"total"` FirstPage bool `json:"firstPage"` LastPage bool `json:"lastPage"` Datas []struct { Amount float64 `json:"amount"` DealValue float64 `json:"dealValue"` Fee float64 `json:"fee"` DealPrice float64 `json:"dealPrice"` FeeRate float64 `json:"feeRate"` } `json:"datas"` CurrPageNo int `json:"currPageNo"` Limit int `json:"limit"` PageNos int `json:"pageNos"` } `json:"dealOrders"` CoinTypePair string `json:"coinTypePair"` OrderPrice float64 `json:"orderPrice"` Type string `json:"type"` OrderOid string `json:"orderOid"` PendingAmount float64 `json:"pendingAmount"` }
OrderDetails structs represents kucoin data model.
type OrdersBook ¶
type OrdersBook struct { Comment string `json:"_comment"` SELL [][]float64 `json:"SELL"` BUY [][]float64 `json:"BUY"` }
OrdersBook struct represents kucoin data model.
type SpecificDealtOrder ¶
type SpecificDealtOrder struct { Datas []struct { Oid string `json:"oid"` DealPrice float64 `json:"dealPrice"` OrderOid string `json:"orderOid"` Direction string `json:"direction"` Amount float64 `json:"amount"` DealValue float64 `json:"dealValue"` CreatedAt int64 `json:"createdAt"` } `json:"datas"` Total int `json:"total"` Limit int `json:"limit"` PageNos int `json:"pageNos"` CurrPageNo int `json:"currPageNo"` UserOid string `json:"userOid"` Direction interface{} `json:"direction"` StartRow int `json:"startRow"` FirstPage bool `json:"firstPage"` LastPage bool `json:"lastPage"` }
SpecificDealtOrder struct represents kucoin data model.
type Symbol ¶
type Symbol struct { CoinType string `json:"coinType"` Trading bool `json:"trading"` Symbol string `json:"symbol"` LastDealPrice float64 `json:"lastDealPrice,omitempty"` Buy float64 `json:"buy,omitempty"` Sell float64 `json:"sell,omitempty"` Change float64 `json:"change,omitempty"` CoinTypePair string `json:"coinTypePair"` Sort int `json:"sort"` FeeRate float64 `json:"feeRate"` VolValue float64 `json:"volValue"` High float64 `json:"high,omitempty"` Datetime int64 `json:"datetime"` Vol float64 `json:"vol"` Low float64 `json:"low,omitempty"` ChangeRate float64 `json:"changeRate,omitempty"` Stick bool `json:"stick,omitempty"` Fav bool `json:"fav,omitempty"` }
Symbol struct represents kucoin data model.
type UserInfo ¶
type UserInfo struct { ReferrerCode string `json:"referrer_code"` PhotoCredentialValidated bool `json:"photoCredentialValidated"` VideoValidated bool `json:"videoValidated"` Language string `json:"language"` Currency string `json:"currency"` Oid string `json:"oid"` BaseFeeRate float64 `json:"baseFeeRate"` HasCredential bool `json:"hasCredential"` CredentialNumber string `json:"credentialNumber"` PhoneValidated bool `json:"phoneValidated"` Phone string `json:"phone"` CredentialValidated bool `json:"credentialValidated"` GoogleTwoFaBinding bool `json:"googleTwoFaBinding"` Nickname interface{} `json:"nickname"` Name string `json:"name"` HasTradePassword bool `json:"hasTradePassword"` EmailValidated bool `json:"emailValidated"` Email string `json:"email"` LoginRecord struct { Last struct { IP string `json:"ip"` Context interface{} `json:"context"` Time int64 `json:"time"` } `json:"last"` Current struct { IP string `json:"ip"` Context interface{} `json:"context"` Time int64 `json:"time"` } `json:"current"` } `json:"loginRecord"` }
UserInfo struct represents kucoin data model.