okexapi

package
v1.62.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: AGPL-3.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MarginModeIsolated = "isolated"
	MarginModeCross    = "cross"
)
View Source
const (
	LiquidityTypeMaker = "M"
	LiquidityTypeTaker = "T"
)
View Source
const PrivateWebSocketURL = "wss://ws.okx.com:8443/ws/v5/private"
View Source
const PublicBusinessWebSocketURL = "wss://ws.okx.com:8443/ws/v5/business"
View Source
const PublicWebSocketURL = "wss://ws.okx.com:8443/ws/v5/public"
View Source
const RestBaseURL = "https://www.okx.com"

Variables

View Source
var GetAccountInterestLimitsRequestLimiter = rate.NewLimiter(10, 1)
View Source
var GetAccountLeverageInfoRequestLimiter = rate.NewLimiter(10, 1)
View Source
var GetAccountMaxLoanRequestLimiter = rate.NewLimiter(10, 1)
View Source
var GetMaxAvailableSizeRequestLimiter = rate.NewLimiter(10, 1)
View Source
var GetThreeDaysTransactionHistoryRequestLimiter = rate.NewLimiter(15.000000150000002, 1)
View Source
var GetTransactionHistoryRequestLimiter = rate.NewLimiter(2.5, 1)
View Source
var SpotManualBorrowRepayRequestLimiter = rate.NewLimiter(10, 1)

Functions

func Sign

func Sign(payload string, secret string) string

Types

type APIResponse added in v1.52.0

type APIResponse struct {
	Code    string          `json:"code"`
	Message string          `json:"msg"`
	Data    json.RawMessage `json:"data"`

	// InTime is the timestamp at REST gateway when the request is received, Unix timestamp format in microseconds, e.g. 1597026383085123
	InTime strint.Int64 `json:"inTime"`

	// OutTime is the timestamp at REST gateway when the response is sent, Unix timestamp format in microseconds, e.g. 1597026383085123
	OutTime strint.Int64 `json:"outTime"`
}

func (APIResponse) Error added in v1.57.0

func (a APIResponse) Error() error

func (APIResponse) Validate added in v1.57.0

func (a APIResponse) Validate() error

type Account

type Account struct {
	TotalEquityInUSD fixedpoint.Value           `json:"totalEq,omitempty"`
	AdjustEquity     fixedpoint.Value           `json:"adjEq,omitempty"`
	UpdateTime       types.MillisecondTimestamp `json:"uTime,omitempty"`
	MarginRatio      fixedpoint.Value           `json:"mgnRatio,omitempty"`
	NotionalUsd      fixedpoint.Value           `json:"notionalUsd,omitempty"`
	UnrealizedPnl    fixedpoint.Value           `json:"upl,omitempty"`
	Details          []BalanceDetail            `json:"details"`

	TotalInitialMargin          fixedpoint.Value `json:"imr,omitempty"`
	TotalMaintMargin            fixedpoint.Value `json:"mmr,omitempty"`
	TotalOpenOrderInitialMargin fixedpoint.Value `json:"ordFroz,omitempty"`
}

type AccountConfig added in v1.62.0

type AccountConfig struct {
	AccountLevel strint.Int64 `json:"acctLv"`

	AccountSelfTradePreventionMode string `json:"acctStpMode"`

	AutoLoan              bool         `json:"autoLoan"`
	ContractIsolationMode string       `json:"ctIsoMode"`
	EnableSpotBorrow      bool         `json:"enableSpotBorrow"`
	GreeksType            string       `json:"greeksType"`
	Ip                    string       `json:"ip"`
	Type                  string       `json:"type"`
	KycLv                 strint.Int64 `json:"kycLv"`
	Label                 string       `json:"label"`
	Level                 string       `json:"level"`
	LevelTmp              string       `json:"levelTmp"`

	LiquidationGear strint.Int64 `json:"liquidationGear"`

	MainUid             string        `json:"mainUid"`
	MarginIsoMode       string        `json:"mgnIsoMode"`
	OpAuth              string        `json:"opAuth"`
	Perm                string        `json:"perm"`
	PosMode             string        `json:"posMode"`
	RoleType            strint.Int64  `json:"roleType"`
	SpotBorrowAutoRepay bool          `json:"spotBorrowAutoRepay"`
	SpotOffsetType      string        `json:"spotOffsetType"`
	SpotRoleType        string        `json:"spotRoleType"`
	SpotTraderInsts     []interface{} `json:"spotTraderInsts"`
	TraderInsts         []interface{} `json:"traderInsts"`
	Uid                 string        `json:"uid"`
}

type AccountLevelResponse added in v1.62.0

type AccountLevelResponse struct {
	AcctLv string `json:"acctLv"`
}

type AccountRiskResponse added in v1.62.0

type AccountRiskResponse struct {
	AtRisk    bool          `json:"atRisk"`
	AtRiskIdx []interface{} `json:"atRiskIdx"`
	AtRiskMgn []interface{} `json:"atRiskMgn"`
	Ts        string        `json:"ts"`
}

type AssetBalance

type AssetBalance struct {
	Currency  string           `json:"ccy"`
	Balance   fixedpoint.Value `json:"bal"`
	Frozen    fixedpoint.Value `json:"frozenBal,omitempty"`
	Available fixedpoint.Value `json:"availBal,omitempty"`
}

type AssetBalanceList

type AssetBalanceList []AssetBalance

type AssetCurrency

type AssetCurrency struct {
	Currency               string           `json:"ccy"`
	Name                   string           `json:"name"`
	Chain                  string           `json:"chain"`
	CanDeposit             bool             `json:"canDep"`
	CanWithdraw            bool             `json:"canWd"`
	CanInternal            bool             `json:"canInternal"`
	MinWithdrawalFee       fixedpoint.Value `json:"minFee"`
	MaxWithdrawalFee       fixedpoint.Value `json:"maxFee"`
	MinWithdrawalThreshold fixedpoint.Value `json:"minWd"`
}

type AutoRepayResponse added in v1.62.0

type AutoRepayResponse struct {
	AutoRepay bool `json:"autoRepay"`
}

type BalanceDetail

type BalanceDetail struct {
	Available   fixedpoint.Value `json:"availBal"`
	AvailEquity fixedpoint.Value `json:"availEq"`

	// BorrowFrozen is Potential borrowing IMR of the account in USD
	BorrowFrozen      fixedpoint.Value `json:"borrowFroz"`
	CashBalance       fixedpoint.Value `json:"cashBal"`
	Currency          string           `json:"ccy"`
	CrossLiab         fixedpoint.Value `json:"crossLiab,omitempty"`
	DisEquity         fixedpoint.Value `json:"disEq,omitempty"`
	Equity            fixedpoint.Value `json:"eq,omitempty"`
	EquityInUSD       fixedpoint.Value `json:"eqUsd"`
	SmtSyncEquity     fixedpoint.Value `json:"smtSyncEq,omitempty"`
	SpotCopyTradingEq fixedpoint.Value `json:"spotCopyTradingEq,omitempty"`

	FixedBalance  fixedpoint.Value `json:"fixedBal"`
	FrozenBalance fixedpoint.Value `json:"frozenBal"`

	Imr           string           `json:"imr,omitempty"`
	Interest      fixedpoint.Value `json:"interest"`
	IsoEquity     fixedpoint.Value `json:"isoEq,omitempty"`
	IsoLiability  fixedpoint.Value `json:"isoLiab,omitempty"`
	IsoUpl        fixedpoint.Value `json:"isoUpl,omitempty"`
	Liability     fixedpoint.Value `json:"liab,omitempty"`
	MaxLoan       fixedpoint.Value `json:"maxLoan,omitempty"`
	MgnRatio      fixedpoint.Value `json:"mgnRatio,omitempty"`
	Mmr           string           `json:"mmr,omitempty"`
	NotionalLever string           `json:"notionalLever"`

	// OrderFrozen is margin frozen for open orders
	OrderFrozen             fixedpoint.Value           `json:"ordFrozen"`
	RewardBal               fixedpoint.Value           `json:"rewardBal,omitempty"`
	SpotInUseAmt            fixedpoint.Value           `json:"spotInUseAmt,omitempty"`
	ClSpotInUseAmt          fixedpoint.Value           `json:"clSpotInUseAmt,omitempty"`
	MaxSpotInUse            fixedpoint.Value           `json:"maxSpotInUse,omitempty"`
	SpotIsoBal              fixedpoint.Value           `json:"spotIsoBal,omitempty"`
	StgyEquity              fixedpoint.Value           `json:"stgyEq"`
	Twap                    string                     `json:"twap,omitempty"`
	UpdateTime              types.MillisecondTimestamp `json:"uTime"`
	UnrealizedProfitAndLoss fixedpoint.Value           `json:"upl"`
	UplLiab                 fixedpoint.Value           `json:"uplLiab"`
	SpotBal                 fixedpoint.Value           `json:"spotBal"`
	OpenAvgPx               fixedpoint.Value           `json:"openAvgPx,omitempty"`
	AccAvgPx                fixedpoint.Value           `json:"accAvgPx,omitempty"`
	SpotUpl                 fixedpoint.Value           `json:"spotUpl,omitempty"`
	SpotUplRatio            fixedpoint.Value           `json:"spotUplRatio,omitempty"`
	TotalPnl                fixedpoint.Value           `json:"totalPnl,omitempty"`
	TotalPnlRatio           fixedpoint.Value           `json:"totalPnlRatio,omitempty"`
}

