Documentation ¶
Index ¶
- Variables
- func FormatTimestamp(t time.Time) int64
- type ChangeApiPermissionRequest
- type ChangeApiPermissionResponse
- type ChangeSubAccountCommissionRequest
- type ChangeSubAccountCommissionResponse
- type Client
- func (c *Client) ChangeSubAccountApiPermission(ctx context.Context, req ChangeApiPermissionRequest, opts ...RequestOption) (res *ChangeApiPermissionResponse, err error)
- func (c *Client) ChangeSubAccountCommission(ctx context.Context, req ChangeSubAccountCommissionRequest, ...) (res *ChangeSubAccountCommissionResponse, err error)
- func (c *Client) CreateApiKeyForSub(ctx context.Context, req CreateApiKeyRequest, opts ...RequestOption) (res *CreateApiKeyResponse, err error)
- func (c *Client) CreateSubAccount(ctx context.Context, opts ...RequestOption) (res *SubAccount, err error)
- func (c *Client) DeleteSubApiKey(ctx context.Context, req DeleteSubApiKeyRequest, opts ...RequestOption) error
- func (c *Client) EnableFuturesSubAccount(ctx context.Context, subAccountId int, opts ...RequestOption) (res *EnableFuturesToSubAccountResponse, err error)
- func (c *Client) EnableMarginSubAccount(ctx context.Context, subAccountId int, opts ...RequestOption) (res *EnableFuturesToSubAccountResponse, err error)
- func (c *Client) SubAccountTransfer(ctx context.Context, req SubAccountTransferRequest, opts ...RequestOption) (res *SubAccountTransferResponse, err error)
- func (c *Client) TransferHistory(ctx context.Context, req SubAccountTransferHistoryRequest, ...) (transfers []*Transfer, err error)
- type CreateApiKeyRequest
- type CreateApiKeyResponse
- type DeleteSubApiKeyRequest
- type EnableFuturesToSubAccountResponse
- type EnableMarginToSubAccountResponse
- type RequestOption
- type SubAccount
- type SubAccountTransferHistoryRequest
- type SubAccountTransferRequest
- type SubAccountTransferResponse
- type Transfer
- type TransferHistoryResponse
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.
Types ¶
type ChangeApiPermissionRequest ¶
type ChangeApiPermissionRequest struct { SubAccountID string `json:"subaccountId"` SubAccountApiKey string `json:"subAccountApiKey"` CatTrade bool `json:"catTrade"` MarginTrade bool `json:"marginTrade"` FuturesTrade bool `json:"futuresTrade"` }
ChangeApiPermissionRequest is a request struct
type ChangeApiPermissionResponse ¶
type ChangeApiPermissionResponse struct { SubAccountID string `json:"subaccountId"` ApiKey string `json:"apiKey"` CatTrade bool `json:"catTrade"` MarginTrade bool `json:"marginTrade"` FuturesTrade bool `json:"futuresTrade"` }
ChangeApiPermissionResponse is a response struct
type ChangeSubAccountCommissionResponse ¶
type ChangeSubAccountCommissionResponse struct { SubAccountID string `json:"subaccountId"` MakerCommission float32 `json:"makerCommission"` TakerCommission float32 `json:"takerCommission"` MarginMakerCommission float32 `json:"marginMakerCommission"` TakerMakerCommission float32 `json:"marginTakerCommission"` }
ChangeSubAccountCommissionResponse is response struct
type Client ¶
type Client struct { HTTPClient *http.Client BaseURL string TimeOffset int64 Logger *log.Logger Debug bool // contains filtered or unexported fields }
func (*Client) ChangeSubAccountApiPermission ¶
func (c *Client) ChangeSubAccountApiPermission(ctx context.Context, req ChangeApiPermissionRequest, opts ...RequestOption) (res *ChangeApiPermissionResponse, err error)
ChangeSubAccountApiPermission make request
func (*Client) ChangeSubAccountCommission ¶
func (c *Client) ChangeSubAccountCommission(ctx context.Context, req ChangeSubAccountCommissionRequest, opts ...RequestOption) (res *ChangeSubAccountCommissionResponse, err error)
ChangeSubAccountCommission make request
func (*Client) CreateApiKeyForSub ¶
func (c *Client) CreateApiKeyForSub(ctx context.Context, req CreateApiKeyRequest, opts ...RequestOption) (res *CreateApiKeyResponse, err error)
CreateApiKeyForSub make request
func (*Client) CreateSubAccount ¶
func (c *Client) CreateSubAccount(ctx context.Context, opts ...RequestOption) (res *SubAccount, err error)
CreateSubAccount creates new sub account
func (*Client) DeleteSubApiKey ¶
func (c *Client) DeleteSubApiKey(ctx context.Context, req DeleteSubApiKeyRequest, opts ...RequestOption) error
DeleteSubApiKey deletes sub account api key
func (*Client) EnableFuturesSubAccount ¶
func (c *Client) EnableFuturesSubAccount(ctx context.Context, subAccountId int, opts ...RequestOption) (res *EnableFuturesToSubAccountResponse, err error)
EnableFuturesSubAccount make request
func (*Client) EnableMarginSubAccount ¶
func (c *Client) EnableMarginSubAccount(ctx context.Context, subAccountId int, opts ...RequestOption) (res *EnableFuturesToSubAccountResponse, err error)
EnableMarginSubAccount make request
func (*Client) SubAccountTransfer ¶
func (c *Client) SubAccountTransfer(ctx context.Context, req SubAccountTransferRequest, opts ...RequestOption) (res *SubAccountTransferResponse, err error)
SubAccountTransfer makes request
func (*Client) TransferHistory ¶ added in v2.2.8
func (c *Client) TransferHistory(ctx context.Context, req SubAccountTransferHistoryRequest, opts ...RequestOption) (transfers []*Transfer, err error)
TransferHistory makes request
type CreateApiKeyRequest ¶
type CreateApiKeyRequest struct { SubAccountID string CanTrade bool MarginTrade bool FuturesTrade bool }
CreateApiKeyRequest is a request struct
type CreateApiKeyResponse ¶
type CreateApiKeyResponse struct { SubAccountID string `json:"subaccountId"` ApiKey string `json:"apiKey"` SecretKey string `json:"secretKey"` CatTrade bool `json:"catTrade"` MarginTrade bool `json:"marginTrade"` FuturesTrade bool `json:"futuresTrade"` }
CreateApiKeyResponse is response struct
type DeleteSubApiKeyRequest ¶
DeleteSubApiKeyRequest is a request struct
type EnableFuturesToSubAccountResponse ¶
type EnableFuturesToSubAccountResponse struct { SubAccountID string `json:"subaccountId"` EnableFutures bool `json:"enableFutures"` UpdateTime int64 `json:"updateTime"` }
EnableFuturesToSubAccountResponse is response struct
type EnableMarginToSubAccountResponse ¶
type EnableMarginToSubAccountResponse struct { SubAccountID string `json:"subaccountId"` EnableMargin bool `json:"enableMargin"` UpdateTime int64 `json:"updateTime"` }
EnableMarginToSubAccountResponse is response struct
type RequestOption ¶
type RequestOption func(*request)
RequestOption define option type for request
func WithRecvWindow ¶
func WithRecvWindow(recvWindow int64) RequestOption
WithRecvWindow set recvWindow param for the request
type SubAccount ¶
type SubAccount struct { SubAccountID string `json:"subaccountId"` Email string `json:"email"` Tag string `json:"tag"` }
SubAccount represent sub account entity
type SubAccountTransferHistoryRequest ¶ added in v2.2.8
type SubAccountTransferHistoryRequest struct { FromID string ToID string ClientTransferID string ShowAllStatus bool StartTime int64 EndTime int64 Page int Limit int }
SubAccountTransferHistoryRequest is a request struct
type SubAccountTransferRequest ¶
type SubAccountTransferRequest struct { FromID string ToID string ClientTransferID string Asset string Amount float64 }
SubAccountTransferRequest is a request struct
type SubAccountTransferResponse ¶
type SubAccountTransferResponse struct { TxnID string `json:"txnId"` ClientTranID string `json:"clientTranId"` }
SubAccountTransferResponse is a response struct
type Transfer ¶ added in v2.2.8
type Transfer struct { FromId string `json:"fromId"` ToId string `json:"toId"` Asset string `json:"asset"` Qty string `json:"qty"` Time int64 `json:"time"` TxnId string `json:"txnId"` ClientTranId string `json:"clientTranId"` Status string `json:"status"` }
Transfer is a transfer struct
type TransferHistoryResponse ¶ added in v2.2.8
type TransferHistoryResponse []*Transfer
TransferHistoryResponse is transfer history response