Documentation ¶
Index ¶
- Variables
- func FormatTimestamp(t time.Time) int64
- func NewDeliveryClient(apiKey, secretKey string) *delivery.Client
- func NewFuturesClient(apiKey, secretKey string) *futures.Client
- type AllAsset
- type AllAssetService
- type AssetAll
- type AssetConfig
- type Client
- func (c *Client) NewAllAssetService() *AllAssetService
- func (c *Client) NewConfigService() *ConfigService
- func (c *Client) NewCountriesService() *CountriesService
- func (c *Client) NewCurrencyPairService() *CurrencyPairService
- func (c *Client) NewFiatListService() *FiatListService
- func (c *Client) NewFilterConditionsService() *FilterConditionsService
- func (c *Client) NewSearchService() *SearchService
- func (c *Client) SetApiEndpoint(url string) *Client
- type Config
- type ConfigArea
- type ConfigData
- type ConfigService
- type ConvertAsset
- type Countries
- type CountriesService
- type Country
- type CurrencyPair
- type CurrencyPairService
- type Fiat
- type FiatList
- type FiatListService
- type Filter
- type FilterConditions
- type FilterConditionsService
- type FilterCountry
- type FilterData
- type FilterDefaultValue
- type FilterTradeMethod
- type Pair
- type RequestOption
- type Search
- type SearchAdv
- type SearchAdvertiser
- type SearchData
- type SearchService
- func (s *SearchService) Do(ctx context.Context, opts ...RequestOption) (res *Search, err error)
- func (s *SearchService) SetAmount(amount int) *SearchService
- func (s *SearchService) SetCountry(contry []string) *SearchService
- func (s *SearchService) SetPageSize(page int, row int) *SearchService
- func (s *SearchService) SetSearch(fiat string, asset string, tradeType TradeType, payTypes []string) *SearchService
- type SearchTradeMethod
- type TradeMethod
- type TradeSide
- type TradeType
Constants ¶
This section is empty.
Variables ¶
var UseTestnet = false
UseTestnet switch all the API endpoints from production to the testnet
Functions ¶
func FormatTimestamp ¶
FormatTimestamp formats a time into Unix timestamp in milliseconds, as requested by Binance.
func NewDeliveryClient ¶
NewDeliveryClient initialize client for coin-M futures API
func NewFuturesClient ¶
NewFuturesClient initialize client for futures API
Types ¶
type AllAssetService ¶
type AllAssetService struct {
// contains filtered or unexported fields
}
AllAssetService all asset servcie
func (*AllAssetService) Do ¶
func (s *AllAssetService) Do(ctx context.Context, opts ...RequestOption) (res *AllAsset, err error)
Do send request
type AssetAll ¶
type AssetAll struct { ID string `json:"id"` AssetCode string `json:"assetCode"` AssetName string `json:"assetName"` Unit string `json:"unit"` CommissionRate float64 `json:"commissionRate"` FreeAuditWithdrawAmt float64 `json:"freeAuditWithdrawAmt"` FreeUserChargeAmount float64 `json:"freeUserChargeAmount"` CreateTime int64 `json:"createTime"` Test int `json:"test"` Gas any `json:"gas"` IsLegalMoney bool `json:"isLegalMoney"` ReconciliationAmount float64 `json:"reconciliationAmount"` SeqNum string `json:"seqNum"` ChineseName string `json:"chineseName"` CnLink string `json:"cnLink"` EnLink string `json:"enLink"` LogoURL string `json:"logoUrl"` FullLogoURL string `json:"fullLogoUrl"` SupportMarket any `json:"supportMarket"` FeeReferenceAsset any `json:"feeReferenceAsset"` FeeRate any `json:"feeRate"` FeeDigit int `json:"feeDigit"` AssetDigit int `json:"assetDigit"` Trading bool `json:"trading"` Tags []string `json:"tags"` PlateType string `json:"plateType"` Etf bool `json:"etf"` IsLedgerOnly bool `json:"isLedgerOnly"` Delisted bool `json:"delisted"` PreDelist bool `json:"preDelist"` PdTradeDeadline any `json:"pdTradeDeadline"` PdDepositDeadline any `json:"pdDepositDeadline"` PdAnnounceURL any `json:"pdAnnounceUrl"` TagBits string `json:"tagBits"` }
func (*AssetAll) GetAssetCode ¶
type AssetConfig ¶
type Client ¶
type Client struct { BaseURL string UserAgent string HTTPClient *http.Client Debug bool Logger *log.Logger TimeOffset int64 // contains filtered or unexported fields }
Client define API client
func NewClient ¶
func NewClient() *Client
NewClient initialize an API client instance with API key and secret key. You should always call this function before using this SDK. Services will be created by the form client.NewXXXService().
func NewProxiedClient ¶
NewProxiedClient passing a proxy url
func (*Client) NewAllAssetService ¶
func (c *Client) NewAllAssetService() *AllAssetService
NewAllAssetService get all asset
func (*Client) NewConfigService ¶
func (c *Client) NewConfigService() *ConfigService
NewConfigService get all asset
func (*Client) NewCountriesService ¶
func (c *Client) NewCountriesService() *CountriesService
NewCountriesService get all asset
func (*Client) NewCurrencyPairService ¶
func (c *Client) NewCurrencyPairService() *CurrencyPairService
NewCurrencyPairService get all asset
func (*Client) NewFiatListService ¶
func (c *Client) NewFiatListService() *FiatListService
NewFiatListService get all asset
func (*Client) NewFilterConditionsService ¶
func (c *Client) NewFilterConditionsService() *FilterConditionsService
NewFilterConditionsService get all asset
func (*Client) NewSearchService ¶
func (c *Client) NewSearchService() *SearchService
SearchService get all asset
func (*Client) SetApiEndpoint ¶
SetApiEndpoint set api Endpoint
type Config ¶
type Config struct { Code string `json:"code"` Message any `json:"message"` MessageDetail any `json:"messageDetail"` Data ConfigData `json:"data"` Success bool `json:"success"` }
type ConfigArea ¶
type ConfigData ¶
type ConfigData struct { Fiat string `json:"fiat"` Areas []ConfigArea `json:"areas"` FilterDefaultValues FilterDefaultValue `json:"filterDefaultValues"` }
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
ConfigService all asset servcie
func (*ConfigService) Do ¶
func (s *ConfigService) Do(ctx context.Context, opts ...RequestOption) (res *Config, err error)
Do send request
func (*ConfigService) SetFiat ¶
func (s *ConfigService) SetFiat(fiat string) *ConfigService
Fiat sets the fiat parameter.
type ConvertAsset ¶
type CountriesService ¶
type CountriesService struct {
// contains filtered or unexported fields
}
CountriesService all asset servcie
func (*CountriesService) Do ¶
func (s *CountriesService) Do(ctx context.Context, opts ...RequestOption) (res *Countries, err error)
Do send request
type Country ¶
type Country struct { Code string `json:"code"` Code2 string `json:"code2"` En string `json:"en"` Cn string `json:"cn"` MobileCode string `json:"mobileCode"` CountryImageURL any `json:"countryImageUrl"` BizType any `json:"bizType"` }
func (*Country) GetCountryCode ¶
type CurrencyPair ¶
type CurrencyPairService ¶
type CurrencyPairService struct {
// contains filtered or unexported fields
}
CurrencyPairService all asset servcie
func (*CurrencyPairService) Do ¶
func (s *CurrencyPairService) Do(ctx context.Context, opts ...RequestOption) (res *CurrencyPair, err error)
Do send request
type Fiat ¶
type FiatListService ¶
type FiatListService struct {
// contains filtered or unexported fields
}
FiatListService all asset servcie
func (*FiatListService) Do ¶
func (s *FiatListService) Do(ctx context.Context, opts ...RequestOption) (res *FiatList, err error)
Do send request
type FilterConditions ¶
type FilterConditions struct { Code string `json:"code"` Message any `json:"message"` MessageDetail any `json:"messageDetail"` Data FilterData `json:"data"` Success bool `json:"success"` }
type FilterConditionsService ¶
type FilterConditionsService struct {
// contains filtered or unexported fields
}
FilterConditionsService all asset servcie
func (*FilterConditionsService) Do ¶
func (s *FilterConditionsService) Do(ctx context.Context, opts ...RequestOption) (res *FilterConditions, err error)
Do send request
func (*FilterConditionsService) Fiat ¶
func (s *FilterConditionsService) Fiat(fiat string) *FilterConditionsService
Fiat sets the fiat parameter.
type FilterCountry ¶
type FilterData ¶
type FilterData struct { Countries []FilterCountry `json:"countries"` TradeMethods []FilterTradeMethod `json:"tradeMethods"` PreferredCountry string `json:"preferredCountry"` }
type FilterDefaultValue ¶
type FilterDefaultValue struct {
PublisherType string `json:"publisherType"`
}
type FilterTradeMethod ¶
type FilterTradeMethod struct { ID any `json:"id"` PayMethodID string `json:"payMethodId"` PayAccount any `json:"payAccount"` PayBank any `json:"payBank"` PaySubBank any `json:"paySubBank"` PayType any `json:"payType"` Identifier string `json:"identifier"` IconURLColor string `json:"iconUrlColor"` TradeMethodName string `json:"tradeMethodName"` TradeMethodShortName string `json:"tradeMethodShortName"` TradeMethodBgColor string `json:"tradeMethodBgColor"` }
type RequestOption ¶
type RequestOption func(*request)
RequestOption define option type for request
func WithHeader ¶
func WithHeader(key, value string, replace bool) RequestOption
WithHeader set or add a header value to the request
func WithHeaders ¶
func WithHeaders(header http.Header) RequestOption
WithHeaders set or replace the headers of the request
func WithRecvWindow ¶
func WithRecvWindow(recvWindow int64) RequestOption
WithRecvWindow set recvWindow param for the request
type SearchAdv ¶
type SearchAdv struct { AdvNo string `json:"advNo"` Classify string `json:"classify"` TradeType string `json:"tradeType"` Asset string `json:"asset"` FiatUnit string `json:"fiatUnit"` AdvStatus any `json:"advStatus"` PriceType any `json:"priceType"` PriceFloatingRatio any `json:"priceFloatingRatio"` RateFloatingRatio any `json:"rateFloatingRatio"` CurrencyRate any `json:"currencyRate"` Price string `json:"price"` InitAmount any `json:"initAmount"` SurplusAmount string `json:"surplusAmount"` AmountAfterEditing any `json:"amountAfterEditing"` MaxSingleTransAmount string `json:"maxSingleTransAmount"` MinSingleTransAmount string `json:"minSingleTransAmount"` BuyerKycLimit any `json:"buyerKycLimit"` BuyerRegDaysLimit any `json:"buyerRegDaysLimit"` BuyerBtcPositionLimit any `json:"buyerBtcPositionLimit"` Remarks any `json:"remarks"` AutoReplyMsg string `json:"autoReplyMsg"` PayTimeLimit int `json:"payTimeLimit"` TradeMethods []SearchTradeMethod `json:"tradeMethods"` UserTradeCountFilterTime any `json:"userTradeCountFilterTime"` UserBuyTradeCountMin any `json:"userBuyTradeCountMin"` UserBuyTradeCountMax any `json:"userBuyTradeCountMax"` UserSellTradeCountMin any `json:"userSellTradeCountMin"` UserSellTradeCountMax any `json:"userSellTradeCountMax"` UserAllTradeCountMin any `json:"userAllTradeCountMin"` UserAllTradeCountMax any `json:"userAllTradeCountMax"` UserTradeCompleteRateFilterTime any `json:"userTradeCompleteRateFilterTime"` UserTradeCompleteCountMin any `json:"userTradeCompleteCountMin"` UserTradeCompleteRateMin any `json:"userTradeCompleteRateMin"` UserTradeVolumeFilterTime any `json:"userTradeVolumeFilterTime"` UserTradeType any `json:"userTradeType"` UserTradeVolumeMin any `json:"userTradeVolumeMin"` UserTradeVolumeMax any `json:"userTradeVolumeMax"` UserTradeVolumeAsset any `json:"userTradeVolumeAsset"` CreateTime any `json:"createTime"` AdvUpdateTime any `json:"advUpdateTime"` FiatVo any `json:"fiatVo"` AssetVo any `json:"assetVo"` AdvVisibleRet any `json:"advVisibleRet"` AssetLogo any `json:"assetLogo"` AssetScale int `json:"assetScale"` FiatScale int `json:"fiatScale"` PriceScale int `json:"priceScale"` FiatSymbol string `json:"fiatSymbol"` IsTradable bool `json:"isTradable"` DynamicMaxSingleTransAmount string `json:"dynamicMaxSingleTransAmount"` MinSingleTransQuantity string `json:"minSingleTransQuantity"` MaxSingleTransQuantity string `json:"maxSingleTransQuantity"` DynamicMaxSingleTransQuantity string `json:"dynamicMaxSingleTransQuantity"` TradableQuantity string `json:"tradableQuantity"` CommissionRate string `json:"commissionRate"` TradeMethodCommissionRates []any `json:"tradeMethodCommissionRates"` LaunchCountry any `json:"launchCountry"` AbnormalStatusList any `json:"abnormalStatusList"` CloseReason any `json:"closeReason"` StoreInformation any `json:"storeInformation"` }
type SearchAdvertiser ¶
type SearchAdvertiser struct { UserNo string `json:"userNo"` RealName any `json:"realName"` NickName string `json:"nickName"` Margin any `json:"margin"` MarginUnit any `json:"marginUnit"` OrderCount any `json:"orderCount"` MonthOrderCount int `json:"monthOrderCount"` MonthFinishRate float64 `json:"monthFinishRate"` PositiveRate float64 `json:"positiveRate"` AdvConfirmTime any `json:"advConfirmTime"` Email any `json:"email"` RegistrationTime any `json:"registrationTime"` Mobile any `json:"mobile"` UserType string `json:"userType"` TagIconUrls []any `json:"tagIconUrls"` UserGrade int `json:"userGrade"` UserIdentity string `json:"userIdentity"` ProMerchant any `json:"proMerchant"` IsBlocked any `json:"isBlocked"` ActiveTimeInSecond int `json:"activeTimeInSecond"` }
type SearchData ¶
type SearchData struct { Adv SearchAdv `json:"adv"` Advertiser SearchAdvertiser `json:"advertiser"` }
type SearchService ¶
type SearchService struct {
// contains filtered or unexported fields
}
SearchService all asset servcie
func (*SearchService) Do ¶
func (s *SearchService) Do(ctx context.Context, opts ...RequestOption) (res *Search, err error)
Do send request
func (*SearchService) SetAmount ¶
func (s *SearchService) SetAmount(amount int) *SearchService
func (*SearchService) SetCountry ¶
func (s *SearchService) SetCountry(contry []string) *SearchService
func (*SearchService) SetPageSize ¶
func (s *SearchService) SetPageSize(page int, row int) *SearchService
func (*SearchService) SetSearch ¶
func (s *SearchService) SetSearch(fiat string, asset string, tradeType TradeType, payTypes []string) *SearchService
type SearchTradeMethod ¶
type SearchTradeMethod struct { PayID any `json:"payId"` PayMethodID string `json:"payMethodId"` PayType any `json:"payType"` PayAccount any `json:"payAccount"` PayBank any `json:"payBank"` PaySubBank any `json:"paySubBank"` Identifier string `json:"identifier"` IconURLColor any `json:"iconUrlColor"` TradeMethodName string `json:"tradeMethodName"` TradeMethodShortName string `json:"tradeMethodShortName"` TradeMethodBgColor string `json:"tradeMethodBgColor"` }
type TradeMethod ¶
type TradeMethod struct {
Identifier string `json:"identifier"`
}
type TradeSide ¶
type TradeSide struct { Side string `json:"side"` Assets []AssetConfig `json:"assets"` ConvertAssets []ConvertAsset `json:"convertAssets"` TradeMethods []TradeMethod `json:"tradeMethods"` }