type BatchCancelOrderRequest

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

func (*BatchCancelOrderRequest) Add

func (*BatchCancelOrderRequest) Do

type BatchPlaceOrderRequest

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

func (*BatchPlaceOrderRequest) Add

func (*BatchPlaceOrderRequest) Do

type BorrowInterestLimit added in v1.62.0

type BorrowInterestLimit struct {
	Debt             fixedpoint.Value           `json:"debt"`
	Interest         fixedpoint.Value           `json:"interest"`
	LoanAlloc        fixedpoint.Value           `json:"loanAlloc"`
	NextDiscountTime types.MillisecondTimestamp `json:"nextDiscountTime"`
	NextInterestTime types.MillisecondTimestamp `json:"nextInterestTime"`
	Records          []struct {
		Currency string `json:"ccy"`

		// AvailableLoad = Available amount for current account (Within the locked quota)
		AvailLoan fixedpoint.Value `json:"availLoan"`
		AvgRate   fixedpoint.Value `json:"avgRate"`
		Interest  fixedpoint.Value `json:"interest"`

		// LoanQuota = Borrow limit of master account
		// If loan allocation has been assigned, then it is the borrow limit of the current trading account
		LoanQuota fixedpoint.Value `json:"loanQuota"`
		PosLoan   fixedpoint.Value `json:"posLoan"`
		Rate      fixedpoint.Value `json:"rate"`

		SurplusLimit        fixedpoint.Value `json:"surplusLmt"`
		SurplusLimitDetails struct {
			AllAcctRemainingQuota fixedpoint.Value `json:"allAcctRemainingQuota"`
			CurAcctRemainingQuota fixedpoint.Value `json:"curAcctRemainingQuota"`
			PlatRemainingQuota    fixedpoint.Value `json:"platRemainingQuota"`
		} `json:"surplusLmtDetails"`
		UsedLimit fixedpoint.Value `json:"usedLmt"`
		UsedLoan  fixedpoint.Value `json:"usedLoan"`
	} `json:"records"`
}

type CancelOrderRequest

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

func (*CancelOrderRequest) ClientOrderID

func (c *CancelOrderRequest) ClientOrderID(clientOrderID string) *CancelOrderRequest

func (*CancelOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*CancelOrderRequest) GetParameters added in v1.21.0

func (c *CancelOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelOrderRequest) GetParametersJSON added in v1.21.0

func (c *CancelOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelOrderRequest) GetParametersQuery added in v1.21.0

func (c *CancelOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelOrderRequest) GetPath added in v1.56.0

func (c *CancelOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*CancelOrderRequest) GetQueryParameters added in v1.56.0

func (c *CancelOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelOrderRequest) GetSlugParameters added in v1.56.0

func (c *CancelOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelOrderRequest) GetSlugsMap added in v1.56.0

func (c *CancelOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CancelOrderRequest) InstrumentID

func (c *CancelOrderRequest) InstrumentID(instrumentID string) *CancelOrderRequest

func (*CancelOrderRequest) OrderID

func (c *CancelOrderRequest) OrderID(orderID string) *CancelOrderRequest

type DepositRecord added in v1.62.0

type DepositRecord struct {
	ActualDepBlkConfirm strint.Int64     `json:"actualDepBlkConfirm"`
	Amount              fixedpoint.Value `json:"amt"`
	AreaCodeFrom        string           `json:"areaCodeFrom"`
	Currency            string           `json:"ccy"`
	Chain               string           `json:"chain"`
	DepId               string           `json:"depId"`
	From                string           `json:"from"`
	FromWdId            string           `json:"fromWdId"`
	State               strint.Int64     `json:"state"`
	To                  string           `json:"to"`

	Ts types.MillisecondTimestamp `json:"ts"`

	TxId string `json:"txId"`
}

type FundingRate

type FundingRate struct {
	InstrumentType  string                     `json:"instType"`
	InstrumentID    string                     `json:"instId"`
	FundingRate     fixedpoint.Value           `json:"fundingRate"`
	NextFundingRate fixedpoint.Value           `json:"nextFundingRate"`
	FundingTime     types.MillisecondTimestamp `json:"fundingTime"`
}

type GetAccountBalanceRequest added in v1.62.0

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

func (*GetAccountBalanceRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountBalanceRequest) GetParameters added in v1.62.0

func (g *GetAccountBalanceRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountBalanceRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountBalanceRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountBalanceRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountBalanceRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountBalanceRequest) GetPath added in v1.62.0

func (g *GetAccountBalanceRequest) GetPath() string

GetPath returns the request path of the API

func (*GetAccountBalanceRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountBalanceRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountBalanceRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountBalanceRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountBalanceRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountBalanceRequest) GetSlugsMap() (map[string]string, error)

type GetAccountConfigRequest added in v1.62.0

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

func (*GetAccountConfigRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountConfigRequest) GetParameters added in v1.62.0

func (g *GetAccountConfigRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountConfigRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountConfigRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountConfigRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountConfigRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountConfigRequest) GetPath added in v1.62.0

func (g *GetAccountConfigRequest) GetPath() string

GetPath returns the request path of the API

func (*GetAccountConfigRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountConfigRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountConfigRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountConfigRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountConfigRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountConfigRequest) GetSlugsMap() (map[string]string, error)

type GetAccountInterestLimitsRequest added in v1.62.0

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

func (*GetAccountInterestLimitsRequest) Currency added in v1.62.0

func (*GetAccountInterestLimitsRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountInterestLimitsRequest) GetParameters added in v1.62.0

func (g *GetAccountInterestLimitsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountInterestLimitsRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountInterestLimitsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountInterestLimitsRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountInterestLimitsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountInterestLimitsRequest) GetPath added in v1.62.0

GetPath returns the request path of the API

func (*GetAccountInterestLimitsRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountInterestLimitsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountInterestLimitsRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountInterestLimitsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountInterestLimitsRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountInterestLimitsRequest) GetSlugsMap() (map[string]string, error)

type GetAccountLeverageInfoRequest added in v1.62.0

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

func (*GetAccountLeverageInfoRequest) Currency added in v1.62.0

func (*GetAccountLeverageInfoRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountLeverageInfoRequest) GetParameters added in v1.62.0

func (g *GetAccountLeverageInfoRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountLeverageInfoRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountLeverageInfoRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountLeverageInfoRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountLeverageInfoRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountLeverageInfoRequest) GetPath added in v1.62.0

GetPath returns the request path of the API

func (*GetAccountLeverageInfoRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountLeverageInfoRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountLeverageInfoRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountLeverageInfoRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountLeverageInfoRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountLeverageInfoRequest) GetSlugsMap() (map[string]string, error)

func (*GetAccountLeverageInfoRequest) InstrumentId added in v1.62.0

func (*GetAccountLeverageInfoRequest) MarginMode added in v1.62.0

type GetAccountMaxLoanRequest added in v1.62.0

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

func (*GetAccountMaxLoanRequest) Currency added in v1.62.0

func (*GetAccountMaxLoanRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountMaxLoanRequest) GetParameters added in v1.62.0

func (g *GetAccountMaxLoanRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountMaxLoanRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountMaxLoanRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountMaxLoanRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountMaxLoanRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountMaxLoanRequest) GetPath added in v1.62.0

func (g *GetAccountMaxLoanRequest) GetPath() string

GetPath returns the request path of the API

func (*GetAccountMaxLoanRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountMaxLoanRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountMaxLoanRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountMaxLoanRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountMaxLoanRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountMaxLoanRequest) GetSlugsMap() (map[string]string, error)

func (*GetAccountMaxLoanRequest) InstrumentId added in v1.62.0

func (g *GetAccountMaxLoanRequest) InstrumentId(instrumentId string) *GetAccountMaxLoanRequest

func (*GetAccountMaxLoanRequest) MarginCurrency added in v1.62.0

func (g *GetAccountMaxLoanRequest) MarginCurrency(marginCurrency string) *GetAccountMaxLoanRequest

func (*GetAccountMaxLoanRequest) MarginMode added in v1.62.0

type GetAccountPositionRiskRequest added in v1.62.0

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

func (*GetAccountPositionRiskRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountPositionRiskRequest) GetParameters added in v1.62.0

func (g *GetAccountPositionRiskRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountPositionRiskRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountPositionRiskRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountPositionRiskRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountPositionRiskRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountPositionRiskRequest) GetPath added in v1.62.0

GetPath returns the request path of the API

func (*GetAccountPositionRiskRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountPositionRiskRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountPositionRiskRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountPositionRiskRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountPositionRiskRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountPositionRiskRequest) GetSlugsMap() (map[string]string, error)

func (*GetAccountPositionRiskRequest) InstType added in v1.62.0

type GetAccountPositionsRequest added in v1.62.0

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

