Documentation
¶
Index ¶
- type AccountTransferRequest
- type AccountTransferResponse
- type AccountTransferResult
- type AccountTransferType
- type AddressExtras
- type BalanceInfo
- type BalanceResponse
- type Client
- func (c *Client) FundsTransfer(args *AccountTransferRequest) (*AccountTransferResponse, error)
- func (c *Client) GetBalance(account client.GetBalanceArgs) (*BalanceResponse, error)
- func (c *Client) GetCurrencies() (*GetCurrenciesResponse, error)
- func (c *Client) GetDepositAddress(coin oc.SymbolId) (*GetDepositAddressResponse, error)
- func (c *Client) GetWithdrawalHistory(args *WithdrawalHistoryRequest) (*WithdrawalHistoryResponse, error)
- func (c *Client) Request(method, path string, input interface{}, output interface{}, query url.Values) ([]byte, error)
- func (c *Client) SetBaseURL(baseURL string)
- func (c *Client) SubaccountTransfer(args *SubaccountTransferRequest) (*SubaccountTransferResponse, error)
- func (c *Client) Withdrawal(args *WithdrawalRequest) (*WithdrawalResponse, error)
- type CurrencyInfo
- type DepositAddressData
- type GetCurrenciesResponse
- type GetDepositAddressResponse
- type Response
- type SubaccountTransferRequest
- type SubaccountTransferResponse
- type SubaccountTransferResult
- type SymbolAndChain
- type WithdrawalHistoryRequest
- type WithdrawalHistoryResponse
- type WithdrawalRecord
- type WithdrawalRequest
- type WithdrawalResponse
- type WithdrawalResult
- type WithdrawalState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountTransferRequest ¶
type AccountTransferRequest struct {
Currency oc.SymbolId `json:"ccy"`
Amount oc.Amount `json:"amt"`
From oc.AccountType `json:"from"`
To oc.AccountType `json:"to"`
Type AccountTransferType `json:"type"`
SubAccount *oc.AccountId `json:"subAcct,omitempty"`
}
type AccountTransferResponse ¶
type AccountTransferResponse Response[[]AccountTransferResult]
type AccountTransferResult ¶
type AccountTransferType ¶
type AccountTransferType string
const ( SameAccount AccountTransferType = "0" MainToSub AccountTransferType = "1" SubToMainUsingMain AccountTransferType = "2" SubToMainUsingSub AccountTransferType = "3" SubToSubUsingSub AccountTransferType = "4" )
type AddressExtras ¶
type BalanceInfo ¶
type BalanceResponse ¶
type BalanceResponse = Response[[]BalanceInfo]
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) FundsTransfer ¶
func (c *Client) FundsTransfer(args *AccountTransferRequest) (*AccountTransferResponse, error)
https://www.okx.com/docs-v5/en/#funding-account-rest-api-funds-transfer
func (*Client) GetBalance ¶
func (c *Client) GetBalance(account client.GetBalanceArgs) (*BalanceResponse, error)
https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
func (*Client) GetCurrencies ¶
func (c *Client) GetCurrencies() (*GetCurrenciesResponse, error)
https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-currencies
func (*Client) GetDepositAddress ¶
func (c *Client) GetDepositAddress(coin oc.SymbolId) (*GetDepositAddressResponse, error)
https://www.okx.com/docs-v5/en/#funding-account-rest-api-asset-bills-details
func (*Client) GetWithdrawalHistory ¶
func (c *Client) GetWithdrawalHistory(args *WithdrawalHistoryRequest) (*WithdrawalHistoryResponse, error)
https://www.okx.com/docs-v5/en/#funding-account-rest-api-cancel-withdrawal
func (*Client) Request ¶
func (c *Client) Request(method, path string, input interface{}, output interface{}, query url.Values) ([]byte, error)
Request makes an authenticated HTTP request to the OKX API
func (*Client) SetBaseURL ¶
func (*Client) SubaccountTransfer ¶
func (c *Client) SubaccountTransfer(args *SubaccountTransferRequest) (*SubaccountTransferResponse, error)
Rate limit: 1 request per second https://www.okx.com/docs-v5/en/#sub-account-rest-api-get-history-of-managed-sub-account-transfer
func (*Client) Withdrawal ¶
func (c *Client) Withdrawal(args *WithdrawalRequest) (*WithdrawalResponse, error)
https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
type CurrencyInfo ¶
type CurrencyInfo struct {
BurningFeeRate string `json:"burningFeeRate"`
CanDep bool `json:"canDep"`
CanInternal bool `json:"canInternal"`
CanWd bool `json:"canWd"`
Currency oc.SymbolId `json:"ccy"`
Chain SymbolAndChain `json:"chain"`
ContractAddress rebal.ContractAddress `json:"ctAddr"`
DepEstOpenTime string `json:"depEstOpenTime"`
DepQuotaFixed string `json:"depQuotaFixed"`
DepQuoteDailyLayer2 string `json:"depQuoteDailyLayer2"`
Fee string `json:"fee"`
LogoLink string `json:"logoLink"`
MainNet bool `json:"mainNet"`
MaxFee string `json:"maxFee"`
MaxFeeForCtAddr string `json:"maxFeeForCtAddr"`
MaxWithdraw string `json:"maxWd"`
MinDeposit string `json:"minDep"`
MinDepArrivalConfirm string `json:"minDepArrivalConfirm"`
MinFee string `json:"minFee"`
MinFeeForCtAddr string `json:"minFeeForCtAddr"`
MinInternal string `json:"minInternal"`
MinWithdraw string `json:"minWd"`
MinWdUnlockConfirm string `json:"minWdUnlockConfirm"`
Name string `json:"name"`
NeedTag bool `json:"needTag"`
UsedDepQuotaFixed string `json:"usedDepQuotaFixed"`
UsedWdQuota string `json:"usedWdQuota"`
WdEstOpenTime string `json:"wdEstOpenTime"`
WithdrawQuota string `json:"wdQuota"`
WithdrawTickSize string `json:"wdTickSz"`
}
type DepositAddressData ¶
type DepositAddressData struct {
// E.g. "BTC-Bitcoin", "SOL-Solana"
SymbolAndChain SymbolAndChain `json:"chain"`
ContractAddr string `json:"ctAddr"`
Currency string `json:"ccy"`
To string `json:"to"`
Address string `json:"addr"`
VerifiedName string `json:"verifiedName"`
Selected bool `json:"selected"`
}
type GetCurrenciesResponse ¶
type GetCurrenciesResponse = Response[[]CurrencyInfo]
type GetDepositAddressResponse ¶
type GetDepositAddressResponse = Response[[]DepositAddressData]
type SubaccountTransferRequest ¶
type SubaccountTransferRequest struct {
Currency oc.SymbolId `json:"ccy"`
Amount oc.Amount `json:"amt"`
From oc.AccountType `json:"from"`
To oc.AccountType `json:"to"`
FromSubAccount oc.AccountId `json:"fromSubAccount"`
ToSubAccount oc.AccountId `json:"toSubAccount"`
LoanTrans *bool `json:"loanTrans,omitempty"`
OmitPosRisk *string `json:"omitPosRisk,omitempty"`
}
type SubaccountTransferResponse ¶
type SubaccountTransferResponse Response[[]SubaccountTransferResult]
type SubaccountTransferResult ¶
type SubaccountTransferResult struct {
TransferID string `json:"transId,omitempty"`
}
type SymbolAndChain ¶
type SymbolAndChain string
func NewSymbolAndChain ¶
func NewSymbolAndChain(symbol oc.SymbolId, network oc.NetworkId) SymbolAndChain
func (SymbolAndChain) NetworkId ¶
func (s SymbolAndChain) NetworkId() oc.NetworkId
func (SymbolAndChain) Split ¶
func (s SymbolAndChain) Split() (oc.SymbolId, oc.NetworkId)
OKX reports the chain with the symbol included, e.g. "BTC-Bitcoin", or "ETH-Ethereum"
func (SymbolAndChain) SymbolId ¶
func (s SymbolAndChain) SymbolId() oc.SymbolId
type WithdrawalHistoryRequest ¶
type WithdrawalHistoryRequest struct {
Currency *oc.SymbolId `json:"ccy,omitempty"`
WdId string `json:"wdId,omitempty"`
ClientId string `json:"clientId,omitempty"`
TxId string `json:"txId,omitempty"`
Type string `json:"type,omitempty"`
State string `json:"state,omitempty"`
After int64 `json:"after,omitempty"`
Before int64 `json:"before,omitempty"`
Limit int `json:"limit,omitempty"`
}
type WithdrawalHistoryResponse ¶
type WithdrawalHistoryResponse = Response[[]WithdrawalRecord]
type WithdrawalRecord ¶
type WithdrawalRecord struct {
Currency oc.SymbolId `json:"ccy"`
Chain SymbolAndChain `json:"chain"`
NonTradableAsset bool `json:"nonTradableAsset"`
Amount oc.Amount `json:"amt"`
Timestamp string `json:"ts"`
From string `json:"from"`
AreaCodeFrom string `json:"areaCodeFrom"`
To string `json:"to"`
AreaCodeTo string `json:"areaCodeTo"`
Tag string `json:"tag,omitempty"`
PaymentId string `json:"pmtId,omitempty"`
Memo string `json:"memo,omitempty"`
AddressExtras AddressExtras `json:"addrEx,omitempty"`
TxId client.TransactionId `json:"txId"`
Fee oc.Amount `json:"fee"`
FeeCurrency oc.SymbolId `json:"feeCcy"`
State WithdrawalState `json:"state"`
WithdrawalId string `json:"wdId"`
ClientId string `json:"clientId"`
Note string `json:"note"`
}
type WithdrawalRequest ¶
type WithdrawalResponse ¶
type WithdrawalResponse Response[[]WithdrawalResult]
type WithdrawalResult ¶
type WithdrawalResult struct {
WithdrawalID string `json:"wdId,omitempty"`
Currency string `json:"ccy,omitempty"`
Chain string `json:"chain,omitempty"`
Amount string `json:"amt,omitempty"`
ToAddress string `json:"toAddr,omitempty"`
TxID string `json:"txId,omitempty"`
State string `json:"state,omitempty"`
}
type WithdrawalState ¶
type WithdrawalState string
const ( WithdrawalStateCanceled WithdrawalState = "-2" WithdrawalStateFailed WithdrawalState = "-1" WithdrawalStateWaitingWithdrawal WithdrawalState = "0" WithdrawalStateBroadcasting WithdrawalState = "1" WithdrawalStateSuccess WithdrawalState = "2" )