Documentation
¶
Index ¶
- Constants
- func S2M(i interface{}) map[string]string
- type AccountClient
- type AccountDetail
- type AddressVerification
- type BaseClient
- type Client
- type ClientOption
- type ClientOptions
- type CreateSpotOrderRequest
- type CreateSpotOrderResponse
- type CreateWithdrawalRequest
- type CreateWithdrawalResponse
- type CurrencyChain
- type CurrencyDetails
- type CurrencyPair
- type DepositAddress
- type ErrorResponse
- type GetAccountDetailResponse
- type GetCurrencyChainsSupportedRequest
- type GetCurrencySupportedChainResponse
- type GetDepositAddressRequest
- type GetDepositAddressResponse
- type GetSpotAccountBalancesRequest
- type GetSpotAccountBalancesResponse
- type GetSpotCurrenciesResponse
- type GetSpotCurrencyResponse
- type GetSpotOrderResponse
- type GetSpotSupportedCurrencyPairResponse
- type GetSpotSupportedCurrencyPairsResponse
- type GetTickersInfoRequest
- type GetTickersInfoResponse
- type GetWalletSavedAddressesRequest
- type GetWalletSavedAddressesResponse
- type GetWithdrawalHistoryRequest
- type GetWithdrawalHistoryResponse
- type GetWithdrawalRulesRequest
- type GetWithdrawalRulesResponse
- type IGateAccount
- type IGateClient
- type IGateSpot
- type IGateWallet
- type ISigner
- type OrderFinishedAs
- type OrderSide
- type OrderStatus
- type OrderType
- type PairTradeStatus
- type SavedAddress
- type Signer
- type SpotAccountBalance
- type SpotClient
- func (o *SpotClient) CreateSpotOrder(ctx context.Context, dto *CreateSpotOrderRequest) (*CreateSpotOrderResponse, error)
- func (o *SpotClient) GetSpotAccountBalances(ctx context.Context, dto *GetSpotAccountBalancesRequest) (*GetSpotAccountBalancesResponse, error)
- func (o *SpotClient) GetSpotCurrencies(ctx context.Context) (*GetSpotCurrenciesResponse, error)
- func (o *SpotClient) GetSpotCurrency(ctx context.Context, currency string) (*GetSpotCurrencyResponse, error)
- func (o *SpotClient) GetSpotOrder(ctx context.Context, orderID string) (*GetSpotOrderResponse, error)
- func (o *SpotClient) GetSpotSupportedCurrencyPair(ctx context.Context, currencyPair string) (*GetSpotSupportedCurrencyPairResponse, error)
- func (o *SpotClient) GetSpotSupportedCurrencyPairs(ctx context.Context) (*GetSpotSupportedCurrencyPairsResponse, error)
- func (o *SpotClient) GetTickersInfo(ctx context.Context, dto *GetTickersInfoRequest) (*GetTickersInfoResponse, error)
- type SpotOrder
- type TickerInfo
- type WalletClient
- func (o *WalletClient) CreateWithdrawal(ctx context.Context, dto *CreateWithdrawalRequest) (*CreateWithdrawalResponse, error)
- func (o *WalletClient) GetCurrencyChainsSupported(ctx context.Context, dto *GetCurrencyChainsSupportedRequest) (*GetCurrencySupportedChainResponse, error)
- func (o *WalletClient) GetDepositAddress(ctx context.Context, dto *GetDepositAddressRequest) (*GetDepositAddressResponse, error)
- func (o *WalletClient) GetWalletSavedAddresses(ctx context.Context, dto *GetWalletSavedAddressesRequest) (*GetWalletSavedAddressesResponse, error)
- func (o *WalletClient) GetWithdrawalHistory(ctx context.Context, dto *GetWithdrawalHistoryRequest) (*GetWithdrawalHistoryResponse, error)
- func (o *WalletClient) GetWithdrawalRules(ctx context.Context, dto *GetWithdrawalRulesRequest) (*GetWithdrawalRulesResponse, error)
- type Withdrawal
- type WithdrawalHistory
- type WithdrawalRule
- type WithdrawalStatus
Constants ¶
View Source
const ( GateTimestamp = "Timestamp" GateKey = "KEY" GateSign = "SIGN" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountClient ¶
type AccountClient struct {
// contains filtered or unexported fields
}
func NewAccountClient ¶
func NewAccountClient(opt *ClientOptions, store limiter.Store, opts ...ClientOption) *AccountClient
func (*AccountClient) GetAccountDetail ¶
func (o *AccountClient) GetAccountDetail(ctx context.Context) (*GetAccountDetailResponse, error)
type AccountDetail ¶
type AddressVerification ¶
type AddressVerification string
const ( AddressVerificationNone AddressVerification = "0" AddressVerificationDone AddressVerification = "1" )
func (AddressVerification) IsVerified ¶
func (o AddressVerification) IsVerified() bool
func (AddressVerification) String ¶
func (o AddressVerification) String() string
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
func NewBaseClient ¶
func NewBaseClient(opt *ClientOptions, store limiter.Store, opts ...ClientOption) (*BaseClient, error)
func (*BaseClient) Account ¶
func (o *BaseClient) Account() IGateAccount
func (*BaseClient) Spot ¶
func (o *BaseClient) Spot() IGateSpot
func (*BaseClient) Wallet ¶
func (o *BaseClient) Wallet() IGateWallet
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opt *ClientOptions, store limiter.Store, opts ...ClientOption) *Client
type ClientOption ¶ added in v0.9.9
type ClientOption func(c *Client)
func WithLogger ¶ added in v0.9.9
func WithLogger(log logger.Logger) ClientOption
type ClientOptions ¶
type CreateSpotOrderRequest ¶
type CreateSpotOrderRequest struct {
CurrencyPair string `json:"currency_pair"`
Type string `json:"type"` // "limit", "market", etc.
Side string `json:"side"` // "buy" or "sell"
Amount string `json:"amount"` // Amount to buy/sell
TimeInForce string `json:"time_in_force"`
}
buy means quote currency, BTC_USDT means USDT sell means base currency,BTC_USDT means BTC
type CreateSpotOrderResponse ¶
type CreateSpotOrderResponse struct {
Data *SpotOrder `json:"data"`
}
type CreateWithdrawalRequest ¶
type CreateWithdrawalResponse ¶
type CreateWithdrawalResponse struct {
Data *Withdrawal `json:"data"`
}
type CurrencyChain ¶
type CurrencyChain struct {
Chain string `json:"chain"`
NameEn string `json:"name_en"`
ContractAddress string `json:"contract_address,omitempty"`
IsDisabled int `json:"is_disabled"`
IsDepositDisabled int `json:"is_deposit_disabled"`
IsWithdrawDisabled int `json:"is_withdraw_disabled"`
Decimal int64 `json:"decimal,string"`
}
type CurrencyDetails ¶
type CurrencyDetails struct {
Currency string `json:"currency"`
Name string `json:"name"`
Delisted bool `json:"delisted"`
WithdrawDisabled bool `json:"withdraw_disabled"`
WithdrawDelayed bool `json:"withdraw_delayed"`
DepositDisabled bool `json:"deposit_disabled"`
TradeDisabled bool `json:"trade_disabled"`
Chain string `json:"chain"`
Chains []struct {
Name string `json:"name"`
Addr string `json:"addr,omitempty"`
WithdrawDisabled bool `json:"withdraw_disabled"`
WithdrawDelayed bool `json:"withdraw_delayed"`
DepositDisabled bool `json:"deposit_disabled"`
} `json:"chains"`
}
type CurrencyPair ¶
type CurrencyPair struct {
ID string `json:"id"`
Base string `json:"base"`
BaseName string `json:"base_name"`
Quote string `json:"quote"`
QuoteName string `json:"quote_name"`
Fee string `json:"fee"`
MinBaseAmount string `json:"min_base_amount"`
MinQuoteAmount string `json:"min_quote_amount"`
MaxBaseAmount string `json:"max_base_amount"`
MaxQuoteAmount string `json:"max_quote_amount"`
AmountPrecision int `json:"amount_precision"`
Precision int `json:"precision"`
TradeStatus string `json:"trade_status"`
SellStart int `json:"sell_start"`
BuyStart int `json:"buy_start"`
DelistingTime int `json:"delisting_time"`
TradeURL string `json:"trade_url"`
}
type DepositAddress ¶
type DepositAddress struct {
Currency string `json:"currency"`
Address string `json:"address"`
MultichainAddresses []struct {
Chain string `json:"chain"`
Address string `json:"address"`
PaymentID string `json:"payment_id"`
PaymentName string `json:"payment_name"`
ObtainFailed int `json:"obtain_failed"`
} `json:"multichain_addresses"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Label string `json:"label"` // Error code
Message string `json:"message"` // Error message
}
ErrorResponse represents gate.io API error response
type GetAccountDetailResponse ¶
type GetAccountDetailResponse struct {
Data *AccountDetail `json:"data"`
}
type GetCurrencyChainsSupportedRequest ¶
type GetCurrencyChainsSupportedRequest struct {
Currency string `json:"currency"`
}
type GetCurrencySupportedChainResponse ¶
type GetCurrencySupportedChainResponse struct {
Data []*CurrencyChain `json:"data"`
}
type GetDepositAddressRequest ¶
type GetDepositAddressRequest struct {
Currency string `json:"currency"`
}
type GetDepositAddressResponse ¶
type GetDepositAddressResponse struct {
Data *DepositAddress `json:"data"`
}
type GetSpotAccountBalancesRequest ¶
type GetSpotAccountBalancesRequest struct {
Currency string `json:"currency,omitempty"`
}
type GetSpotAccountBalancesResponse ¶
type GetSpotAccountBalancesResponse struct {
Data []*SpotAccountBalance `json:"data"`
}
type GetSpotCurrenciesResponse ¶
type GetSpotCurrenciesResponse struct {
Data []*CurrencyDetails `json:"data"`
}
type GetSpotCurrencyResponse ¶
type GetSpotCurrencyResponse struct {
Data *CurrencyDetails `json:"data"`
}
type GetSpotOrderResponse ¶
type GetSpotOrderResponse struct {
Data *SpotOrder `json:"data"`
}
type GetSpotSupportedCurrencyPairResponse ¶
type GetSpotSupportedCurrencyPairResponse struct {
Data *CurrencyPair `json:"data"`
}
type GetSpotSupportedCurrencyPairsResponse ¶
type GetSpotSupportedCurrencyPairsResponse struct {
Data []*CurrencyPair `json:"data"`
}
type GetTickersInfoRequest ¶
type GetTickersInfoRequest struct {
CurrencyPair string `json:"currency_pair,omitempty"`
}
type GetTickersInfoResponse ¶
type GetTickersInfoResponse struct {
Data []*TickerInfo `json:"data"`
}
type GetWalletSavedAddressesResponse ¶
type GetWalletSavedAddressesResponse struct {
Data []*SavedAddress `json:"data"`
}
type GetWithdrawalHistoryRequest ¶
type GetWithdrawalHistoryRequest struct {
Currency string `json:"currency,omitempty" url:"currency,omitempty"`
WithdrawalID string `json:"withdrawal_id,omitempty" url:"withdrawal_id,omitempty"`
AssetClass string `json:"asset_class,omitempty" url:"asset_class,omitempty"`
WithdrawOrderID string `json:"withdraw_order_id,omitempty" url:"withdraw_order_id,omitempty"`
From string `json:"from,omitempty" url:"from,omitempty"`
To string `json:"to,omitempty" url:"to,omitempty"`
Limit string `json:"limit,omitempty" url:"limit,omitempty"`
Offset string `json:"offset,omitempty" url:"offset,omitempty"`
}
type GetWithdrawalHistoryResponse ¶
type GetWithdrawalHistoryResponse struct {
Data []*WithdrawalHistory `json:"data"`
}
type GetWithdrawalRulesRequest ¶
type GetWithdrawalRulesRequest struct {
Currency string `json:"currency,omitempty" url:"currency,omitempty"`
}
type GetWithdrawalRulesResponse ¶
type GetWithdrawalRulesResponse struct {
Data []*WithdrawalRule `json:"data"`
}
type IGateAccount ¶
type IGateAccount interface {
GetAccountDetail(context.Context) (*GetAccountDetailResponse, error)
}
type IGateClient ¶
type IGateClient interface {
Wallet() IGateWallet
}
type IGateSpot ¶
type IGateSpot interface {
GetSpotCurrencies(ctx context.Context) (*GetSpotCurrenciesResponse, error)
GetSpotCurrency(ctx context.Context, currency string) (*GetSpotCurrencyResponse, error)
GetSpotSupportedCurrencyPairs(ctx context.Context) (*GetSpotSupportedCurrencyPairsResponse, error)
GetSpotSupportedCurrencyPair(ctx context.Context, currencyPair string) (*GetSpotSupportedCurrencyPairResponse, error)
GetTickersInfo(ctx context.Context, dto *GetTickersInfoRequest) (*GetTickersInfoResponse, error)
GetSpotAccountBalances(ctx context.Context, dto *GetSpotAccountBalancesRequest) (*GetSpotAccountBalancesResponse, error)
CreateSpotOrder(ctx context.Context, dto *CreateSpotOrderRequest) (*CreateSpotOrderResponse, error)
GetSpotOrder(ctx context.Context, orderID string) (*GetSpotOrderResponse, error)
}
type IGateWallet ¶
type IGateWallet interface {
GetCurrencyChainsSupported(context.Context, *GetCurrencyChainsSupportedRequest) (*GetCurrencySupportedChainResponse, error)
GetDepositAddress(ctx context.Context, dto *GetDepositAddressRequest) (*GetDepositAddressResponse, error)
GetWithdrawalHistory(ctx context.Context, dto *GetWithdrawalHistoryRequest) (*GetWithdrawalHistoryResponse, error)
GetWithdrawalRules(ctx context.Context, dto *GetWithdrawalRulesRequest) (*GetWithdrawalRulesResponse, error)
CreateWithdrawal(ctx context.Context, dto *CreateWithdrawalRequest) (*CreateWithdrawalResponse, error)
GetWalletSavedAddresses(ctx context.Context, dto *GetWalletSavedAddressesRequest) (*GetWalletSavedAddressesResponse, error)
}
type ISigner ¶
type OrderFinishedAs ¶
type OrderFinishedAs string
const ( OrderFinishedAsOpen OrderFinishedAs = "open" OrderFinishedAsFilled OrderFinishedAs = "filled" OrderFinishedAsCancelled OrderFinishedAs = "cancelled" OrderFinishedAsLiquidateCancelled OrderFinishedAs = "liquidate_cancelled" OrderFinishedAsSmall OrderFinishedAs = "small" OrderFinishedAsDepthNotEnough OrderFinishedAs = "depth_not_enough" OrderFinishedAsTraderNotEnough OrderFinishedAs = "trader_not_enough" OrderFinishedAsIOC OrderFinishedAs = "ioc" OrderFinishedAsPOC OrderFinishedAs = "poc" OrderFinishedAsFOK OrderFinishedAs = "fok" OrderFinishedAsSTP OrderFinishedAs = "stp" OrderFinishedAsUnknown OrderFinishedAs = "unknown" )
func (OrderFinishedAs) IsFailed ¶
func (o OrderFinishedAs) IsFailed() bool
TODO: Does not take into account IOC, POC, FOK, STP
func (OrderFinishedAs) String ¶
func (o OrderFinishedAs) String() string
type OrderStatus ¶
type OrderStatus string
const ( OrderStatusOpen OrderStatus = "open" OrderStatusClosed OrderStatus = "closed" OrderStatusCanceled OrderStatus = "cancelled" )
func (OrderStatus) String ¶
func (o OrderStatus) String() string
type PairTradeStatus ¶
type PairTradeStatus string
const ( PairTradeStatusUntradable PairTradeStatus = "untradable" PairTradeStatusTradable PairTradeStatus = "tradable" PairTradeStatusBuyable PairTradeStatus = "buyable" PairTradeStatusSellable PairTradeStatus = "sellable" )
func (PairTradeStatus) IsTradable ¶
func (o PairTradeStatus) IsTradable() bool
func (PairTradeStatus) String ¶
func (o PairTradeStatus) String() string
type SavedAddress ¶
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
func (*Signer) GetTimestamp ¶
type SpotAccountBalance ¶
type SpotClient ¶
type SpotClient struct {
// contains filtered or unexported fields
}
func NewSpotClient ¶
func NewSpotClient(opt *ClientOptions, store limiter.Store, opts ...ClientOption) *SpotClient
func (*SpotClient) CreateSpotOrder ¶
func (o *SpotClient) CreateSpotOrder(ctx context.Context, dto *CreateSpotOrderRequest) (*CreateSpotOrderResponse, error)
func (*SpotClient) GetSpotAccountBalances ¶
func (o *SpotClient) GetSpotAccountBalances(ctx context.Context, dto *GetSpotAccountBalancesRequest) (*GetSpotAccountBalancesResponse, error)
func (*SpotClient) GetSpotCurrencies ¶
func (o *SpotClient) GetSpotCurrencies(ctx context.Context) (*GetSpotCurrenciesResponse, error)
func (*SpotClient) GetSpotCurrency ¶
func (o *SpotClient) GetSpotCurrency(ctx context.Context, currency string) (*GetSpotCurrencyResponse, error)
func (*SpotClient) GetSpotOrder ¶
func (o *SpotClient) GetSpotOrder(ctx context.Context, orderID string) (*GetSpotOrderResponse, error)
func (*SpotClient) GetSpotSupportedCurrencyPair ¶
func (o *SpotClient) GetSpotSupportedCurrencyPair(ctx context.Context, currencyPair string) (*GetSpotSupportedCurrencyPairResponse, error)
func (*SpotClient) GetSpotSupportedCurrencyPairs ¶
func (o *SpotClient) GetSpotSupportedCurrencyPairs(ctx context.Context) (*GetSpotSupportedCurrencyPairsResponse, error)
func (*SpotClient) GetTickersInfo ¶
func (o *SpotClient) GetTickersInfo(ctx context.Context, dto *GetTickersInfoRequest) (*GetTickersInfoResponse, error)
type SpotOrder ¶
type SpotOrder struct {
ID string `json:"id"`
Text string `json:"text,omitempty"`
AmendText string `json:"amend_text,omitempty"`
CreateTimeMs int64 `json:"create_time_ms"`
UpdateTimeMs int64 `json:"update_time_ms"`
Status OrderStatus `json:"status"`
CurrencyPair string `json:"currency_pair"`
Type OrderType `json:"type"`
Account string `json:"account"`
Side OrderSide `json:"side"`
Amount string `json:"amount"`
Fee string `json:"fee"`
FeeCurrency string `json:"fee_currency"`
FinishAs OrderFinishedAs `json:"finish_as"`
}
type TickerInfo ¶
type WalletClient ¶
type WalletClient struct {
// contains filtered or unexported fields
}
func NewWalletClient ¶
func NewWalletClient(opt *ClientOptions, store limiter.Store, opts ...ClientOption) *WalletClient
func (*WalletClient) CreateWithdrawal ¶
func (o *WalletClient) CreateWithdrawal(ctx context.Context, dto *CreateWithdrawalRequest) (*CreateWithdrawalResponse, error)
func (*WalletClient) GetCurrencyChainsSupported ¶
func (o *WalletClient) GetCurrencyChainsSupported(ctx context.Context, dto *GetCurrencyChainsSupportedRequest) (*GetCurrencySupportedChainResponse, error)
func (*WalletClient) GetDepositAddress ¶
func (o *WalletClient) GetDepositAddress(ctx context.Context, dto *GetDepositAddressRequest) (*GetDepositAddressResponse, error)
func (*WalletClient) GetWalletSavedAddresses ¶
func (o *WalletClient) GetWalletSavedAddresses(ctx context.Context, dto *GetWalletSavedAddressesRequest) (*GetWalletSavedAddressesResponse, error)
func (*WalletClient) GetWithdrawalHistory ¶
func (o *WalletClient) GetWithdrawalHistory(ctx context.Context, dto *GetWithdrawalHistoryRequest) (*GetWithdrawalHistoryResponse, error)
func (*WalletClient) GetWithdrawalRules ¶
func (o *WalletClient) GetWithdrawalRules(ctx context.Context, dto *GetWithdrawalRulesRequest) (*GetWithdrawalRulesResponse, error)
type Withdrawal ¶
type Withdrawal struct {
ID string `json:"id"`
Timestamp string `json:"timestamp"`
WithdrawOrderID string `json:"withdraw_order_id"`
Currency string `json:"currency"`
Address string `json:"address"`
Txid string `json:"txid"`
Amount string `json:"amount"`
Memo string `json:"memo,omitempty"`
Status WithdrawalStatus `json:"status"`
Chain string `json:"chain"`
}
type WithdrawalHistory ¶
type WithdrawalHistory struct {
ID string `json:"id"`
Currency string `json:"currency"`
Address string `json:"address"`
Amount decimal.Decimal `json:"amount"`
Fee decimal.Decimal `json:"fee"`
Txid string `json:"txid"`
Chain string `json:"chain"`
Status WithdrawalStatus `json:"status"`
WithdrawOrderID string `json:"withdraw_order_id,omitempty"`
BlockNumber string `json:"block_number"`
FailReason string `json:"fail_reason,omitempty"`
}
type WithdrawalRule ¶
type WithdrawalRule struct {
Currency string `json:"currency"`
Deposit decimal.Decimal `json:"deposit"`
WithdrawPercent string `json:"withdraw_percent"`
WithdrawFix decimal.Decimal `json:"withdraw_fix"`
WithdrawDayLimit decimal.Decimal `json:"withdraw_day_limit"`
WithdrawDayLimitRemain decimal.Decimal `json:"withdraw_day_limit_remain"`
WithdrawAmountMini decimal.Decimal `json:"withdraw_amount_mini"`
WithdrawEachtimeLimit decimal.Decimal `json:"withdraw_eachtime_limit"`
WithdrawFixOnChains map[string]decimal.Decimal `json:"withdraw_fix_on_chains"`
}
type WithdrawalStatus ¶
type WithdrawalStatus string
const ( WithdrawalStatusDone WithdrawalStatus = "DONE" WithdrawalStatusCancel WithdrawalStatus = "CANCEL" WithdrawalStatusRequest WithdrawalStatus = "REQUEST" WithdrawalStatusManual WithdrawalStatus = "MANUAL" WithdrawalStatusBcode WithdrawalStatus = "BCODE" WithdrawalStatusExtpend WithdrawalStatus = "EXTPEND" WithdrawalStatusFail WithdrawalStatus = "FAIL" WithdrawalStatusInvalid WithdrawalStatus = "INVALID" WithdrawalStatusVerify WithdrawalStatus = "VERIFY" WithdrawalStatusProces WithdrawalStatus = "PROCES" //nolint:misspell WithdrawalStatusPend WithdrawalStatus = "PEND" WithdrawalStatusDmove WithdrawalStatus = "DMOVE" WithdrawalStatusReview WithdrawalStatus = "REVIEW" )
func (WithdrawalStatus) String ¶
func (o WithdrawalStatus) String() string
Click to show internal directories.
Click to hide internal directories.