func (*GetAccountPositionsRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountPositionsRequest) GetParameters added in v1.62.0

func (g *GetAccountPositionsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountPositionsRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountPositionsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountPositionsRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountPositionsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountPositionsRequest) GetPath added in v1.62.0

func (g *GetAccountPositionsRequest) GetPath() string

GetPath returns the request path of the API

func (*GetAccountPositionsRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountPositionsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountPositionsRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountPositionsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountPositionsRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountPositionsRequest) GetSlugsMap() (map[string]string, error)

func (*GetAccountPositionsRequest) InstType added in v1.62.0

type GetAccountRiskStateRequest added in v1.62.0

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

GetAccountRiskStateRequest gets the account risk state

Only applicable to Portfolio margin account

func (*GetAccountRiskStateRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountRiskStateRequest) GetParameters added in v1.62.0

func (g *GetAccountRiskStateRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountRiskStateRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountRiskStateRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountRiskStateRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountRiskStateRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountRiskStateRequest) GetPath added in v1.62.0

func (g *GetAccountRiskStateRequest) GetPath() string

GetPath returns the request path of the API

func (*GetAccountRiskStateRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountRiskStateRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountRiskStateRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountRiskStateRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountRiskStateRequest) GetSlugsMap added in v1.62.0

func (g *GetAccountRiskStateRequest) GetSlugsMap() (map[string]string, error)

type GetAccountSpotBorrowRepayHistoryRequest added in v1.62.0

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

func (*GetAccountSpotBorrowRepayHistoryRequest) After added in v1.62.0

func (*GetAccountSpotBorrowRepayHistoryRequest) Before added in v1.62.0

func (*GetAccountSpotBorrowRepayHistoryRequest) Currency added in v1.62.0

func (*GetAccountSpotBorrowRepayHistoryRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAccountSpotBorrowRepayHistoryRequest) EventType added in v1.62.0

func (*GetAccountSpotBorrowRepayHistoryRequest) GetParameters added in v1.62.0

func (g *GetAccountSpotBorrowRepayHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountSpotBorrowRepayHistoryRequest) GetParametersJSON added in v1.62.0

func (g *GetAccountSpotBorrowRepayHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountSpotBorrowRepayHistoryRequest) GetParametersQuery added in v1.62.0

func (g *GetAccountSpotBorrowRepayHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountSpotBorrowRepayHistoryRequest) GetPath added in v1.62.0

GetPath returns the request path of the API

func (*GetAccountSpotBorrowRepayHistoryRequest) GetQueryParameters added in v1.62.0

func (g *GetAccountSpotBorrowRepayHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountSpotBorrowRepayHistoryRequest) GetSlugParameters added in v1.62.0

func (g *GetAccountSpotBorrowRepayHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountSpotBorrowRepayHistoryRequest) GetSlugsMap added in v1.62.0

func (*GetAccountSpotBorrowRepayHistoryRequest) Limit added in v1.62.0

type GetAssetDepositHistoryRequest added in v1.62.0

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

func (*GetAssetDepositHistoryRequest) After added in v1.62.0

func (*GetAssetDepositHistoryRequest) Before added in v1.62.0

func (*GetAssetDepositHistoryRequest) Currency added in v1.62.0

func (*GetAssetDepositHistoryRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetAssetDepositHistoryRequest) GetParameters added in v1.62.0

func (g *GetAssetDepositHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAssetDepositHistoryRequest) GetParametersJSON added in v1.62.0

func (g *GetAssetDepositHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAssetDepositHistoryRequest) GetParametersQuery added in v1.62.0

func (g *GetAssetDepositHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAssetDepositHistoryRequest) GetPath added in v1.62.0

GetPath returns the request path of the API

func (*GetAssetDepositHistoryRequest) GetQueryParameters added in v1.62.0

func (g *GetAssetDepositHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAssetDepositHistoryRequest) GetSlugParameters added in v1.62.0

func (g *GetAssetDepositHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAssetDepositHistoryRequest) GetSlugsMap added in v1.62.0

func (g *GetAssetDepositHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetAssetDepositHistoryRequest) Limit added in v1.62.0

type GetCandlesRequest added in v1.57.0

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

func (*GetCandlesRequest) After added in v1.57.0

func (g *GetCandlesRequest) After(after time.Time) *GetCandlesRequest

func (*GetCandlesRequest) Bar added in v1.57.0

func (*GetCandlesRequest) Before added in v1.57.0

func (g *GetCandlesRequest) Before(before time.Time) *GetCandlesRequest

func (*GetCandlesRequest) Do added in v1.57.0

Do generates the request object and send the request object to the API endpoint

func (*GetCandlesRequest) GetParameters added in v1.57.0

func (g *GetCandlesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetCandlesRequest) GetParametersJSON added in v1.57.0

func (g *GetCandlesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetCandlesRequest) GetParametersQuery added in v1.57.0

func (g *GetCandlesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetCandlesRequest) GetPath added in v1.57.0

func (g *GetCandlesRequest) GetPath() string

GetPath returns the request path of the API

func (*GetCandlesRequest) GetQueryParameters added in v1.57.0

func (g *GetCandlesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetCandlesRequest) GetSlugParameters added in v1.57.0

func (g *GetCandlesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetCandlesRequest) GetSlugsMap added in v1.57.0

func (g *GetCandlesRequest) GetSlugsMap() (map[string]string, error)

func (*GetCandlesRequest) InstrumentID added in v1.57.0

func (g *GetCandlesRequest) InstrumentID(instrumentID string) *GetCandlesRequest

func (*GetCandlesRequest) Limit added in v1.57.0

func (g *GetCandlesRequest) Limit(limit int) *GetCandlesRequest

type GetFundingRateRequest

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

func (*GetFundingRateRequest) Do

func (*GetFundingRateRequest) InstrumentID

func (r *GetFundingRateRequest) InstrumentID(instId string) *GetFundingRateRequest

type GetInstrumentsInfoRequest added in v1.56.0

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

func (*GetInstrumentsInfoRequest) Do added in v1.56.0

Do generates the request object and send the request object to the API endpoint

func (*GetInstrumentsInfoRequest) GetParameters added in v1.56.0

func (g *GetInstrumentsInfoRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetInstrumentsInfoRequest) GetParametersJSON added in v1.56.0

func (g *GetInstrumentsInfoRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetInstrumentsInfoRequest) GetParametersQuery added in v1.56.0

func (g *GetInstrumentsInfoRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetInstrumentsInfoRequest) GetPath added in v1.56.0

func (g *GetInstrumentsInfoRequest) GetPath() string

GetPath returns the request path of the API

func (*GetInstrumentsInfoRequest) GetQueryParameters added in v1.56.0

func (g *GetInstrumentsInfoRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetInstrumentsInfoRequest) GetSlugParameters added in v1.56.0

func (g *GetInstrumentsInfoRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetInstrumentsInfoRequest) GetSlugsMap added in v1.56.0

func (g *GetInstrumentsInfoRequest) GetSlugsMap() (map[string]string, error)

func (*GetInstrumentsInfoRequest) InstId added in v1.56.0

func (*GetInstrumentsInfoRequest) InstType added in v1.56.0

type GetMaxAvailableSizeRequest added in v1.62.0

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

func (*GetMaxAvailableSizeRequest) Currency added in v1.62.0

func (*GetMaxAvailableSizeRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*GetMaxAvailableSizeRequest) GetParameters added in v1.62.0

func (g *GetMaxAvailableSizeRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetMaxAvailableSizeRequest) GetParametersJSON added in v1.62.0

func (g *GetMaxAvailableSizeRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetMaxAvailableSizeRequest) GetParametersQuery added in v1.62.0

func (g *GetMaxAvailableSizeRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetMaxAvailableSizeRequest) GetPath added in v1.62.0

func (g *GetMaxAvailableSizeRequest) GetPath() string

GetPath returns the request path of the API

func (*GetMaxAvailableSizeRequest) GetQueryParameters added in v1.62.0

func (g *GetMaxAvailableSizeRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetMaxAvailableSizeRequest) GetSlugParameters added in v1.62.0

func (g *GetMaxAvailableSizeRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetMaxAvailableSizeRequest) GetSlugsMap added in v1.62.0

func (g *GetMaxAvailableSizeRequest) GetSlugsMap() (map[string]string, error)

func (*GetMaxAvailableSizeRequest) InstrumentID added in v1.62.0

func (g *GetMaxAvailableSizeRequest) InstrumentID(instrumentID string) *GetMaxAvailableSizeRequest

func (*GetMaxAvailableSizeRequest) TdMode added in v1.62.0

type GetOpenOrdersRequest added in v1.56.0

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

func (*GetOpenOrdersRequest) After added in v1.56.0

func (*GetOpenOrdersRequest) Before added in v1.56.0

func (*GetOpenOrdersRequest) Begin added in v1.56.0

func (*GetOpenOrdersRequest) Category added in v1.56.0

func (g *GetOpenOrdersRequest) Category(category string) *GetOpenOrdersRequest

func (*GetOpenOrdersRequest) Do added in v1.56.0

Do generates the request object and send the request object to the API endpoint

func (*GetOpenOrdersRequest) End added in v1.56.0

