Documentation
¶
Index ¶
- Constants
- type AccountBalance
- type AccountID
- type CancelOrder
- type CoinsData
- type InnerTrans
- type JsonResponse
- type KLine
- type Kucoin
- func (e *Kucoin) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string, sandbox bool) string
- func (e *Kucoin) CanDeposit(coin *coin.Coin) bool
- func (e *Kucoin) CanWithdraw(coin *coin.Coin) bool
- func (e *Kucoin) CancelAllOrder() error
- func (e *Kucoin) CancelOrder(order *exchange.Order) error
- func (e *Kucoin) DeleteCoin(coin *coin.Coin)
- func (e *Kucoin) DeletePair(pair *pair.Pair)
- func (e *Kucoin) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *Kucoin) GetBalance(coin *coin.Coin) float64
- func (e *Kucoin) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *Kucoin) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *Kucoin) GetCoins() []*coin.Coin
- func (e *Kucoin) GetCoinsData() error
- func (e *Kucoin) GetConfirmation(coin *coin.Coin) int
- func (e *Kucoin) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *Kucoin) GetFee(pair *pair.Pair) float64
- func (e *Kucoin) GetID() int
- func (e *Kucoin) GetLotSize(pair *pair.Pair) float64
- func (e *Kucoin) GetName() exchange.ExchangeName
- func (e *Kucoin) GetPairBySymbol(symbol string) *pair.Pair
- func (e *Kucoin) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *Kucoin) GetPairs() []*pair.Pair
- func (e *Kucoin) GetPairsData() error
- func (e *Kucoin) GetPriceFilter(pair *pair.Pair) float64
- func (e *Kucoin) GetSymbolByCoin(coin *coin.Coin) string
- func (e *Kucoin) GetSymbolByPair(pair *pair.Pair) string
- func (e *Kucoin) GetTradingWebURL(pair *pair.Pair) string
- func (e *Kucoin) GetTxFee(coin *coin.Coin) float64
- func (e *Kucoin) HasPair(pair *pair.Pair) bool
- func (e *Kucoin) InitData() error
- func (e *Kucoin) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Kucoin) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Kucoin) ListOrders() ([]*exchange.Order, error)
- func (e *Kucoin) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *Kucoin) OrderBook(p *pair.Pair) (*exchange.Maker, error)
- func (e *Kucoin) OrderStatus(order *exchange.Order) error
- func (e *Kucoin) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *Kucoin) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *Kucoin) UpdateAllBalances()
- func (e *Kucoin) UpdateConstraint()
- func (e *Kucoin) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type OpenOrders
- type OrderBook
- type OrderDetail
- type OrderStatus
- type PairsData
- type SubAccountBalances
- type SubAccountList
- type SubAllAccountBalances
- type TickerPrice
- type TradeHistory
- type Withdraw
Constants ¶
const ( API_URL = "https://openapi-v2.kucoin.com" SANDBOX_API_URL = "https://openapi-sandbox.kucoin.com" )
The Base Endpoint URL
const ( DEFAULT_ID = 6 DEFAULT_TAKER_FEE = 0.001 DEFAULT_MAKER_FEE = 0.001 DEFAULT_LOT_SIZE = 0.00000001 DEFAULT_PRICE_FILTER = 0.00000001 //PRICE FILTER DEFAULT_CONFIRMATION = 1001 DEFAULT_LISTED = true )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalance ¶
type CancelOrder ¶
type CancelOrder struct {
CancelledOrderIds []string `json:"cancelledOrderIds"`
}
type CoinsData ¶
type CoinsData []struct { WithdrawalMinFee string `json:"withdrawalMinFee"` Precision int `json:"precision"` Name string `json:"name"` FullName string `json:"fullName"` Currency string `json:"currency"` WithdrawalMinSize string `json:"withdrawalMinSize"` IsWithdrawEnabled bool `json:"isWithdrawEnabled"` IsDepositEnabled bool `json:"isDepositEnabled"` }
type InnerTrans ¶
type JsonResponse ¶
type Kucoin ¶
type Kucoin struct { ID int Name string `bson:"name"` Website string `bson:"website"` API_KEY string API_SECRET string Passphrase string Source exchange.DataSource // / exchange API / microservicve api 1 / PSQL SourceURI string }
func CreateKucoin ¶
*************************************************
func (*Kucoin) ApiKeyRequest ¶
func (e *Kucoin) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string, sandbox bool) string
************** Signature Http Request ************** Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests
func (*Kucoin) CancelAllOrder ¶
func (*Kucoin) DeleteCoin ¶
func (*Kucoin) DeletePair ¶
func (*Kucoin) DoAccountOperation ¶
func (e *Kucoin) DoAccountOperation(operation *exchange.AccountOperation) error
func (*Kucoin) GetCoinConstraint ¶
func (e *Kucoin) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*Kucoin) GetCoinsData ¶
************** Public API ************** Get Coins Information (If API provide) Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)
func (*Kucoin) GetConstraintFetchMethod ¶
func (e *Kucoin) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*Kucoin) GetName ¶
func (e *Kucoin) GetName() exchange.ExchangeName
func (*Kucoin) GetPairConstraint ¶
func (e *Kucoin) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*Kucoin) GetPairsData ¶
GetPairsData - Get Pairs Information (If API provide)
Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)
func (*Kucoin) LoadPublicData ¶
func (e *Kucoin) LoadPublicData(operation *exchange.PublicOperation) error
func (*Kucoin) OrderBook ¶
Get Pair Market Depth Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Get Exchange Pair Code ex. symbol := e.GetPairCode(p) Step 4: Modify API Path(strRequestUrl) Step 5: Add Params - Depend on API request Step 6: Convert the response to Standard Maker struct
func (*Kucoin) SetCoinConstraint ¶
func (e *Kucoin) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*Kucoin) SetPairConstraint ¶
func (e *Kucoin) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*Kucoin) UpdateAllBalances ¶
func (e *Kucoin) UpdateAllBalances()
func (*Kucoin) UpdateConstraint ¶
func (e *Kucoin) UpdateConstraint()
type OpenOrders ¶
type OpenOrders struct { CurrentPage int `json:"currentPage"` PageSize int `json:"pageSize"` TotalNum int `json:"totalNum"` TotalPage int `json:"totalPage"` Items []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 int `json:"cancelAfter"` Channel string `json:"channel"` ClientOid string `json:"clientOid"` Remark interface{} `json:"remark"` Tags interface{} `json:"tags"` IsActive bool `json:"isActive"` CancelExist bool `json:"cancelExist"` CreatedAt int64 `json:"createdAt"` TradeType string `json:"tradeType"` } `json:"items"` }
type OrderDetail ¶
type OrderDetail struct {
OrderID string `json:"orderId"`
}
type OrderStatus ¶
type OrderStatus 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 int `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"` }
type PairsData ¶
type PairsData []struct { Symbol string `json:"symbol"` QuoteMaxSize string `json:"quoteMaxSize"` EnableTrading bool `json:"enableTrading"` PriceIncrement string `json:"priceIncrement"` BaseMaxSize string `json:"baseMaxSize"` BaseCurrency string `json:"baseCurrency"` QuoteCurrency string `json:"quoteCurrency"` Market string `json:"market"` QuoteIncrement string `json:"quoteIncrement"` BaseMinSize string `json:"baseMinSize"` QuoteMinSize string `json:"quoteMinSize"` Name string `json:"name"` BaseIncrement string `json:"baseIncrement"` }
type SubAccountBalances ¶
type SubAccountBalances 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"` }
type SubAccountList ¶
type SubAllAccountBalances ¶
type SubAllAccountBalances []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"` }
type TickerPrice ¶
type TickerPrice struct { Time int64 `json:"time"` Ticker []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"` } `json:"ticker"` }