Versions in this module Expand all Collapse all v1 v1.0.3 Apr 1, 2020 Changes in this version type AccountModel + Currency string type ApiService + func (as *ApiService) TransferOutV2(bizNo, amount, currency string) (*ApiResponse, error) type ContractsModel + MaxLeverage float32 type FillModel + SettleCurrency string + TradeTime int64 type FundingModel + SettleCurrency string type OpenOrderStatisticsModel + SettleCurrency string type OrderModel + SettleCurrency string + Status string + UpdatedAt int64 type PositionModel + SettleCurrency string type TransactionHistoryModel + Currency string + type TransferOutV2Model struct + ApplyId string v1.0.2 Jan 22, 2020 Changes in this version + const Command + const Notice v1.0.1 Jan 21, 2020 Changes in this version type WebSocketTokenModel + AcceptUserMessage bool v1.0.0 Dec 9, 2019 Changes in this version + const AckMessage + const ApiSuccess + const ErrorMessage + const Message + const PingMessage + const PongMessage + const ProductionApiBaseURI + const SubscribeMessage + const UnsubscribeMessage + const WelcomeMessage + var DebugMode = os.Getenv("API_DEBUG_MODE") == "1" + var Version = "1.0.1" + func IntToString(i int64) string + func SetLoggerDirectory(directory string) + func ToJsonString(v interface{}) string + type AccountModel struct + AccountEquity string + AvailableBalance string + FrozenFunds string + MarginBalance string + OrderMargin string + PositionMargin string + UnrealisedPNL string + type AccountsModel []*AccountModel + type ApiResponse struct + Code string + Message string + RawData jsoniter.RawMessage + func (ar *ApiResponse) ApiSuccessful() bool + func (ar *ApiResponse) HttpSuccessful() bool + func (ar *ApiResponse) ReadData(v interface{}) error + func (ar *ApiResponse) ReadPaginationData(v interface{}) (*PaginationModel, error) + type ApiService struct + func NewApiService(opts ...ApiServiceOption) *ApiService + func NewApiServiceFromEnv() *ApiService + func (as *ApiService) AccountOverview() (*ApiResponse, error) + func (as *ApiService) ActiveContracts() (*ApiResponse, error) + func (as *ApiService) ApplyWithdrawal(currency, address, amount string, options map[string]string) (*ApiResponse, error) + func (as *ApiService) AutoDepositStatus(params map[string]string) (*ApiResponse, error) + func (as *ApiService) Call(request *Request) (*ApiResponse, error) + func (as *ApiService) CancelOrder(orderId string) (*ApiResponse, error) + func (as *ApiService) CancelOrders(symbol string) (*ApiResponse, error) + func (as *ApiService) CancelTransfer(applyId string) (*ApiResponse, error) + func (as *ApiService) CancelWithdrawal(withdrawalId string) (*ApiResponse, error) + func (as *ApiService) Contracts(symbol string) (*ApiResponse, error) + func (as *ApiService) CreateOrder(params map[string]string) (*ApiResponse, error) + func (as *ApiService) DepositAddresses(currency string) (*ApiResponse, error) + func (as *ApiService) DepositMargin(params map[string]string) (*ApiResponse, error) + func (as *ApiService) Deposits(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) Fills(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) FundingHistory(params map[string]string) (*ApiResponse, error) + func (as *ApiService) FundingRate(Symbol string) (*ApiResponse, error) + func (as *ApiService) IndexQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) InterestQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) Level2MessageQuery(symbol string, start, end int64) (*ApiResponse, error) + func (as *ApiService) Level2Snapshot(symbol string) (*ApiResponse, error) + func (as *ApiService) Level3MessageQuery(symbol string, start, end int64) (*ApiResponse, error) + func (as *ApiService) Level3Snapshot(symbol string) (*ApiResponse, error) + func (as *ApiService) MarkPrice(Symbol string) (*ApiResponse, error) + func (as *ApiService) NewWebSocketClient(token *WebSocketTokenModel) *WebSocketClient + func (as *ApiService) OpenOrderStatistics(symbol string) (*ApiResponse, error) + func (as *ApiService) Order(orderId string) (*ApiResponse, error) + func (as *ApiService) Orders(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) Position(symbol string) (*ApiResponse, error) + func (as *ApiService) Positions() (*ApiResponse, error) + func (as *ApiService) PremiumQuery(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) RecentDoneOrders() (*ApiResponse, error) + func (as *ApiService) RecentFills() (*ApiResponse, error) + func (as *ApiService) ServerTime() (*ApiResponse, error) + func (as *ApiService) StopOrders(symbol string) (*ApiResponse, error) + func (as *ApiService) Ticker(symbol string) (*ApiResponse, error) + func (as *ApiService) TradeHistory(symbol string) (*ApiResponse, error) + func (as *ApiService) TransactionHistory(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) TransferList(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + func (as *ApiService) TransferOut(bizNo, amount string) (*ApiResponse, error) + func (as *ApiService) WebSocketPrivateToken() (*ApiResponse, error) + func (as *ApiService) WebSocketPublicToken() (*ApiResponse, error) + func (as *ApiService) WithdrawalQuotas(currency string) (*ApiResponse, error) + func (as *ApiService) Withdrawals(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) + type ApiServiceOption func(service *ApiService) + func ApiBaseURIOption(uri string) ApiServiceOption + func ApiKeyOption(key string) ApiServiceOption + func ApiPassPhraseOption(passPhrase string) ApiServiceOption + func ApiSecretOption(secret string) ApiServiceOption + func ApiSkipVerifyTlsOption(skipVerifyTls bool) ApiServiceOption + type ApplyWithdrawalResultModel struct + WithdrawalId string + type BasicRequester struct + func (br *BasicRequester) Request(request *Request, timeout time.Duration) (*Response, error) + type CancelOrderResultModel struct + CancelledOrderIds []string + type CancelTransferModel struct + ApplyId string + type CancelWithdrawalResultModel struct + CancelledWithdrawIds []string + type ContractsModel struct + BaseCurrency string + FairMethod string + FundingBaseSymbol string + FundingQuoteSymbol string + FundingRateSymbol string + IndexSymbol string + InitialMargin string + IsDeleverage bool + IsInverse bool + IsQuanto bool + LotSize string + MaintainMargin string + MakerFeeRate string + MakerFixFee string + MarkMethod string + MaxOrderQty string + MaxPrice string + MaxRiskLimit string + MinRiskLimit string + Multiplier string + QuoteCurrency string + RiskStep string + RootSymbol string + Status string + Symbol string + TakerFeeRate string + TakerFixFee string + TickSize string + type CreateOrderResultModel struct + OrderId string + type DepositAddressModel struct + Address string + Memo string + type DepositAddressesModel []*DepositAddressModel + type DepositModel struct + Address string + Amount string + CreatedAt int64 + Currency string + Fee string + IsInner bool + Status string + WalletTxId string + type DepositsModel []*DepositModel + type FillModel struct + CreatedAt int64 + Fee string + FeeCurrency string + FeeRate string + FixFee string + Liquidity string + OrderId string + OrderType string + Price string + Side string + Size string + Stop string + Symbol string + TradeId string + TradeType string + Value string + type FillsModel []*FillModel + type FundingListModel struct + DataList []*FundingModel + HasMore bool + type FundingModel struct + Funding float64 + FundingRate float64 + Id int64 + MarkPrice float64 + PositionCost float64 + PositionQty float32 + Symbol string + TimePoint int64 + type FundingRateModel struct + Granularity int64 + PredictedValue float32 + Symbol string + TimePoint int64 + Value float32 + type IndexModel struct + DecomposionList [][]interface{} + Granularity int + Symbol string + TimePoint int64 + Value float32 + type IndexQueryModel struct + DataList []*IndexModel + HasMore bool + type InterestModel struct + Granularity int + Symbol string + TimePoint int64 + Value float32 + type InterestsModel struct + DataList []*InterestModel + HasMore bool + type KcSigner struct + func NewKcSigner(key, secret, passPhrase string) *KcSigner + func (ks *KcSigner) Headers(plain string) map[string]string + func (ks *KcSigner) Sign(plain []byte) []byte + type Level2MessageQueryListModel []*Level2MessageQueryModel + type Level2MessageQueryModel struct + Change string + Sequence int + Symbol string + type Level2SnapshotModel struct + Asks [][]float32 + Bids [][]float32 + Sequence int + Symbol string + type Level3MessageQueryListModel []*Level3MessageQueryModel + type Level3MessageQueryModel struct + ClientOid string + OrderId string + OrderTime int64 + Price string + Sequence int + Side string + Size int + Symbol string + Ts int64 + Type string + type Level3SnapshotModel struct + Asks [][]interface{} + Bids [][]interface{} + Sequence int + Symbol string + type MarkPriceModel struct + Granularity float32 + IndexPrice float32 + Symbol string + TimePoint int64 + Value float32 + type OpenOrderStatisticsModel struct + OpenOrderBuyCost string + OpenOrderBuySize string + OpenOrderSellCost string + OpenOrderSellSize string + type OrderModel struct + CancelExist bool + ClientOid string + CloseOnly bool + CloseOrder bool + CreatedAt int64 + DealSize string + DealValue string + ForceHold bool + Hidden bool + IceBerg bool + Id string + IsActive bool + Leverage string + PostOnly bool + Price string + Remark string + Side string + Size string + Stop string + StopPrice string + StopPriceType string + StopTriggered bool + Stp string + Symbol string + TimeInForce string + Type string + Value string + VisibleSize string + type OrdersModel []*OrderModel + type PaginationModel struct + CurrentPage int64 + PageSize int64 + RawItems json.RawMessage + TotalNum int64 + TotalPage int64 + func (p *PaginationModel) ReadItems(v interface{}) error + type PaginationParam struct + CurrentPage int64 + PageSize int64 + func (p *PaginationParam) ReadParam(params map[string]string) + type PositionModel struct + AutoDeposit bool + AvgEntryPrice string + BankruptPrice string + CrossMode bool + CurrentComm string + CurrentCost string + CurrentQty string + CurrentTimestamp string + DelevPercentage string + Id string + IsOpen bool + LiquidationPrice string + MaintMargin string + MaintMarginReq string + MarkPrice string + MarkValue string + OpeningTimestamp string + PosComm string + PosCost string + PosCross string + PosInit string + PosLoss string + PosMaint string + PosMargin string + RealLeverage string + RealisedCost string + RealisedGrossCost string + RealisedGrossPnl string + RealisedPnl string + RiskLimit string + Symbol string + UnrealisedCost string + UnrealisedPnl string + UnrealisedPnlPcnt string + UnrealisedRoePcnt string + type PremiumModel struct + Granularity string + Symbol string + TimePoint string + Value string + type PremiumsModel struct + DataList []*PremiumModel + HasMore bool + type Request struct + BaseURI string + Body []byte + Header http.Header + Method string + Path string + Query url.Values + SkipVerifyTls bool + Timeout time.Duration + func NewRequest(method, path string, params map[string]string) *Request + func (r *Request) FullURL() string + func (r *Request) HttpRequest() (*http.Request, error) + func (r *Request) RequestURI() string + type Requester interface + Request func(request *Request, timeout time.Duration) (*Response, error) + type Response struct + func (r *Response) ReadBody() ([]byte, error) + func (r *Response) ReadJsonBody(v interface{}) error + type Sha256Signer struct + func (ss *Sha256Signer) Sign(plain []byte) []byte + type Signer interface + Sign func(plain []byte) []byte + type TickerLevel1Model struct + BestAskPrice string + BestAskSize int + BestBidPrice string + BestBidSize int + Price string + Sequence int + Side string + Size int + Symbol string + TradeId string + Ts int64 + type TradeHistoryModel struct + MakerOrderId string + Price string + Sequence int + Side string + Size int + TakerOrderId string + Time int64 + TradeId string + type TradesHistoryModel []*TradeHistoryModel + type TransactionHistoryListModel []*TransactionHistoryModel + type TransactionHistoryModel struct + AccountEquity string + Amount string + Fee string + Offset string + Remarks string + Status string + Time string + Type string + type TransferModel struct + Amount string + ApplyId string + CreatedAt int64 + Currency string + Offset int64 + Reason string + Status string + type TransferOutModel struct + ApplyId string + type TransfersModel []*TransferModel + type WebSocketClient struct + func (wc *WebSocketClient) Connect() (<-chan *WebSocketDownstreamMessage, <-chan error, error) + func (wc *WebSocketClient) Stop() + func (wc *WebSocketClient) Subscribe(channels ...*WebSocketSubscribeMessage) error + func (wc *WebSocketClient) Unsubscribe(channels ...*WebSocketUnsubscribeMessage) error + type WebSocketDownstreamMessage struct + RawData json.RawMessage + Sn string + Subject string + Topic string + func (m *WebSocketDownstreamMessage) ReadData(v interface{}) error + type WebSocketMessage struct + Id string + Type string + func NewPingMessage() *WebSocketMessage + type WebSocketServerModel struct + Encrypt bool + Endpoint string + PingInterval int64 + PingTimeout int64 + Protocol string + type WebSocketServersModel []*WebSocketServerModel + func (s WebSocketServersModel) RandomServer() (*WebSocketServerModel, error) + type WebSocketSubscribeMessage struct + PrivateChannel bool + Response bool + Topic string + func NewSubscribeMessage(topic string, privateChannel bool) *WebSocketSubscribeMessage + type WebSocketTokenModel struct + Servers WebSocketServersModel + Token string + type WebSocketUnsubscribeMessage WebSocketSubscribeMessage + func NewUnsubscribeMessage(topic string, privateChannel bool) *WebSocketUnsubscribeMessage + type WithdrawalModel struct + Address string + Amount string + CreatedAt int64 + Currency string + Fee string + IsInner bool + Reason string + Remark string + Status string + WalletTxId string + WithdrawalId string + type WithdrawalQuotasModel struct + AvailableAmount float32 + Currency string + InnerWithdrawMinFee float32 + IsWithdrawEnabled bool + LimitAmount float32 + Precision uint8 + RemainAmount float32 + UsedAmount float32 + WithdrawMinFee float32 + WithdrawMinSize float32 + type WithdrawalsModel []*WithdrawalModel