func (*GetOpenOrdersRequest) GetParameters added in v1.56.0

func (g *GetOpenOrdersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOpenOrdersRequest) GetParametersJSON added in v1.56.0

func (g *GetOpenOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOpenOrdersRequest) GetParametersQuery added in v1.56.0

func (g *GetOpenOrdersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOpenOrdersRequest) GetPath added in v1.56.0

func (g *GetOpenOrdersRequest) GetPath() string

GetPath returns the request path of the API

func (*GetOpenOrdersRequest) GetQueryParameters added in v1.56.0

func (g *GetOpenOrdersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOpenOrdersRequest) GetSlugParameters added in v1.56.0

func (g *GetOpenOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOpenOrdersRequest) GetSlugsMap added in v1.56.0

func (g *GetOpenOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*GetOpenOrdersRequest) InstrumentID added in v1.56.0

func (g *GetOpenOrdersRequest) InstrumentID(instrumentID string) *GetOpenOrdersRequest

func (*GetOpenOrdersRequest) InstrumentType added in v1.56.0

func (g *GetOpenOrdersRequest) InstrumentType(instrumentType InstrumentType) *GetOpenOrdersRequest

func (*GetOpenOrdersRequest) Limit added in v1.56.0

func (*GetOpenOrdersRequest) OrderType added in v1.56.0

func (g *GetOpenOrdersRequest) OrderType(orderType OrderType) *GetOpenOrdersRequest

func (*GetOpenOrdersRequest) State added in v1.56.0

type GetOrderDetailsRequest

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

func (*GetOrderDetailsRequest) ClientOrderID

func (r *GetOrderDetailsRequest) ClientOrderID(clientOrderID string) *GetOrderDetailsRequest

func (*GetOrderDetailsRequest) Do

func (*GetOrderDetailsRequest) InstrumentID

func (r *GetOrderDetailsRequest) InstrumentID(instId string) *GetOrderDetailsRequest

func (*GetOrderDetailsRequest) OrderID

func (*GetOrderDetailsRequest) QueryParameters

func (r *GetOrderDetailsRequest) QueryParameters() url.Values

type GetOrderHistoryRequest added in v1.53.0

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

func (*GetOrderHistoryRequest) After added in v1.53.0

func (*GetOrderHistoryRequest) Before added in v1.53.0

func (*GetOrderHistoryRequest) Do added in v1.53.0

Do generates the request object and send the request object to the API endpoint

func (*GetOrderHistoryRequest) EndTime added in v1.53.0

func (*GetOrderHistoryRequest) GetParameters added in v1.53.0

func (g *GetOrderHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrderHistoryRequest) GetParametersJSON added in v1.53.0

func (g *GetOrderHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderHistoryRequest) GetParametersQuery added in v1.53.0

func (g *GetOrderHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrderHistoryRequest) GetPath added in v1.56.0

func (g *GetOrderHistoryRequest) GetPath() string

GetPath returns the request path of the API

func (*GetOrderHistoryRequest) GetQueryParameters added in v1.53.0

func (g *GetOrderHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrderHistoryRequest) GetSlugParameters added in v1.53.0

func (g *GetOrderHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrderHistoryRequest) GetSlugsMap added in v1.53.0

func (g *GetOrderHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrderHistoryRequest) InstrumentFamily added in v1.53.0

func (g *GetOrderHistoryRequest) InstrumentFamily(instrumentFamily string) *GetOrderHistoryRequest

func (*GetOrderHistoryRequest) InstrumentID added in v1.53.0

func (g *GetOrderHistoryRequest) InstrumentID(instrumentID string) *GetOrderHistoryRequest

func (*GetOrderHistoryRequest) InstrumentType added in v1.53.0

func (g *GetOrderHistoryRequest) InstrumentType(instrumentType InstrumentType) *GetOrderHistoryRequest

func (*GetOrderHistoryRequest) Limit added in v1.53.0

func (*GetOrderHistoryRequest) OrderType added in v1.53.0

func (g *GetOrderHistoryRequest) OrderType(orderType OrderType) *GetOrderHistoryRequest

func (*GetOrderHistoryRequest) StartTime added in v1.53.0

func (g *GetOrderHistoryRequest) StartTime(startTime time.Time) *GetOrderHistoryRequest

func (*GetOrderHistoryRequest) State added in v1.53.0

func (*GetOrderHistoryRequest) Underlying added in v1.53.0

func (g *GetOrderHistoryRequest) Underlying(underlying string) *GetOrderHistoryRequest

type GetThreeDaysTransactionHistoryRequest added in v1.58.0

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

func (*GetThreeDaysTransactionHistoryRequest) After added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) Before added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) Do added in v1.58.0

Do generates the request object and send the request object to the API endpoint

func (*GetThreeDaysTransactionHistoryRequest) EndTime added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) GetParameters added in v1.58.0

func (g *GetThreeDaysTransactionHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetThreeDaysTransactionHistoryRequest) GetParametersJSON added in v1.58.0

func (g *GetThreeDaysTransactionHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetThreeDaysTransactionHistoryRequest) GetParametersQuery added in v1.58.0

func (g *GetThreeDaysTransactionHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetThreeDaysTransactionHistoryRequest) GetPath added in v1.58.0

GetPath returns the request path of the API

func (*GetThreeDaysTransactionHistoryRequest) GetQueryParameters added in v1.58.0

func (g *GetThreeDaysTransactionHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetThreeDaysTransactionHistoryRequest) GetSlugParameters added in v1.58.0

func (g *GetThreeDaysTransactionHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetThreeDaysTransactionHistoryRequest) GetSlugsMap added in v1.58.0

func (g *GetThreeDaysTransactionHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetThreeDaysTransactionHistoryRequest) InstrumentFamily added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) InstrumentID added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) InstrumentType added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) Limit added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) OrderID added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) StartTime added in v1.58.0

func (*GetThreeDaysTransactionHistoryRequest) Underlying added in v1.58.0

type GetTickerRequest added in v1.56.0

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

func (*GetTickerRequest) Do added in v1.56.0

Do generates the request object and send the request object to the API endpoint

func (*GetTickerRequest) GetParameters added in v1.56.0

func (g *GetTickerRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTickerRequest) GetParametersJSON added in v1.56.0

func (g *GetTickerRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickerRequest) GetParametersQuery added in v1.56.0

func (g *GetTickerRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTickerRequest) GetPath added in v1.56.0

func (g *GetTickerRequest) GetPath() string

GetPath returns the request path of the API

func (*GetTickerRequest) GetQueryParameters added in v1.56.0

func (g *GetTickerRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTickerRequest) GetSlugParameters added in v1.56.0

func (g *GetTickerRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTickerRequest) GetSlugsMap added in v1.56.0

func (g *GetTickerRequest) GetSlugsMap() (map[string]string, error)

func (*GetTickerRequest) InstId added in v1.56.0

func (g *GetTickerRequest) InstId(instId string) *GetTickerRequest

type GetTickersRequest added in v1.56.0

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

func (*GetTickersRequest) Do added in v1.56.0

Do generates the request object and send the request object to the API endpoint

func (*GetTickersRequest) GetParameters added in v1.56.0

func (g *GetTickersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTickersRequest) GetParametersJSON added in v1.56.0

func (g *GetTickersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickersRequest) GetParametersQuery added in v1.56.0

func (g *GetTickersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTickersRequest) GetPath added in v1.56.0

func (g *GetTickersRequest) GetPath() string

GetPath returns the request path of the API

func (*GetTickersRequest) GetQueryParameters added in v1.56.0

func (g *GetTickersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTickersRequest) GetSlugParameters added in v1.56.0

func (g *GetTickersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTickersRequest) GetSlugsMap added in v1.56.0

func (g *GetTickersRequest) GetSlugsMap() (map[string]string, error)

func (*GetTickersRequest) InstType added in v1.56.0

func (g *GetTickersRequest) InstType(instType InstrumentType) *GetTickersRequest

type GetTransactionDetailsRequest

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

func (*GetTransactionDetailsRequest) Do

func (*GetTransactionDetailsRequest) InstrumentID

func (*GetTransactionDetailsRequest) InstrumentType

func (*GetTransactionDetailsRequest) OrderID

func (*GetTransactionDetailsRequest) Parameters

func (r *GetTransactionDetailsRequest) Parameters() map[string]interface{}

type GetTransactionHistoryRequest added in v1.53.0

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

func (*GetTransactionHistoryRequest) After added in v1.53.0

func (*GetTransactionHistoryRequest) Before added in v1.53.0

func (*GetTransactionHistoryRequest) Do added in v1.53.0

Do generates the request object and send the request object to the API endpoint

func (*GetTransactionHistoryRequest) EndTime added in v1.53.0

func (*GetTransactionHistoryRequest) GetParameters added in v1.53.0

func (g *GetTransactionHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTransactionHistoryRequest) GetParametersJSON added in v1.53.0

func (g *GetTransactionHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTransactionHistoryRequest) GetParametersQuery added in v1.53.0

func (g *GetTransactionHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTransactionHistoryRequest) GetPath added in v1.56.0

func (g *GetTransactionHistoryRequest) GetPath() string

GetPath returns the request path of the API

