convert

package
v1.11.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignRequest

func SignRequest(
	params *go_http.RequestParams,
	apiKey string,
	secretKey string,
) (*go_http.RequestParams, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(
	logger i_logger.ILogger,
	apiKey string,
	secretKey string,
) *Client

func (*Client) GetQuote

func (t *Client) GetQuote(params *GetQuoteParamType) (*GetQuoteResultType, error)

api key 不可用,需要额外向币安申请权限

func (*Client) SupportedPairs

func (t *Client) SupportedPairs(params *SupportedPairsParamType) ([]*SupportedPairsResultType, error)

type GetQuoteParamType

type GetQuoteParamType struct {
	FromAsset  string  `json:"fromAsset"`            // 必填
	ToAsset    string  `json:"toAsset"`              // 必填
	FromAmount float64 `json:"fromAmount,omitempty"` // 成交后将被扣除的金额
	ToAmount   float64 `json:"toAmount,omitempty"`   // 成交后将会获得的金额
	WalletType string  `json:"walletType,omitempty"` // 选择支付钱包,可支持的钱包的选择有SPOT,FUNDING和EARN。组合钱包选择也可支持,如SPOT_FUNDING,FUNDING_EARN,SPOT_FUNDING_EARN或者SPOT_EARN。默认选择为SPOT
}

fromAmount 或者 toAmount 只需要提供其中一个

type GetQuoteResultType

type GetQuoteResultType struct {
	QuoteID        string  `json:"quoteId"` // quoteId 仅在账户余额充足时返回
	Ratio          float64 `json:"ratio,string"`
	InverseRatio   float64 `json:"inverseRatio,string"`
	ValidTimestamp int64   `json:"validTimestamp"`
	ToAmount       float64 `json:"toAmount,string"`
	FromAmount     float64 `json:"fromAmount,string"`
}

type SupportedPairsParamType

type SupportedPairsParamType struct {
	FromAsset string `json:"fromAsset"`
	ToAsset   string `json:"toAsset"`
}

用户应当 fromAsset 和 toAsset 参数至少填一个

type SupportedPairsResultType

type SupportedPairsResultType struct {
	FromAsset       string  `json:"fromAsset"`
	ToAsset         string  `json:"toAsset"`
	FromAssetMinAmt float64 `json:"fromAssetMinAmount,string"`
	FromAssetMaxAmt float64 `json:"fromAssetMaxAmount,string"`
	ToAssetMinAmt   float64 `json:"toAssetMinAmount,string"`
	ToAssetMaxAmt   float64 `json:"toAssetMaxAmount,string"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL