api

package
v0.0.0-...-8eea3e4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://api.binance.us"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountResponse

type AccountResponse struct {
	MakerCommission            int             `json:"makerCommission"`
	TakerCommission            int             `json:"takerCommission"`
	BuyerCommission            int             `json:"buyerCommission"`
	SellerCommission           int             `json:"sellerCommission"`
	CommissionRates            CommissionRates `json:"commissionRates"`
	CanTrade                   bool            `json:"canTrade"`
	CanWithdraw                bool            `json:"canWithdraw"`
	CanDeposit                 bool            `json:"canDeposit"`
	Brokered                   bool            `json:"brokered"`
	RequireSelfTradePrevention bool            `json:"requireSelfTradePrevention"`
	UpdateTime                 int64           `json:"updateTime"`
	AccountType                AccountType     `json:"accountType"`
	Balances                   []Balance       `json:"balances"`
	Permissions                []string        `json:"permissions"`
}

type AccountType

type AccountType string
const (
	AccountTypeSpot AccountType = "SPOT"
)

type AssetConfig

type AssetConfig struct {
	Coin              oc.SymbolId     `json:"coin"`
	DepositAllEnable  bool            `json:"depositAllEnable"`
	WithdrawAllEnable bool            `json:"withdrawAllEnable"`
	Name              string          `json:"name"`
	Free              oc.Amount       `json:"free"`
	Locked            oc.Amount       `json:"locked"`
	Freeze            oc.Amount       `json:"freeze"`
	Withdrawing       oc.Amount       `json:"withdrawing"`
	Ipoing            oc.Amount       `json:"ipoing"`
	Ipoable           oc.Amount       `json:"ipoable"`
	Storage           oc.Amount       `json:"storage"`
	IsLegalMoney      bool            `json:"isLegalMoney"`
	Trading           bool            `json:"trading"`
	NetworkList       []NetworkConfig `json:"networkList"`
}

type Balance

type Balance struct {
	Asset  oc.SymbolId `json:"asset"`
	Free   oc.Amount   `json:"free"`
	Locked oc.Amount   `json:"locked"`
}

type Client

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

func NewClient

func NewClient(apiKey, secretKey string) *Client

func (*Client) GetCryptoWithdrawalHistory

func (c *Client) GetCryptoWithdrawalHistory(args *GetCryptoWithdrawalHistoryRequest) ([]CryptoWithdrawalRecord, error)

GetCryptoWithdrawalHistory retrieves crypto withdrawal history

func (*Client) GetFiatWithdrawalHistory

func (c *Client) GetFiatWithdrawalHistory(args *FiatWithdrawalHistoryRequest) (*FiatWithdrawalHistoryResponse, error)

GetFiatWithdrawalHistory retrieves fiat withdrawal history

func (*Client) Request

func (c *Client) Request(method, path string, body interface{}, output interface{}, query url.Values) ([]byte, error)

func (*Client) SubAccountTransfer

func (c *Client) SubAccountTransfer(args *SubAccountTransferRequest) (*SubAccountTransferResponse, error)

SubAccountTransfer executes an asset transfer between the master account and a sub-account https://docs.binance.us/#execute-sub-account-transfer

type CommissionRates

type CommissionRates struct {
	Maker  string `json:"maker"`
	Taker  string `json:"taker"`
	Buyer  string `json:"buyer"`
	Seller string `json:"seller"`
}

type CryptoWithdrawalRecord

type CryptoWithdrawalRecord struct {
	Id             string               `json:"id"`
	Amount         oc.Amount            `json:"amount"`
	TransactionFee oc.Amount            `json:"transactionFee"`
	Coin           oc.SymbolId          `json:"coin"`
	Status         WithdrawalStatus     `json:"status"`
	Address        oc.Address           `json:"address"`
	ApplyTime      string               `json:"applyTime"`
	Network        oc.NetworkId         `json:"network"`
	TransferType   int                  `json:"transferType"`
	TxId           client.TransactionId `json:"txId"`
}

type DepositAddressResponse

type DepositAddressResponse struct {
	Coin    oc.SymbolId `json:"coin"`
	Address oc.Address  `json:"address"`
	Tag     string      `json:"tag"`
	URL     string      `json:"url"`
}

type FiatWithdrawalHistoryRequest

type FiatWithdrawalHistoryRequest struct {
	FiatCurrency   string `json:"fiatCurrency,omitempty"`
	OrderId        string `json:"orderId,omitempty"`
	Offset         *int   `json:"offset,omitempty"`
	PaymentChannel string `json:"paymentChannel,omitempty"`
	PaymentMethod  string `json:"paymentMethod,omitempty"`
	StartTime      *int64 `json:"startTime,omitempty"`
	EndTime        *int64 `json:"endTime,omitempty"`
	RecvWindow     *int64 `json:"recvWindow,omitempty"`
}

type FiatWithdrawalHistoryResponse

type FiatWithdrawalHistoryResponse struct {
	AssetLogRecordList []FiatWithdrawalRecord `json:"assetLogRecordList"`
}