func (*GetTransactionHistoryRequest) GetQueryParameters added in v1.53.0

func (g *GetTransactionHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTransactionHistoryRequest) GetSlugParameters added in v1.53.0

func (g *GetTransactionHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTransactionHistoryRequest) GetSlugsMap added in v1.53.0

func (g *GetTransactionHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetTransactionHistoryRequest) InstrumentFamily added in v1.53.0

func (g *GetTransactionHistoryRequest) InstrumentFamily(instrumentFamily string) *GetTransactionHistoryRequest

func (*GetTransactionHistoryRequest) InstrumentID added in v1.53.0

func (g *GetTransactionHistoryRequest) InstrumentID(instrumentID string) *GetTransactionHistoryRequest

func (*GetTransactionHistoryRequest) InstrumentType added in v1.53.0

func (*GetTransactionHistoryRequest) Limit added in v1.53.0

func (*GetTransactionHistoryRequest) OrderID added in v1.53.0

func (*GetTransactionHistoryRequest) StartTime added in v1.53.0

func (*GetTransactionHistoryRequest) Underlying added in v1.53.0

type InstrumentInfo added in v1.56.0

type InstrumentInfo struct {
	InstrumentType        string                     `json:"instType"`
	InstrumentID          string                     `json:"instId"`
	BaseCurrency          string                     `json:"baseCcy"`
	QuoteCurrency         string                     `json:"quoteCcy"`
	SettleCurrency        string                     `json:"settleCcy"`
	ContractValue         string                     `json:"ctVal"`
	ContractMultiplier    string                     `json:"ctMult"`
	ContractValueCurrency string                     `json:"ctValCcy"`
	ListTime              types.MillisecondTimestamp `json:"listTime"`
	ExpiryTime            types.MillisecondTimestamp `json:"expTime"`
	TickSize              fixedpoint.Value           `json:"tickSz"`
	LotSize               fixedpoint.Value           `json:"lotSz"`

	InstrumentFamily string `json:"instFamily"`

	// MinSize = min order size
	MinSize fixedpoint.Value `json:"minSz"`

	// instrument status
	State string `json:"state"`
}

type InstrumentType

type InstrumentType string
const (
	InstrumentTypeSpot    InstrumentType = "SPOT"
	InstrumentTypeSwap    InstrumentType = "SWAP"
	InstrumentTypeFutures InstrumentType = "FUTURES"
	InstrumentTypeOption  InstrumentType = "OPTION"
	InstrumentTypeMargin  InstrumentType = "MARGIN"
)

type KLine added in v1.57.0

type KLine struct {
	StartTime    types.MillisecondTimestamp
	OpenPrice    fixedpoint.Value
	HighestPrice fixedpoint.Value
	LowestPrice  fixedpoint.Value
	ClosePrice   fixedpoint.Value

	// If it is a derivatives contract, the value is the number of contracts.
	// If it is SPOT/MARGIN, the value is the quantity in base currency.
	Volume fixedpoint.Value
	// VolumeInCurrency trading volume, with a unit of currency.
	// If it is a derivatives contract, the value is the number of base currency.
	// If it is SPOT/MARGIN, the value is the quantity in quote currency.
	VolumeInCurrency fixedpoint.Value
	// VolumeInCurrencyQuote Trading volume, the value is the quantity in quote currency
	// e.g. The unit is USDT for BTC-USDT and BTC-USDT-SWAP;
	// The unit is USD for BTC-USD-SWAP
	// ** REMARK: To prevent overflow, we need to avoid unmarshaling it.  **
	//VolumeInCurrencyQuote fixedpoint.Value
	// The state of candlesticks.
	// 0 represents that it is uncompleted, 1 represents that it is completed.
	Confirm fixedpoint.Value
}

type KLineSlice added in v1.57.0

type KLineSlice []KLine

func (*KLineSlice) UnmarshalJSON added in v1.57.0

func (m *KLineSlice) UnmarshalJSON(b []byte) error

type LeverageInfo added in v1.62.0

type LeverageInfo struct {
	Ccy     string           `json:"ccy"`
	InstId  string           `json:"instId"`
	MgnMode MarginMode       `json:"mgnMode"`
	PosSide string           `json:"posSide"`
	Lever   fixedpoint.Value `json:"lever"`
}

type LeverageResponse added in v1.62.0

type LeverageResponse struct {
	Leverage fixedpoint.Value `json:"lever"`

	MarginMode MarginMode `json:"mgnMode"`
	InstId     string     `json:"instId"`
	PosSide    string     `json:"posSide"`
}

type LiquidityType added in v1.56.0

type LiquidityType string

type MarginEventType added in v1.62.0

type MarginEventType string
const (
	MarginEventTypeAutoBorrow   MarginEventType = "auto_borrow"
	MarginEventTypeAutoRepay    MarginEventType = "auto_repay"
	MarginEventTypeManualBorrow MarginEventType = "manual_borrow"
	MarginEventTypeManualRepay  MarginEventType = "manual_repay"
)

type MarginHistoryEntry added in v1.62.0

type MarginHistoryEntry struct {
	AccumulatedBorrowAmount fixedpoint.Value `json:"accBorrowed"`

	Amount   fixedpoint.Value `json:"amt"`
	Currency string           `json:"ccy"`

	Ts   types.MillisecondTimestamp `json:"ts"`
	Type MarginEventType            `json:"type"`
}

type MarginMode added in v1.62.0

type MarginMode string

type MarginSide added in v1.62.0

type MarginSide string
const (
	MarginSideBorrow MarginSide = "borrow"
	MarginSideRepay  MarginSide = "repay"
)

type MarketTicker

type MarketTicker struct {
	InstrumentType string `json:"instType"`
	InstrumentID   string `json:"instId"`

	// last traded price
	Last fixedpoint.Value `json:"last"`

	// last traded size
	LastSize fixedpoint.Value `json:"lastSz"`

	AskPrice fixedpoint.Value `json:"askPx"`
	AskSize  fixedpoint.Value `json:"askSz"`

	BidPrice fixedpoint.Value `json:"bidPx"`
	BidSize  fixedpoint.Value `json:"bidSz"`

	Open24H           fixedpoint.Value `json:"open24h"`
	High24H           fixedpoint.Value `json:"high24H"`
	Low24H            fixedpoint.Value `json:"low24H"`
	Volume24H         fixedpoint.Value `json:"vol24h"`
	VolumeCurrency24H fixedpoint.Value `json:"volCcy24h"`

	// Millisecond timestamp
	Timestamp types.MillisecondTimestamp `json:"ts"`
}

type MarketTickerRequest

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

func (*MarketTickerRequest) Do

func (*MarketTickerRequest) InstrumentID

func (r *MarketTickerRequest) InstrumentID(instId string) *MarketTickerRequest

type MarketTickersRequest

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

func (*MarketTickersRequest) Do

func (*MarketTickersRequest) InstrumentType

func (r *MarketTickersRequest) InstrumentType(instType string) *MarketTickersRequest

type MaxAvailableResponse added in v1.62.0

type MaxAvailableResponse struct {
	InstId        string           `json:"instId"`
	AvailableBuy  fixedpoint.Value `json:"availBuy"`
	AvailableSell fixedpoint.Value `json:"availSell"`
}

type MaxLoanResponse added in v1.62.0

type MaxLoanResponse struct {
	InstId  string     `json:"instId"`
	MgnMode MarginMode `json:"mgnMode"`
	MgnCcy  string     `json:"mgnCcy"`

	MaxLoan fixedpoint.Value `json:"maxLoan"`
	Ccy     string           `json:"ccy"`
	Side    MarginSide       `json:"side"`
}

type OpenOrder added in v1.56.0

type OpenOrder struct {
	OrderDetail
	QuickMgnType string `json:"quickMgnType"`
}

type OrderDetail added in v1.56.0

