Versions in this module Expand all Collapse all v0 v0.2.0 Jan 13, 2025 Changes in this version + var API_ERR = ApiError + var EX_ERR_API_LIMIT = ApiError + var EX_ERR_CANCEL_ORDER_FAIL = ApiError + var EX_ERR_INSUFFICIENT_BALANCE = ApiError + var EX_ERR_INVALID_CURRENCY_PAIR = ApiError + var EX_ERR_NOT_FIND_APIKEY = ApiError + var EX_ERR_NOT_FIND_ORDER = ApiError + var EX_ERR_NOT_FIND_SECRETKEY = ApiError + var EX_ERR_PLACE_ORDER_FAIL = ApiError + var EX_ERR_SIGN = ApiError + var EX_ERR_SYMBOL_ERR = ApiError + var HTTP_ERR_CODE = ApiError + func CancelAllUnfinishedFutureOrders(api FutureRestAPI, contractType string, currencyPair cons.CurrencyPair) int + func CancelAllUnfinishedOrders(api API, currencyPair cons.CurrencyPair) int + func GetParamHmacMD5Sign(secret, params string) (string, error) + func GetParamHmacSHA1Sign(secret, params string) (string, error) + func GetParamHmacSHA256Base64Sign(secret, params string) (string, error) + func GetParamHmacSHA256Sign(secret, params string) (string, error) + func GetParamHmacSHA512Base64Sign(hmacKey string, hmacData string) string + func GetParamHmacSHA512Sign(secret, params string) (string, error) + func GetParamHmacSha384Sign(secret, params string) (string, error) + func GetParamMD5Sign(secret, params string) (string, error) + func GetSHA(text string) (string, error) + func RE(retry int, delay time.Duration, method any, params ...any) any + type API interface + AllTicker func(SymPair map[string]q.D) (*sync.Map, error) + Balances func() (*sync.Map, *sync.Map, error) + CancelOrder func(orderId string, currency cons.CurrencyPair) (bool, error) + Fee func() float64 + GetAttr func() q.Attr + GetUnfinishedOrders func(currency cons.CurrencyPair) ([]q.Order, error) + OneTicker func(d q.D) (q.Bbo, error) + PairArray func() (map[string]q.D, map[q.D]q.P, error) + PlaceOrders func([3]q.Order) ([3]q.Order, error) + String func() string + Test func() bool + TradeFee func() (map[string]q.TradeFee, error) + WithdrawFee func() ([]q.NetworkWithdraw, error) + type APIConfig struct + ApiKey string + ApiPassphrase string + ApiSecretKey string + ClientId string + Endpoint string + HttpClient *http.Client + Lever float64 + type Account struct + Asset float64 + Exchange string + NetAsset float64 + SubAccounts map[cons.Currency]SubAccount + type ApiError struct + ErrCode string + ErrMsg string + OriginErrMsg string + func (e ApiError) Error() string + func (e ApiError) OriginErr(err string) ApiError + type BorrowParameter struct + Amount float64 + Currency cons.Currency + CurrencyPair cons.CurrencyPair + type DepositWithdrawHistory struct + Amount float64 + Currency string + Fee string + From string + Memo string + Status int + Timestamp time.Time + To string + Txid string + WithdrawalId string + type Depth struct + AskList DepthRecords + BidList DepthRecords + ContractId string + ContractType string + Pair cons.CurrencyPair + UTime time.Time + type DepthRecord struct + Amount float64 + Price float64 + type DepthRecords []DepthRecord + func (dr DepthRecords) Len() int + func (dr DepthRecords) Less(i, j int) bool + func (dr DepthRecords) Swap(i, j int) + type FutureAccount struct + FutureSubAccounts map[cons.Currency]FutureSubAccount + type FutureKline struct + Vol2 float64 + type FutureOrder struct + AlgoType int + Amount float64 + AvgPrice float64 + ClientOid string + ContractName string + Currency cons.CurrencyPair + DealAmount float64 + Fee float64 + FinishedTime int64 + LeverRate float64 + OType int + OrderID int64 + OrderID2 string + OrderTime int64 + OrderType int + Price float64 + Status cons.TradeStatus + TriggerPrice float64 + type FuturePosition struct + BuyAmount float64 + BuyAvailable float64 + BuyPriceAvg float64 + BuyPriceCost float64 + BuyProfit float64 + BuyProfitReal float64 + ContractId int64 + ContractType string + CreateDate int64 + ForceLiquPrice float64 + LeverRate float64 + LongPnlRatio float64 + SellAmount float64 + SellAvailable float64 + SellPriceAvg float64 + SellPriceCost float64 + SellProfit float64 + SellProfitReal float64 + ShortPnlRatio float64 + Symbol cons.CurrencyPair + type FutureRestAPI interface + FutureCancelOrder func(currencyPair cons.CurrencyPair, contractType, orderId string) (bool, error) + GetContractValue func(currencyPair cons.CurrencyPair) (float64, error) + GetDeliveryTime func() (int, int, int, int) + GetFee func() (float64, error) + GetFutureDepth func(currencyPair cons.CurrencyPair, contractType string, size int) (*Depth, error) + GetFutureEstimatedPrice func(currencyPair cons.CurrencyPair) (float64, error) + GetFutureIndex func(currencyPair cons.CurrencyPair) (float64, error) + GetFutureOrder func(orderId string, currencyPair cons.CurrencyPair, contractType string) (*FutureOrder, error) + GetFutureOrderHistory func(pair cons.CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error) + GetFutureOrders func(orderIds []string, currencyPair cons.CurrencyPair, contractType string) ([]FutureOrder, error) + GetFuturePosition func(currencyPair cons.CurrencyPair, contractType string) ([]FuturePosition, error) + GetFutureTicker func(currencyPair cons.CurrencyPair, contractType string) (*Ticker, error) + GetFutureUserinfo func(currencyPair ...cons.CurrencyPair) (*FutureAccount, error) + GetKlineRecords func(contractType string, currency cons.CurrencyPair, period cons.KlinePeriod, ...) ([]FutureKline, error) + GetTrades func(contractType string, currencyPair cons.CurrencyPair, since int64) ([]q.Trade, error) + GetUnfinishFutureOrders func(currencyPair cons.CurrencyPair, contractType string) ([]FutureOrder, error) + LimitFuturesOrder func(currencyPair cons.CurrencyPair, contractType, price, amount string, ...) (*FutureOrder, error) + MarketFuturesOrder func(currencyPair cons.CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error) + PlaceFutureOrder func(currencyPair cons.CurrencyPair, contractType, price, amount string, ...) (string, error) + String func() string + type FutureSubAccount struct + AccountRights float64 + Currency cons.Currency + KeepDeposit float64 + ProfitReal float64 + ProfitUnreal float64 + RiskRate float64 + type FutureTicker struct + ContractId string + ContractType string + HoldAmount float64 + LimitHigh float64 + LimitLow float64 + UnitAmount float64 + type FuturesContractInfo struct + ContractType string + ContractVal float64 + Delivery string + type FuturesWsApi interface + DepthCallback func(func(depth *Depth)) + SubscribeDepth func(pair cons.CurrencyPair, contractType string) error + SubscribeTicker func(pair cons.CurrencyPair, contractType string) error + SubscribeTrade func(pair cons.CurrencyPair, contractType string) error + TickerCallback func(func(ticker *FutureTicker)) + TradeCallback func(func(trade *q.Trade, contract string)) + type HistoricalFunding struct + FundingTime time.Time + InstrumentId string + RealizedRate float64 + type Kline struct + Close float64 + High float64 + Low float64 + Open float64 + Pair cons.CurrencyPair + Timestamp int64 + Vol float64 + type MarginAccount struct + LiquidationPrice float64 + MarginRatio float64 + RiskRate float64 + Sub map[cons.Currency]MarginSubAccount + type MarginSubAccount struct + Available float64 + Balance float64 + CanWithdraw float64 + Frozen float64 + LendingFee float64 + Loan float64 + type OptionalParameter map[string]any + func (optional OptionalParameter) GetFloat64(name string) float64 + func (optional OptionalParameter) GetInt(name string) int + func (optional OptionalParameter) GetInt64(name string) int64 + func (optional OptionalParameter) GetString(name string) string + func (optional OptionalParameter) GetTime(name string) *time.Time + func (optional OptionalParameter) Optional(name string, value any) OptionalParameter + type PoloniexCurrency struct + Blockchain string + CurrencyType string + Delisted int + DepositAddress string + Disabled int + Frozen int + HumanType string + ID int + IsGeofenced int + MinConf int + Name string + TxFee string + type RepaymentParameter struct + BorrowId string + type SpotWsApi interface + BBOCallback func(func(bbo *q.Bbo)) + DepthCallback func(func(depth *Depth)) + SubscribeBBO func(sm []string) error + SubscribeDepth func(pair cons.CurrencyPair) error + SubscribeTicker func(pair cons.CurrencyPair) error + SubscribeTrade func(pair cons.CurrencyPair) error + TickerCallback func(func(ticker *Ticker)) + TradeCallback func(func(trade *q.Trade)) + type SubAccount struct + Amount float64 + Currency cons.Currency + ForzenAmount float64 + LoanAmount float64 + type TickSize struct + AmountTickSize float64 + InstrumentID string + PriceTickSize float64 + QuoteCurrency string + UnderlyingIndex string + type Ticker struct + Buy float64 + Date uint64 + High float64 + Last float64 + Low float64 + Pair cons.CurrencyPair + Sell float64 + Vol float64 + type TransferParameter struct + Amount float64 + Currency string + From int + InstrumentId string + SubAccount string + To int + ToInstrumentId string + type WalletApi interface + GetAccount func() (*Account, error) + GetDepositHistory func(currency *cons.Currency) ([]DepositWithdrawHistory, error) + GetWithDrawHistory func(currency *cons.Currency) ([]DepositWithdrawHistory, error) + Transfer func(param TransferParameter) error + Withdrawal func(param WithdrawParameter) (withdrawId string, err error) + type WithdrawParameter struct + Amount float64 + Currency string + Destination int + Fee string + ToAddress string + TradePwd string