type FiatWithdrawalRecord

type FiatWithdrawalRecord struct {
	OrderId        string `json:"orderId"`
	PaymentAccount string `json:"paymentAccount"`
	PaymentChannel string `json:"paymentChannel"`
	PaymentMethod  string `json:"paymentMethod"`
	OrderStatus    string `json:"orderStatus"`
	Amount         string `json:"amount"`
	TransactionFee string `json:"transactionFee"`
	PlatformFee    string `json:"platformFee"`
}

type GetAccountRequest

type GetAccountRequest struct {
	RecvWindow      *int64 `json:"recvWindow,omitempty"`
	TimestampMillis int64  `json:"timestamp,omitempty"`
}

type GetAssetConfigRequest

type GetAssetConfigRequest struct {
	RecvWindow      *int64 `json:"recvWindow,omitempty"`
	TimestampMillis int64  `json:"timestamp,omitempty"`
}

type GetCryptoWithdrawalHistoryRequest

type GetCryptoWithdrawalHistoryRequest struct {
	Coin            *oc.SymbolId      `json:"coin,omitempty"`
	WithdrawOrderId string            `json:"withdrawOrderId,omitempty"`
	Status          *WithdrawalStatus `json:"status,omitempty"`
	StartTime       *int64            `json:"startTime,omitempty"`
	EndTime         *int64            `json:"endTime,omitempty"`
	Offset          *int              `json:"offset,omitempty"`
	Limit           *int              `json:"limit,omitempty"`
	RecvWindow      *int64            `json:"recvWindow,omitempty"`
	TimestampMillis int64             `json:"timestamp,omitempty"`
}

type GetDepositAddressRequest

type GetDepositAddressRequest struct {
	Coin            oc.SymbolId  `json:"coin"`
	Network         oc.NetworkId `json:"network,omitempty"`
	RecvWindow      *int64       `json:"recvWindow,omitempty"`
	TimestampMillis int64        `json:"timestamp,omitempty"`
}

type NetworkConfig

type NetworkConfig struct {
	Network                 oc.NetworkId `json:"network"`
	Coin                    oc.SymbolId  `json:"coin"`
	WithdrawIntegerMultiple string       `json:"withdrawIntegerMultiple"`
	IsDefault               bool         `json:"isDefault"`
	DepositEnable           bool         `json:"depositEnable"`
	WithdrawEnable          bool         `json:"withdrawEnable"`
	DepositDesc             string       `json:"depositDesc"`
	WithdrawDesc            string       `json:"withdrawDesc"`
	Name                    string       `json:"name"`
	ResetAddressStatus      bool         `json:"resetAddressStatus"`
	AddressRegex            string       `json:"addressRegex,omitempty"`
	MemoRegex               string       `json:"memoRegex,omitempty"`
	WithdrawFee             string       `json:"withdrawFee"`
	WithdrawMin             string       `json:"withdrawMin"`
	WithdrawMax             string       `json:"withdrawMax"`
	MinConfirm              int          `json:"minConfirm,omitempty"`
	UnLockConfirm           int          `json:"unLockConfirm,omitempty"`
	SpecialTips             string       `json:"specialTips,omitempty"`
}

type SubAccountTransferRequest

type SubAccountTransferRequest struct {
	FromEmail       string      `json:"fromEmail"`
	ToEmail         string      `json:"toEmail"`
	Asset           oc.SymbolId `json:"asset"`
	Amount          oc.Amount   `json:"amount"`
	TimestampMillis int64       `json:"timestamp,omitempty"`
}

type SubAccountTransferResponse

type SubAccountTransferResponse struct {
	Msg     string `json:"msg"`
	Success bool   `json:"success"`
	TxnId   string `json:"txnId"`
}

type WithdrawRequest

type WithdrawRequest struct {
	Coin            oc.SymbolId  `json:"coin"`
	Network         oc.NetworkId `json:"network"`
	WithdrawOrderId string       `json:"withdrawOrderId,omitempty"`
	Address         oc.Address   `json:"address"`
	AddressTag      string       `json:"addressTag,omitempty"`
	Amount          oc.Amount    `json:"amount"`
	RecvWindow      *int64       `json:"recvWindow,omitempty"`
	TimestampMillis int64        `json:"timestamp,omitempty"`
}

type WithdrawResponse

type WithdrawResponse struct {
	Id string `json:"id"`
}

type WithdrawalStatus

type WithdrawalStatus int
const (
	WithdrawalStatusEmailSent        WithdrawalStatus = 0
	WithdrawalStatusCanceled         WithdrawalStatus = 1
	WithdrawalStatusAwaitingApproval WithdrawalStatus = 2
	WithdrawalStatusRejected         WithdrawalStatus = 3
	WithdrawalStatusProcessing       WithdrawalStatus = 4
	WithdrawalStatusFailure          WithdrawalStatus = 5
	WithdrawalStatusCompleted        WithdrawalStatus = 6
)

func (WithdrawalStatus) String

func (s WithdrawalStatus) String() string

Jump to

Keyboard shortcuts

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