type OrderDetail struct {
	AccumulatedFillSize fixedpoint.Value `json:"accFillSz"`
	// If none is filled, it will return "".
	AvgPrice      fixedpoint.Value           `json:"avgPx"`
	CreatedTime   types.MillisecondTimestamp `json:"cTime"`
	Category      string                     `json:"category"`
	ClientOrderId string                     `json:"clOrdId"`
	Fee           fixedpoint.Value           `json:"fee"`
	FeeCurrency   string                     `json:"feeCcy"`
	// Last filled time
	FillTime       types.MillisecondTimestamp `json:"fillTime"`
	InstrumentID   string                     `json:"instId"`
	InstrumentType InstrumentType             `json:"instType"`
	OrderId        strint.Int64               `json:"ordId"`
	OrderType      OrderType                  `json:"ordType"`
	Price          fixedpoint.Value           `json:"px"`
	Side           SideType                   `json:"side"`
	State          OrderState                 `json:"state"`
	Size           fixedpoint.Value           `json:"sz"`
	TargetCurrency TargetCurrency             `json:"tgtCcy"`
	UpdatedTime    types.MillisecondTimestamp `json:"uTime"`

	// Margin currency
	// Only applicable to cross MARGIN orders in Single-currency margin.
	Currency string `json:"ccy"`
	TradeId  string `json:"tradeId"`
	// Last filled price
	FillPrice fixedpoint.Value `json:"fillPx"`
	// Last filled quantity
	FillSize fixedpoint.Value `json:"fillSz"`
	// Leverage, from 0.01 to 125.
	// Only applicable to MARGIN/FUTURES/SWAP
	Lever string `json:"lever"`
	// Profit and loss, Applicable to orders which have a trade and aim to close position. It always is 0 in other conditions
	Pnl          fixedpoint.Value `json:"pnl"`
	PositionSide string           `json:"posSide"`
	// Options price in USDOnly applicable to options; return "" for other instrument types
	PriceUsd fixedpoint.Value `json:"pxUsd"`
	// Implied volatility of the options orderOnly applicable to options; return "" for other instrument types
	PriceVol fixedpoint.Value `json:"pxVol"`
	// Price type of options
	PriceType string `json:"pxType"`
	// Rebate amount, only applicable to spot and margin, the reward of placing orders from the platform (rebate)
	// given to user who has reached the specified trading level. If there is no rebate, this field is "".
	Rebate    fixedpoint.Value `json:"rebate"`
	RebateCcy string           `json:"rebateCcy"`
	// Client-supplied Algo ID when placing order attaching TP/SL.
	AttachAlgoClOrdId string           `json:"attachAlgoClOrdId"`
	SlOrdPx           fixedpoint.Value `json:"slOrdPx"`
	SlTriggerPx       fixedpoint.Value `json:"slTriggerPx"`
	SlTriggerPxType   string           `json:"slTriggerPxType"`
	AttachAlgoOrds    []interface{}    `json:"attachAlgoOrds"`
	Source            string           `json:"source"`
	// Self trade prevention ID. Return "" if self trade prevention is not applicable
	StpId string `json:"stpId"`
	// Self trade prevention mode. Return "" if self trade prevention is not applicable
	StpMode         string           `json:"stpMode"`
	Tag             string           `json:"tag"`
	TradeMode       TradeMode        `json:"tdMode"`
	TpOrdPx         fixedpoint.Value `json:"tpOrdPx"`
	TpTriggerPx     fixedpoint.Value `json:"tpTriggerPx"`
	TpTriggerPxType string           `json:"tpTriggerPxType"`
	ReduceOnly      string           `json:"reduceOnly"`
	AlgoClOrdId     string           `json:"algoClOrdId"`
	AlgoId          string           `json:"algoId"`
}

type OrderDetails

type OrderDetails struct {
	InstrumentType InstrumentType   `json:"instType"`
	InstrumentID   string           `json:"instId"`
	Tag            string           `json:"tag"`
	Price          fixedpoint.Value `json:"px"`
	Quantity       fixedpoint.Value `json:"sz"`

	OrderID       string    `json:"ordId"`
	ClientOrderID string    `json:"clOrdId"`
	OrderType     OrderType `json:"ordType"`
	Side          SideType  `json:"side"`

	// Accumulated fill quantity
	FilledQuantity fixedpoint.Value `json:"accFillSz"`

	FeeCurrency string           `json:"feeCcy"`
	Fee         fixedpoint.Value `json:"fee"`

	// trade related fields
	LastTradeID           string                     `json:"tradeId,omitempty"`
	LastFilledPrice       fixedpoint.Value           `json:"fillPx"`
	LastFilledQuantity    fixedpoint.Value           `json:"fillSz"`
	LastFilledTime        types.MillisecondTimestamp `json:"fillTime"`
	LastFilledFee         fixedpoint.Value           `json:"fillFee"`
	LastFilledFeeCurrency string                     `json:"fillFeeCcy"`
	LastFilledPnl         fixedpoint.Value           `json:"fillPnl"`
	BillID                strint.Int64               `json:"billId"`

	// ExecutionType = liquidity (M = maker or T = taker)
	ExecutionType string `json:"execType"`

	// Average filled price. If none is filled, it will return 0.
	AveragePrice fixedpoint.Value `json:"avgPx"`

	// Currency = Margin currency
	// Only applicable to cross MARGIN orders in Single-currency margin.
	Currency string `json:"ccy"`

	// Leverage = from 0.01 to 125.
	// Only applicable to MARGIN/FUTURES/SWAP
	Leverage fixedpoint.Value `json:"lever"`

	RebateCurrency string           `json:"rebateCcy"`
	Rebate         fixedpoint.Value `json:"rebate"`

	PnL fixedpoint.Value `json:"pnl"`

	UpdateTime   types.MillisecondTimestamp `json:"uTime"`
	CreationTime types.MillisecondTimestamp `json:"cTime"`

	State OrderState `json:"state"`
}

type OrderList added in v1.52.0

type OrderList []OrderDetails

type OrderResponse

type OrderResponse struct {
	OrderID       string `json:"ordId"`
	ClientOrderID string `json:"clOrdId"`
	Tag           string `json:"tag"`

	Timestamp strint.Int64 `json:"ts"`
	Code      string       `json:"sCode"`
	Message   string       `json:"sMsg"`
}

type OrderState

type OrderState string
const (
	OrderStateCanceled        OrderState = "canceled"
	OrderStateLive            OrderState = "live"
	OrderStatePartiallyFilled OrderState = "partially_filled"
	OrderStateFilled          OrderState = "filled"
)

func (OrderState) IsWorking added in v1.56.0

func (o OrderState) IsWorking() bool

type OrderType

type OrderType string
const (
	OrderTypeMarket   OrderType = "market"
	OrderTypeLimit    OrderType = "limit"
	OrderTypePostOnly OrderType = "post_only"
	OrderTypeFOK      OrderType = "fok"
	OrderTypeIOC      OrderType = "ioc"
)

type PlaceOrderRequest

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

func (*PlaceOrderRequest) ClientOrderID

func (r *PlaceOrderRequest) ClientOrderID(clientOrderID string) *PlaceOrderRequest

func (*PlaceOrderRequest) Currency added in v1.62.0

func (r *PlaceOrderRequest) Currency(currency string) *PlaceOrderRequest

func (*PlaceOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*PlaceOrderRequest) GetParameters added in v1.21.0

func (r *PlaceOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*PlaceOrderRequest) GetParametersJSON added in v1.21.0

func (r *PlaceOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*PlaceOrderRequest) GetParametersQuery added in v1.21.0

func (r *PlaceOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*PlaceOrderRequest) GetPath added in v1.56.0

func (r *PlaceOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*PlaceOrderRequest) GetQueryParameters added in v1.56.0

func (r *PlaceOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*PlaceOrderRequest) GetSlugParameters added in v1.56.0

func (r *PlaceOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*PlaceOrderRequest) GetSlugsMap added in v1.56.0

func (r *PlaceOrderRequest) GetSlugsMap() (map[string]string, error)

func (*PlaceOrderRequest) InstrumentID

func (r *PlaceOrderRequest) InstrumentID(instrumentID string) *PlaceOrderRequest

func (*PlaceOrderRequest) OrderType

func (r *PlaceOrderRequest) OrderType(orderType OrderType) *PlaceOrderRequest

func (*PlaceOrderRequest) Parameters

func (r *PlaceOrderRequest) Parameters() map[string]interface{}

func (*PlaceOrderRequest) PosSide added in v1.62.0

func (r *PlaceOrderRequest) PosSide(posSide PosSide) *PlaceOrderRequest

func (*PlaceOrderRequest) Price

func (r *PlaceOrderRequest) Price(price string) *PlaceOrderRequest

func (*PlaceOrderRequest) ReduceOnly added in v1.62.0

func (r *PlaceOrderRequest) ReduceOnly(reduceOnly bool) *PlaceOrderRequest

func (*PlaceOrderRequest) Side

func (*PlaceOrderRequest) Size added in v1.56.0

func (*PlaceOrderRequest) Tag added in v1.21.0

func (*PlaceOrderRequest) TargetCurrency added in v1.56.0

func (r *PlaceOrderRequest) TargetCurrency(targetCurrency TargetCurrency) *PlaceOrderRequest

func (*PlaceOrderRequest) TradeMode

func (r *PlaceOrderRequest) TradeMode(tradeMode TradeMode) *PlaceOrderRequest

type PosSide added in v1.62.0

type PosSide string
const (
	PosSideLong  PosSide = "long"
	PosSideShort PosSide = "short"
)

type Position added in v1.62.0

type Position struct {
	Adl          fixedpoint.Value `json:"adl"`
	AvailPos     fixedpoint.Value `json:"availPos"`
	AvgPx        fixedpoint.Value `json:"avgPx"`
	BaseBal      fixedpoint.Value `json:"baseBal"`
	BaseBorrowed fixedpoint.Value `json:"baseBorrowed"`
	BaseInterest fixedpoint.Value `json:"baseInterest"`
	BePx         fixedpoint.Value `json:"bePx"`
	BizRefId     string           `json:"bizRefId"`
	BizRefType   string           `json:"bizRefType"`

	Ccy                    string           `json:"ccy"`
	ClSpotInUseAmt         string           `json:"clSpotInUseAmt"`
	CloseOrderAlgo         []interface{}    `json:"closeOrderAlgo"`
	DeltaBS                string           `json:"deltaBS"`
	DeltaPA                string           `json:"deltaPA"`
	Fee                    fixedpoint.Value `json:"fee"`
	FundingFee             fixedpoint.Value `json:"fundingFee"`
	GammaBS                string           `json:"gammaBS"`
	GammaPA                string           `json:"gammaPA"`
	IdxPx                  fixedpoint.Value `json:"idxPx"`
	Imr                    string           `json:"imr"`
	InstId                 string           `json:"instId"`
	InstType               string           `json:"instType"`
	Interest               fixedpoint.Value `json:"interest"`
	Last                   fixedpoint.Value `json:"last"`
	Lever                  fixedpoint.Value `json:"lever"`
	Liab                   fixedpoint.Value `json:"liab"`
	LiabCcy                string           `json:"liabCcy"`
	LiqPenalty             string           `json:"liqPenalty"`
	LiqPx                  fixedpoint.Value `json:"liqPx"`
	Margin                 fixedpoint.Value `json:"margin"`
	MarkPx                 fixedpoint.Value `json:"markPx"`
	MaxSpotInUseAmt        string           `json:"maxSpotInUseAmt"`
	MgnMode                string           `json:"mgnMode"`
	MgnRatio               fixedpoint.Value `json:"mgnRatio"`
	Mmr                    string           `json:"mmr"`
	NotionalUsd            string           `json:"notionalUsd"`
	OptVal                 string           `json:"optVal"`
	PendingCloseOrdLiabVal string           `json:"pendingCloseOrdLiabVal"`
	Pnl                    fixedpoint.Value `json:"pnl"`
	Pos                    fixedpoint.Value `json:"pos"`
	PosCcy                 string           `json:"posCcy"`
	PosId                  string           `json:"posId"`
	PosSide                string           `json:"posSide"`
	QuoteBal               fixedpoint.Value `json:"quoteBal"`
	QuoteBorrowed          fixedpoint.Value `json:"quoteBorrowed"`
	QuoteInterest          fixedpoint.Value `json:"quoteInterest"`
	RealizedPnl            fixedpoint.Value `json:"realizedPnl"`
	SpotInUseAmt           string           `json:"spotInUseAmt"`
	SpotInUseCcy           string           `json:"spotInUseCcy"`
	ThetaBS                string           `json:"thetaBS"`
	ThetaPA                string           `json:"thetaPA"`
	TradeId                string           `json:"tradeId"`

	CreationTime types.MillisecondTimestamp `json:"cTime"`
	UpdatedTime  types.MillisecondTimestamp `json:"uTime"`

	Upl            string           `json:"upl"`
	UplLastPx      fixedpoint.Value `json:"uplLastPx"`
	UplRatio       string           `json:"uplRatio"`
	UplRatioLastPx string           `json:"uplRatioLastPx"`
	UsdPx          fixedpoint.Value `json:"usdPx"`
	VegaBS         string           `json:"vegaBS"`
	VegaPA         string           `json:"vegaPA"`
}

type PositionBalanceData added in v1.62.0

type PositionBalanceData struct {
	Currency  string           `json:"ccy"`
	DisEquity fixedpoint.Value `json:"disEq"`
	Equity    fixedpoint.Value `json:"eq"`
}

type PositionData added in v1.62.0

type PositionData struct {
	Currency string `json:"ccy"`
	InstId   string `json:"instId"`
	InstType string `json:"instType"`

	MarginMode       MarginMode       `json:"mgnMode"`
	NotionalCurrency fixedpoint.Value `json:"notionalCcy"`
	NotionalUsd      fixedpoint.Value `json:"notionalUsd"`
	Pos              fixedpoint.Value `json:"pos"`
	PosCurrency      string           `json:"posCcy"`
	PosId            string           `json:"posId"`
	PosSide          string           `json:"posSide"`

	BaseBal  fixedpoint.Value `json:"baseBal"`
	QuoteBal fixedpoint.Value `json:"quoteBal"`
}

type PositionRiskResponse added in v1.62.0

type PositionRiskResponse struct {
	AdjEq   fixedpoint.Value           `json:"adjEq"`
	BalData []PositionBalanceData      `json:"balData"`
	PosData []PositionData             `json:"posData"`
	Ts      types.MillisecondTimestamp `json:"ts"`
}

type RestClient

type RestClient struct {
	requestgen.BaseAPIClient

	Key, Secret, Passphrase string
}

func NewClient

func NewClient() *RestClient

func (*RestClient) AssetBalances

func (c *RestClient) AssetBalances(ctx context.Context) (AssetBalanceList, error)

func (*RestClient) AssetCurrencies

func (c *RestClient) AssetCurrencies(ctx context.Context) ([]AssetCurrency, error)

func (*RestClient) Auth

func (c *RestClient) Auth(key, secret, passphrase string)

func (*RestClient) NewAuthenticatedRequest added in v1.52.0

func (c *RestClient) NewAuthenticatedRequest(
	ctx context.Context, method, refURL string, params url.Values, payload interface{},
) (*http.Request, error)

NewAuthenticatedRequest creates new http request for authenticated routes.

func (*RestClient) NewBatchCancelOrderRequest added in v1.52.0

func (c *RestClient) NewBatchCancelOrderRequest() *BatchCancelOrderRequest

func (*RestClient) NewBatchPlaceOrderRequest added in v1.52.0

func (c *RestClient) NewBatchPlaceOrderRequest() *BatchPlaceOrderRequest

func (*RestClient) NewCancelOrderRequest added in v1.52.0

func (c *RestClient) NewCancelOrderRequest() *CancelOrderRequest

func (*RestClient) NewGetAccountBalanceRequest added in v1.62.0

func (c *RestClient) NewGetAccountBalanceRequest() *GetAccountBalanceRequest

func (*RestClient) NewGetAccountConfigRequest added in v1.62.0

func (c *RestClient) NewGetAccountConfigRequest() *GetAccountConfigRequest

func (*RestClient) NewGetAccountInterestLimitsRequest added in v1.62.0

func (c *RestClient) NewGetAccountInterestLimitsRequest() *GetAccountInterestLimitsRequest

func (*RestClient) NewGetAccountLeverageInfoRequest added in v1.62.0

func (c *RestClient) NewGetAccountLeverageInfoRequest() *GetAccountLeverageInfoRequest

func (*RestClient) NewGetAccountMaxLoanRequest added in v1.62.0

func (c *RestClient) NewGetAccountMaxLoanRequest() *GetAccountMaxLoanRequest

func (*RestClient) NewGetAccountPositionRiskRequest added in v1.62.0

func (c *RestClient) NewGetAccountPositionRiskRequest() *GetAccountPositionRiskRequest

func (*RestClient) NewGetAccountPositionsRequest added in v1.62.0

func (c *RestClient) NewGetAccountPositionsRequest() *GetAccountPositionsRequest

func (*RestClient) NewGetAccountRiskStateRequest added in v1.62.0

func (c *RestClient) NewGetAccountRiskStateRequest() *GetAccountRiskStateRequest

func (*RestClient) NewGetAccountSpotBorrowRepayHistoryRequest added in v1.62.0

func (c *RestClient) NewGetAccountSpotBorrowRepayHistoryRequest() *GetAccountSpotBorrowRepayHistoryRequest

func (*RestClient) NewGetAssetDepositHistoryRequest added in v1.62.0

func (c *RestClient) NewGetAssetDepositHistoryRequest() *GetAssetDepositHistoryRequest

func (*RestClient) NewGetCandlesRequest added in v1.57.0

func (c *RestClient) NewGetCandlesRequest() *GetCandlesRequest

func (*RestClient) NewGetFundingRate added in v1.52.0

func (s *RestClient) NewGetFundingRate() *GetFundingRateRequest

func (*RestClient) NewGetInstrumentsInfoRequest added in v1.56.0

func (c *RestClient) NewGetInstrumentsInfoRequest() *GetInstrumentsInfoRequest

func (*RestClient) NewGetMaxAvailableSizeRequest added in v1.62.0

func (c *RestClient) NewGetMaxAvailableSizeRequest() *GetMaxAvailableSizeRequest

func (*RestClient) NewGetOpenOrdersRequest added in v1.56.0

func (c *RestClient) NewGetOpenOrdersRequest() *GetOpenOrdersRequest

func (*RestClient) NewGetOrderDetailsRequest added in v1.52.0

func (c *RestClient) NewGetOrderDetailsRequest() *GetOrderDetailsRequest

func (*RestClient) NewGetOrderHistoryRequest added in v1.53.0

func (c *RestClient) NewGetOrderHistoryRequest() *GetOrderHistoryRequest

NewGetOrderHistoryRequest is descending order by createdTime

func (*RestClient) NewGetThreeDaysTransactionHistoryRequest added in v1.58.0

func (c *RestClient) NewGetThreeDaysTransactionHistoryRequest() *GetThreeDaysTransactionHistoryRequest

func (*RestClient) NewGetTickerRequest added in v1.56.0

func (c *RestClient) NewGetTickerRequest() *GetTickerRequest

func (*RestClient) NewGetTickersRequest added in v1.56.0

func (c *RestClient) NewGetTickersRequest() *GetTickersRequest

func (*RestClient) NewGetTransactionDetailsRequest added in v1.52.0

func (c *RestClient) NewGetTransactionDetailsRequest() *GetTransactionDetailsRequest

func (*RestClient) NewGetTransactionHistoryRequest added in v1.53.0

func (c *RestClient) NewGetTransactionHistoryRequest() *GetTransactionHistoryRequest

func (*RestClient) NewMarketTickerRequest added in v1.52.0

func (c *RestClient) NewMarketTickerRequest(instId string) *MarketTickerRequest

func (*RestClient) NewMarketTickersRequest added in v1.52.0

func (c *RestClient) NewMarketTickersRequest(instType string) *MarketTickersRequest

func (*RestClient) NewPlaceOrderRequest added in v1.52.0

func (c *RestClient) NewPlaceOrderRequest() *PlaceOrderRequest

func (*RestClient) NewSetAccountLevelRequest added in v1.62.0

func (c *RestClient) NewSetAccountLevelRequest() *SetAccountLevelRequest

func (*RestClient) NewSetAccountLeverageRequest added in v1.62.0

func (c *RestClient) NewSetAccountLeverageRequest() *SetAccountLeverageRequest

func (*RestClient) NewSetAutoRepayRequest added in v1.62.0

func (c *RestClient) NewSetAutoRepayRequest() *SetAutoRepayRequest

func (*RestClient) NewSpotManualBorrowRepayRequest added in v1.62.0

func (c *RestClient) NewSpotManualBorrowRepayRequest() *SpotManualBorrowRepayRequest

type SetAccountLevelRequest added in v1.62.0

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

func (*SetAccountLevelRequest) AcctLv added in v1.62.0

func (*SetAccountLevelRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*SetAccountLevelRequest) GetParameters added in v1.62.0

func (s *SetAccountLevelRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*SetAccountLevelRequest) GetParametersJSON added in v1.62.0

func (s *SetAccountLevelRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*SetAccountLevelRequest) GetParametersQuery added in v1.62.0

func (s *SetAccountLevelRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*SetAccountLevelRequest) GetPath added in v1.62.0

func (s *SetAccountLevelRequest) GetPath() string

GetPath returns the request path of the API

func (*SetAccountLevelRequest) GetQueryParameters added in v1.62.0

func (s *SetAccountLevelRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*SetAccountLevelRequest) GetSlugParameters added in v1.62.0

func (s *SetAccountLevelRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*SetAccountLevelRequest) GetSlugsMap added in v1.62.0

func (s *SetAccountLevelRequest) GetSlugsMap() (map[string]string, error)

type SetAccountLeverageRequest added in v1.62.0

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

func (*SetAccountLeverageRequest) Currency added in v1.62.0

func (*SetAccountLeverageRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*SetAccountLeverageRequest) GetParameters added in v1.62.0

func (s *SetAccountLeverageRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*SetAccountLeverageRequest) GetParametersJSON added in v1.62.0

func (s *SetAccountLeverageRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*SetAccountLeverageRequest) GetParametersQuery added in v1.62.0

func (s *SetAccountLeverageRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*SetAccountLeverageRequest) GetPath added in v1.62.0

func (s *SetAccountLeverageRequest) GetPath() string

GetPath returns the request path of the API

func (*SetAccountLeverageRequest) GetQueryParameters added in v1.62.0

func (s *SetAccountLeverageRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*SetAccountLeverageRequest) GetSlugParameters added in v1.62.0

func (s *SetAccountLeverageRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*SetAccountLeverageRequest) GetSlugsMap added in v1.62.0

func (s *SetAccountLeverageRequest) GetSlugsMap() (map[string]string, error)

func (*SetAccountLeverageRequest) InstrumentId added in v1.62.0

func (s *SetAccountLeverageRequest) InstrumentId(instrumentId string) *SetAccountLeverageRequest

func (*SetAccountLeverageRequest) Leverage added in v1.62.0

func (*SetAccountLeverageRequest) MarginMode added in v1.62.0

func (*SetAccountLeverageRequest) PosSide added in v1.62.0

type SetAutoRepayRequest added in v1.62.0

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

func (*SetAutoRepayRequest) AutoRepay added in v1.62.0

func (s *SetAutoRepayRequest) AutoRepay(autoRepay bool) *SetAutoRepayRequest

func (*SetAutoRepayRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*SetAutoRepayRequest) GetParameters added in v1.62.0

func (s *SetAutoRepayRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*SetAutoRepayRequest) GetParametersJSON added in v1.62.0

func (s *SetAutoRepayRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*SetAutoRepayRequest) GetParametersQuery added in v1.62.0

func (s *SetAutoRepayRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*SetAutoRepayRequest) GetPath added in v1.62.0

func (s *SetAutoRepayRequest) GetPath() string

GetPath returns the request path of the API

func (*SetAutoRepayRequest) GetQueryParameters added in v1.62.0

func (s *SetAutoRepayRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*SetAutoRepayRequest) GetSlugParameters added in v1.62.0

func (s *SetAutoRepayRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*SetAutoRepayRequest) GetSlugsMap added in v1.62.0

func (s *SetAutoRepayRequest) GetSlugsMap() (map[string]string, error)

type SideType

type SideType string
const (
	SideTypeBuy  SideType = "buy"
	SideTypeSell SideType = "sell"
)

type SpotBorrowRepayResponse added in v1.62.0

type SpotBorrowRepayResponse struct {
	Currency string           `json:"ccy"`
	Side     MarginSide       `json:"side"`
	Amount   fixedpoint.Value `json:"amt"`
}

type SpotManualBorrowRepayRequest added in v1.62.0

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

func (*SpotManualBorrowRepayRequest) Amount added in v1.62.0

func (*SpotManualBorrowRepayRequest) Currency added in v1.62.0

func (*SpotManualBorrowRepayRequest) Do added in v1.62.0

Do generates the request object and send the request object to the API endpoint

func (*SpotManualBorrowRepayRequest) GetParameters added in v1.62.0

func (s *SpotManualBorrowRepayRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*SpotManualBorrowRepayRequest) GetParametersJSON added in v1.62.0

func (s *SpotManualBorrowRepayRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*SpotManualBorrowRepayRequest) GetParametersQuery added in v1.62.0

func (s *SpotManualBorrowRepayRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*SpotManualBorrowRepayRequest) GetPath added in v1.62.0

func (s *SpotManualBorrowRepayRequest) GetPath() string

GetPath returns the request path of the API

func (*SpotManualBorrowRepayRequest) GetQueryParameters added in v1.62.0

func (s *SpotManualBorrowRepayRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*SpotManualBorrowRepayRequest) GetSlugParameters added in v1.62.0

func (s *SpotManualBorrowRepayRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*SpotManualBorrowRepayRequest) GetSlugsMap added in v1.62.0

func (s *SpotManualBorrowRepayRequest) GetSlugsMap() (map[string]string, error)

func (*SpotManualBorrowRepayRequest) Side added in v1.62.0

type TargetCurrency added in v1.56.0

type TargetCurrency string
const (
	TargetCurrencyBase  TargetCurrency = "base_ccy"
	TargetCurrencyQuote TargetCurrency = "quote_ccy"
)

type Trade added in v1.56.0

type Trade struct {
	InstrumentType InstrumentType `json:"instType"`
	InstrumentId   string         `json:"instId"`
	TradeId        strint.Int64   `json:"tradeId"`
	OrderId        strint.Int64   `json:"ordId"`
	ClientOrderId  string         `json:"clOrdId"`
	// Data generation time, Unix timestamp format in milliseconds, e.g. 1597026383085.
	Timestamp     types.MillisecondTimestamp `json:"ts"`
	FillTime      types.MillisecondTimestamp `json:"fillTime"`
	FeeCurrency   string                     `json:"feeCcy"`
	Fee           fixedpoint.Value           `json:"fee"`
	BillId        strint.Int64               `json:"billId"`
	Side          SideType                   `json:"side"`
	ExecutionType LiquidityType              `json:"execType"`

	Tag string `json:"tag"`
	// Last filled price
	FillPrice fixedpoint.Value `json:"fillPx"`
	// Last filled quantity
	FillSize fixedpoint.Value `json:"fillSz"`
	// Index price at the moment of trade execution
	// For cross currency spot pairs, it returns baseCcy-USDT index price. For example, for LTC-ETH, this field returns the index price of LTC-USDT.
	FillIndexPrice fixedpoint.Value `json:"fillIdxPx"`
	FillPnl        string           `json:"fillPnl"`

	// Only applicable to options; return "" for other instrument types
	FillPriceVolume  fixedpoint.Value `json:"fillPxVol"`
	FillPriceUsd     fixedpoint.Value `json:"fillPxUsd"`
	FillMarkVolume   fixedpoint.Value `json:"fillMarkVol"`
	FillForwardPrice fixedpoint.Value `json:"fillFwdPx"`
	FillMarkPrice    fixedpoint.Value `json:"fillMarkPx"`
	PosSide          string           `json:"posSide"`
}

type TradeMode added in v1.56.0

type TradeMode string

TradeMode: see https://www.okx.com/docs-v5/trick_en/#order-management-trade-mode

const (
	TradeModeCash     TradeMode = "cash"
	TradeModeIsolated TradeMode = "isolated"
	TradeModeCross    TradeMode = "cross"
)

Source Files

Jump to

Keyboard shortcuts

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