Documentation ¶
Overview ¶
Code generated by go generate; DO NOT EDIT.
Index ¶
- Constants
- func PaperTrade() bool
- func Sign(payload string, secret string) string
- type Account
- type AlgoOrderResponse
- type AssetBalance
- type AssetBalanceList
- type AssetCurrency
- type BalanceDetail
- type BatchCancelOrderRequest
- type BatchPlaceOrderRequest
- type CancelOrderRequest
- func (c *CancelOrderRequest) ClientOrderID(clientOrderID string) *CancelOrderRequest
- func (r *CancelOrderRequest) Do(ctx context.Context) ([]OrderResponse, error)
- func (c *CancelOrderRequest) GetParameters() (map[string]interface{}, error)
- func (c *CancelOrderRequest) GetParametersJSON() ([]byte, error)
- func (c *CancelOrderRequest) GetParametersQuery() (url.Values, error)
- func (c *CancelOrderRequest) InstrumentID(instrumentID string) *CancelOrderRequest
- func (c *CancelOrderRequest) OrderID(orderID string) *CancelOrderRequest
- func (r *CancelOrderRequest) Parameters() map[string]interface{}
- type Candle
- type CandlesticksRequest
- func (r *CandlesticksRequest) After(after int64) *CandlesticksRequest
- func (r *CandlesticksRequest) Bar(bar string) *CandlesticksRequest
- func (r *CandlesticksRequest) Before(before int64) *CandlesticksRequest
- func (r *CandlesticksRequest) Do(ctx context.Context) ([]Candle, error)
- func (r *CandlesticksRequest) InstrumentID(instId string) *CandlesticksRequest
- func (r *CandlesticksRequest) Limit(limit int) *CandlesticksRequest
- type FundingRate
- type GetFundingRateRequest
- type GetHistoryRequest
- type GetInstrumentsRequest
- type GetOrderDetailsRequest
- func (r *GetOrderDetailsRequest) ClientOrderID(clientOrderID string) *GetOrderDetailsRequest
- func (r *GetOrderDetailsRequest) Do(ctx context.Context) (*OrderDetails, error)
- func (r *GetOrderDetailsRequest) InstrumentID(instId string) *GetOrderDetailsRequest
- func (r *GetOrderDetailsRequest) OrderID(orderID string) *GetOrderDetailsRequest
- func (r *GetOrderDetailsRequest) QueryParameters() url.Values
- type GetPendingOrderRequest
- func (r *GetPendingOrderRequest) AddOrderTypes(orderTypes ...string) *GetPendingOrderRequest
- func (r *GetPendingOrderRequest) Do(ctx context.Context) ([]OrderDetails, error)
- func (r *GetPendingOrderRequest) InstrumentID(instId string) *GetPendingOrderRequest
- func (r *GetPendingOrderRequest) InstrumentType(instType InstrumentType) *GetPendingOrderRequest
- func (r *GetPendingOrderRequest) OrderTypes(orderTypes []string) *GetPendingOrderRequest
- func (r *GetPendingOrderRequest) Parameters() map[string]interface{}
- func (r *GetPendingOrderRequest) State(state OrderState) *GetPendingOrderRequest
- type GetPostionRequest
- func (r *GetPostionRequest) Do(ctx context.Context) ([]*Postions, error)
- func (r *GetPostionRequest) InstrumentID(instId string) *GetPostionRequest
- func (r *GetPostionRequest) InstrumentType(instType InstrumentType) *GetPostionRequest
- func (r *GetPostionRequest) Parameters() map[string]interface{}
- func (r *GetPostionRequest) PosId(posId string) *GetPostionRequest
- type GetTransactionDetailsRequest
- func (r *GetTransactionDetailsRequest) Do(ctx context.Context) ([]OrderDetails, error)
- func (r *GetTransactionDetailsRequest) InstrumentID(instId string) *GetTransactionDetailsRequest
- func (r *GetTransactionDetailsRequest) InstrumentType(instType InstrumentType) *GetTransactionDetailsRequest
- func (r *GetTransactionDetailsRequest) OrderID(orderID string) *GetTransactionDetailsRequest
- func (r *GetTransactionDetailsRequest) Parameters() map[string]interface{}
- type Instrument
- type InstrumentType
- type MarketDataService
- type MarketTicker
- type MarketTickerRequest
- type MarketTickersRequest
- type OrderDetails
- type OrderResponse
- type OrderState
- type OrderType
- type PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) Ccy(ccy string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) ClientOrderID(clientOrderID string) *PlaceAlgoOrderRequest
- func (r *PlaceAlgoOrderRequest) Do(ctx context.Context) (*AlgoOrderResponse, error)
- func (p *PlaceAlgoOrderRequest) GetParameters() (map[string]interface{}, error)
- func (p *PlaceAlgoOrderRequest) GetParametersJSON() ([]byte, error)
- func (p *PlaceAlgoOrderRequest) GetParametersQuery() (url.Values, error)
- func (p *PlaceAlgoOrderRequest) GetQueryParameters() (url.Values, error)
- func (p *PlaceAlgoOrderRequest) GetSlugParameters() (map[string]interface{}, error)
- func (p *PlaceAlgoOrderRequest) GetSlugsMap() (map[string]string, error)
- func (p *PlaceAlgoOrderRequest) InstrumentID(instrumentID string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) OrderType(orderType OrderType) *PlaceAlgoOrderRequest
- func (r *PlaceAlgoOrderRequest) Parameters() map[string]interface{}
- func (p *PlaceAlgoOrderRequest) PosSide(posSide PosSideType) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) Price(price string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) Quantity(quantity string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) ReduceOnly(reduceOnly bool) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) SetSlOrdPx(SlOrdPx string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) SetSlTriggerPx(SlTriggerPx string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) SetSlTriggerPxType(SlTriggerPxType string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) SetTpOrdPx(TpOrdPx string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) SetTpTriggerPx(TpTriggerPx string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) SetTpTriggerPxType(TpTriggerPxType string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) Side(side SideType) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) Tag(tag string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) TgtCcy(tgtCcy string) *PlaceAlgoOrderRequest
- func (p *PlaceAlgoOrderRequest) TradeMode(tradeMode string) *PlaceAlgoOrderRequest
- type PlaceOrderRequest
- func (p *PlaceOrderRequest) CCY(ccy string) *PlaceOrderRequest
- func (p *PlaceOrderRequest) ClientOrderID(clientOrderID string) *PlaceOrderRequest
- func (r *PlaceOrderRequest) Do(ctx context.Context) (*OrderResponse, error)
- func (p *PlaceOrderRequest) GetParameters() (map[string]interface{}, error)
- func (p *PlaceOrderRequest) GetParametersJSON() ([]byte, error)
- func (p *PlaceOrderRequest) GetParametersQuery() (url.Values, error)
- func (p *PlaceOrderRequest) InstrumentID(instrumentID string) *PlaceOrderRequest
- func (p *PlaceOrderRequest) OrderType(orderType OrderType) *PlaceOrderRequest
- func (r *PlaceOrderRequest) Parameters() map[string]interface{}
- func (p *PlaceOrderRequest) PosSide(side PosSideType) *PlaceOrderRequest
- func (p *PlaceOrderRequest) Price(price string) *PlaceOrderRequest
- func (p *PlaceOrderRequest) Quantity(quantity string) *PlaceOrderRequest
- func (p *PlaceOrderRequest) ReduceOnly(reduceOnly bool) *PlaceOrderRequest
- func (p *PlaceOrderRequest) Side(side SideType) *PlaceOrderRequest
- func (p *PlaceOrderRequest) Tag(tag string) *PlaceOrderRequest
- func (p *PlaceOrderRequest) TgtCcy(tgtCcy string) *PlaceOrderRequest
- func (p *PlaceOrderRequest) TradeMode(tradeMode string) *PlaceOrderRequest
- type PosSideType
- type Postions
- type PublicDataService
- type RestClient
- func (c *RestClient) AccountBalances() (*Account, error)
- func (c *RestClient) AccountPositions() (string, error)
- func (c *RestClient) AssetBalances() (AssetBalanceList, error)
- func (c *RestClient) AssetCurrencies() ([]AssetCurrency, error)
- func (c *RestClient) Auth(key, secret, passphrase string)
- func (c *RestClient) CancelAlgos(orderid string) (string, error)
- func (c *RestClient) CancelPendingAlgos(symbol string) (string, error)
- func (c *RestClient) ClosePositions(direct string) (string, error)
- func (c *RestClient) GetPendingAlgos() (string, error)
- func (c *RestClient) MarketTicker(instId string) (*MarketTicker, error)
- func (c *RestClient) MarketTickers(instType InstrumentType) ([]MarketTicker, error)
- func (c *RestClient) OrdersHistory() (string, error)
- func (c *RestClient) OrdersHistoryMax(symbol string, options *types.TradeQueryOptions) (string, error)
- type SideType
- type TradeService
- func (c *TradeService) NewBatchCancelOrderRequest() *BatchCancelOrderRequest
- func (c *TradeService) NewBatchPlaceOrderRequest() *BatchPlaceOrderRequest
- func (c *TradeService) NewCancelOrderRequest() *CancelOrderRequest
- func (c *TradeService) NewGetAccountPostions() *GetPostionRequest
- func (c *TradeService) NewGetHistoryTrade() *GetHistoryRequest
- func (c *TradeService) NewGetOrderDetailsRequest() *GetOrderDetailsRequest
- func (c *TradeService) NewGetPendingOrderRequest() *GetPendingOrderRequest
- func (c *TradeService) NewGetTransactionDetailsRequest() *GetTransactionDetailsRequest
- func (c *TradeService) NewPlaceAlgoOrderRequest() *PlaceAlgoOrderRequest
- func (c *TradeService) NewPlaceOrderRequest() *PlaceOrderRequest
Constants ¶
View Source
const ( SideTypeBuy SideType = "buy" SideTypeSell SideType = "sell" PosSideTypeBuy PosSideType = "long" PosSideTypeSell PosSideType = "short" )
View Source
const PrivateWebSocketURL = "wss://ws.okx.com:8443/ws/v5/private"
View Source
const PrivateWebSocketURLTest = "wss://wspap.okx.com:8443/ws/v5/private?brokerId=9999"
View Source
const PublicWebSocketURL = "wss://ws.okx.com:8443/ws/v5/public"
View Source
const PublicWebSocketURLTest = "wss://wspap.okx.com:8443/ws/v5/public?brokerId=9999"
View Source
const RestBaseURL = "https://www.okx.com/"
Variables ¶
This section is empty.
Functions ¶
func PaperTrade ¶
func PaperTrade() bool
Types ¶
type Account ¶
type Account struct { TotalEquityInUSD fixedpoint.Value `json:"totalEq"` UpdateTime string `json:"uTime"` Details []BalanceDetail `json:"details"` }
type AlgoOrderResponse ¶
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 BalanceDetail ¶
type BalanceDetail struct { Currency string `json:"ccy"` Available fixedpoint.Value `json:"availEq"` CashBalance fixedpoint.Value `json:"cashBal"` OrderFrozen fixedpoint.Value `json:"ordFrozen"` Frozen fixedpoint.Value `json:"frozenBal"` Equity fixedpoint.Value `json:"eq"` EquityInUSD fixedpoint.Value `json:"eqUsd"` UpdateTime types.MillisecondTimestamp `json:"uTime"` UnrealizedProfitAndLoss fixedpoint.Value `json:"upl"` }
type BatchCancelOrderRequest ¶
type BatchCancelOrderRequest struct {
// contains filtered or unexported fields
}
func (*BatchCancelOrderRequest) Add ¶
func (r *BatchCancelOrderRequest) Add(reqs ...*CancelOrderRequest) *BatchCancelOrderRequest
func (*BatchCancelOrderRequest) Do ¶
func (r *BatchCancelOrderRequest) Do(ctx context.Context) ([]OrderResponse, error)
type BatchPlaceOrderRequest ¶
type BatchPlaceOrderRequest struct {
// contains filtered or unexported fields
}
func (*BatchPlaceOrderRequest) Add ¶
func (r *BatchPlaceOrderRequest) Add(reqs ...*PlaceOrderRequest) *BatchPlaceOrderRequest
func (*BatchPlaceOrderRequest) Do ¶
func (r *BatchPlaceOrderRequest) Do(ctx context.Context) ([]OrderResponse, error)
type CancelOrderRequest ¶
type CancelOrderRequest struct {
// contains filtered or unexported fields
}
func (*CancelOrderRequest) ClientOrderID ¶
func (c *CancelOrderRequest) ClientOrderID(clientOrderID string) *CancelOrderRequest
func (*CancelOrderRequest) Do ¶
func (r *CancelOrderRequest) Do(ctx context.Context) ([]OrderResponse, error)
func (*CancelOrderRequest) GetParameters ¶
func (c *CancelOrderRequest) GetParameters() (map[string]interface{}, error)
func (*CancelOrderRequest) GetParametersJSON ¶
func (c *CancelOrderRequest) GetParametersJSON() ([]byte, error)
func (*CancelOrderRequest) GetParametersQuery ¶
func (c *CancelOrderRequest) GetParametersQuery() (url.Values, error)
func (*CancelOrderRequest) InstrumentID ¶
func (c *CancelOrderRequest) InstrumentID(instrumentID string) *CancelOrderRequest
func (*CancelOrderRequest) OrderID ¶
func (c *CancelOrderRequest) OrderID(orderID string) *CancelOrderRequest
func (*CancelOrderRequest) Parameters ¶
func (r *CancelOrderRequest) Parameters() map[string]interface{}
type Candle ¶
type Candle struct { InstrumentID string Interval string Time time.Time Open fixedpoint.Value High fixedpoint.Value Low fixedpoint.Value Close fixedpoint.Value Volume fixedpoint.Value VolumeInCurrency fixedpoint.Value }
type CandlesticksRequest ¶
type CandlesticksRequest struct {
// contains filtered or unexported fields
}
func (*CandlesticksRequest) After ¶
func (r *CandlesticksRequest) After(after int64) *CandlesticksRequest
func (*CandlesticksRequest) Bar ¶
func (r *CandlesticksRequest) Bar(bar string) *CandlesticksRequest
func (*CandlesticksRequest) Before ¶
func (r *CandlesticksRequest) Before(before int64) *CandlesticksRequest
func (*CandlesticksRequest) Do ¶
func (r *CandlesticksRequest) Do(ctx context.Context) ([]Candle, error)
func (*CandlesticksRequest) InstrumentID ¶
func (r *CandlesticksRequest) InstrumentID(instId string) *CandlesticksRequest
func (*CandlesticksRequest) Limit ¶
func (r *CandlesticksRequest) Limit(limit int) *CandlesticksRequest
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 GetFundingRateRequest ¶
type GetFundingRateRequest struct {
// contains filtered or unexported fields
}
func (*GetFundingRateRequest) Do ¶
func (r *GetFundingRateRequest) Do(ctx context.Context) (*FundingRate, error)
func (*GetFundingRateRequest) InstrumentID ¶
func (r *GetFundingRateRequest) InstrumentID(instId string) *GetFundingRateRequest
type GetHistoryRequest ¶
type GetHistoryRequest struct {
// contains filtered or unexported fields
}
func (*GetHistoryRequest) Do ¶
func (r *GetHistoryRequest) Do(ctx context.Context) ([]OrderDetails, error)
func (*GetHistoryRequest) InstrumentID ¶
func (r *GetHistoryRequest) InstrumentID(instId string) *GetHistoryRequest
func (*GetHistoryRequest) InstrumentType ¶
func (r *GetHistoryRequest) InstrumentType(instType InstrumentType) *GetHistoryRequest
func (*GetHistoryRequest) Parameters ¶
func (r *GetHistoryRequest) Parameters() url.Values
type GetInstrumentsRequest ¶
type GetInstrumentsRequest struct {
// contains filtered or unexported fields
}
func (*GetInstrumentsRequest) Do ¶
func (r *GetInstrumentsRequest) Do(ctx context.Context) ([]Instrument, error)
func (*GetInstrumentsRequest) InstrumentID ¶
func (r *GetInstrumentsRequest) InstrumentID(instId string) *GetInstrumentsRequest
func (*GetInstrumentsRequest) InstrumentType ¶
func (r *GetInstrumentsRequest) InstrumentType(instType InstrumentType) *GetInstrumentsRequest
type GetOrderDetailsRequest ¶
type GetOrderDetailsRequest struct {
// contains filtered or unexported fields
}
func (*GetOrderDetailsRequest) ClientOrderID ¶
func (r *GetOrderDetailsRequest) ClientOrderID(clientOrderID string) *GetOrderDetailsRequest
func (*GetOrderDetailsRequest) Do ¶
func (r *GetOrderDetailsRequest) Do(ctx context.Context) (*OrderDetails, error)
func (*GetOrderDetailsRequest) InstrumentID ¶
func (r *GetOrderDetailsRequest) InstrumentID(instId string) *GetOrderDetailsRequest
func (*GetOrderDetailsRequest) OrderID ¶
func (r *GetOrderDetailsRequest) OrderID(orderID string) *GetOrderDetailsRequest
func (*GetOrderDetailsRequest) QueryParameters ¶
func (r *GetOrderDetailsRequest) QueryParameters() url.Values
type GetPendingOrderRequest ¶
type GetPendingOrderRequest struct {
// contains filtered or unexported fields
}
func (*GetPendingOrderRequest) AddOrderTypes ¶
func (r *GetPendingOrderRequest) AddOrderTypes(orderTypes ...string) *GetPendingOrderRequest
func (*GetPendingOrderRequest) Do ¶
func (r *GetPendingOrderRequest) Do(ctx context.Context) ([]OrderDetails, error)
func (*GetPendingOrderRequest) InstrumentID ¶
func (r *GetPendingOrderRequest) InstrumentID(instId string) *GetPendingOrderRequest
func (*GetPendingOrderRequest) InstrumentType ¶
func (r *GetPendingOrderRequest) InstrumentType(instType InstrumentType) *GetPendingOrderRequest
func (*GetPendingOrderRequest) OrderTypes ¶
func (r *GetPendingOrderRequest) OrderTypes(orderTypes []string) *GetPendingOrderRequest
func (*GetPendingOrderRequest) Parameters ¶
func (r *GetPendingOrderRequest) Parameters() map[string]interface{}
func (*GetPendingOrderRequest) State ¶
func (r *GetPendingOrderRequest) State(state OrderState) *GetPendingOrderRequest
type GetPostionRequest ¶
type GetPostionRequest struct {
// contains filtered or unexported fields
}
func (*GetPostionRequest) Do ¶
func (r *GetPostionRequest) Do(ctx context.Context) ([]*Postions, error)
func (*GetPostionRequest) InstrumentID ¶
func (r *GetPostionRequest) InstrumentID(instId string) *GetPostionRequest
func (*GetPostionRequest) InstrumentType ¶
func (r *GetPostionRequest) InstrumentType(instType InstrumentType) *GetPostionRequest
func (*GetPostionRequest) Parameters ¶
func (r *GetPostionRequest) Parameters() map[string]interface{}
func (*GetPostionRequest) PosId ¶
func (r *GetPostionRequest) PosId(posId string) *GetPostionRequest
type GetTransactionDetailsRequest ¶
type GetTransactionDetailsRequest struct {
// contains filtered or unexported fields
}
func (*GetTransactionDetailsRequest) Do ¶
func (r *GetTransactionDetailsRequest) Do(ctx context.Context) ([]OrderDetails, error)
func (*GetTransactionDetailsRequest) InstrumentID ¶
func (r *GetTransactionDetailsRequest) InstrumentID(instId string) *GetTransactionDetailsRequest
func (*GetTransactionDetailsRequest) InstrumentType ¶
func (r *GetTransactionDetailsRequest) InstrumentType(instType InstrumentType) *GetTransactionDetailsRequest
func (*GetTransactionDetailsRequest) OrderID ¶
func (r *GetTransactionDetailsRequest) OrderID(orderID string) *GetTransactionDetailsRequest
func (*GetTransactionDetailsRequest) Parameters ¶
func (r *GetTransactionDetailsRequest) Parameters() map[string]interface{}
type Instrument ¶
type Instrument 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"` // 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" )
type MarketDataService ¶
type MarketDataService struct {
// contains filtered or unexported fields
}
func (*MarketDataService) NewCandlesticksRequest ¶
func (c *MarketDataService) NewCandlesticksRequest(instId string) *CandlesticksRequest
func (*MarketDataService) NewMarketTickerRequest ¶
func (c *MarketDataService) NewMarketTickerRequest(instId string) *MarketTickerRequest
func (*MarketDataService) NewMarketTickersRequest ¶
func (c *MarketDataService) NewMarketTickersRequest(instType string) *MarketTickersRequest
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 (r *MarketTickerRequest) Do(ctx context.Context) (*MarketTicker, error)
func (*MarketTickerRequest) InstrumentID ¶
func (r *MarketTickerRequest) InstrumentID(instId string) *MarketTickerRequest
type MarketTickersRequest ¶
type MarketTickersRequest struct {
// contains filtered or unexported fields
}
func (*MarketTickersRequest) Do ¶
func (r *MarketTickersRequest) Do(ctx context.Context) ([]MarketTicker, error)
func (*MarketTickersRequest) InstrumentType ¶
func (r *MarketTickersRequest) InstrumentType(instType string) *MarketTickersRequest
type OrderDetails ¶
type OrderDetails struct { InstrumentType string `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"` // 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"` BaseCurrency string `json:"tgtCcy"` // 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 OrderResponse ¶
type OrderState ¶
type OrderState string
const ( OrderStateCanceled OrderState = "canceled" OrderStateLive OrderState = "live" OrderStatePartiallyFilled OrderState = "partially_filled" OrderStateFilled OrderState = "filled" )
type OrderType ¶
type OrderType string
const ( OrderTypeMarket OrderType = "market" OrderTypeLimit OrderType = "limit" OrderTypeStopLimit OrderType = "STOP_LIMIT" OrderTypeStopMarket OrderType = "STOP_MARKET" OrderTypeTakeProfitLimit OrderType = "TAKE_PROFIT_LIMIT" OrderTypeTakeProfitMarket OrderType = "TAKE_PROFIT_MARKET" OrderTypeConditional OrderType = "conditional" OrderTypePostOnly OrderType = "post_only" OrderTypeFOK OrderType = "fok" OrderTypeIOC OrderType = "ioc" )
type PlaceAlgoOrderRequest ¶
type PlaceAlgoOrderRequest struct { TpTriggerPx string `param:"tpTriggerPx"` TpOrdPx string `param:"tpOrdPx"` TpTriggerPxType string `param:"tpTriggerPxType" validValues:"last,index,mark"` SlTriggerPx string `param:"slTriggerPx"` SlOrdPx string `param:"slOrdPx"` SlTriggerPxType string `param:"slTriggerPxType" validValues:"last,index,mark"` // contains filtered or unexported fields }
func (*PlaceAlgoOrderRequest) Ccy ¶
func (p *PlaceAlgoOrderRequest) Ccy(ccy string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) ClientOrderID ¶
func (p *PlaceAlgoOrderRequest) ClientOrderID(clientOrderID string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) Do ¶
func (r *PlaceAlgoOrderRequest) Do(ctx context.Context) (*AlgoOrderResponse, error)
func (*PlaceAlgoOrderRequest) GetParameters ¶
func (p *PlaceAlgoOrderRequest) GetParameters() (map[string]interface{}, error)
GetParameters builds and checks the parameters and return the result in a map object
func (*PlaceAlgoOrderRequest) GetParametersJSON ¶
func (p *PlaceAlgoOrderRequest) GetParametersJSON() ([]byte, error)
GetParametersJSON converts the parameters from GetParameters into the JSON format
func (*PlaceAlgoOrderRequest) GetParametersQuery ¶
func (p *PlaceAlgoOrderRequest) GetParametersQuery() (url.Values, error)
GetParametersQuery converts the parameters from GetParameters into the url.Values format
func (*PlaceAlgoOrderRequest) GetQueryParameters ¶
func (p *PlaceAlgoOrderRequest) GetQueryParameters() (url.Values, error)
GetQueryParameters builds and checks the query parameters and returns url.Values
func (*PlaceAlgoOrderRequest) GetSlugParameters ¶
func (p *PlaceAlgoOrderRequest) GetSlugParameters() (map[string]interface{}, error)
GetSlugParameters builds and checks the slug parameters and return the result in a map object
func (*PlaceAlgoOrderRequest) GetSlugsMap ¶
func (p *PlaceAlgoOrderRequest) GetSlugsMap() (map[string]string, error)
func (*PlaceAlgoOrderRequest) InstrumentID ¶
func (p *PlaceAlgoOrderRequest) InstrumentID(instrumentID string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) OrderType ¶
func (p *PlaceAlgoOrderRequest) OrderType(orderType OrderType) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) Parameters ¶
func (r *PlaceAlgoOrderRequest) Parameters() map[string]interface{}
func (*PlaceAlgoOrderRequest) PosSide ¶
func (p *PlaceAlgoOrderRequest) PosSide(posSide PosSideType) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) Price ¶
func (p *PlaceAlgoOrderRequest) Price(price string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) Quantity ¶
func (p *PlaceAlgoOrderRequest) Quantity(quantity string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) ReduceOnly ¶
func (p *PlaceAlgoOrderRequest) ReduceOnly(reduceOnly bool) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) SetSlOrdPx ¶
func (p *PlaceAlgoOrderRequest) SetSlOrdPx(SlOrdPx string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) SetSlTriggerPx ¶
func (p *PlaceAlgoOrderRequest) SetSlTriggerPx(SlTriggerPx string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) SetSlTriggerPxType ¶
func (p *PlaceAlgoOrderRequest) SetSlTriggerPxType(SlTriggerPxType string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) SetTpOrdPx ¶
func (p *PlaceAlgoOrderRequest) SetTpOrdPx(TpOrdPx string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) SetTpTriggerPx ¶
func (p *PlaceAlgoOrderRequest) SetTpTriggerPx(TpTriggerPx string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) SetTpTriggerPxType ¶
func (p *PlaceAlgoOrderRequest) SetTpTriggerPxType(TpTriggerPxType string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) Side ¶
func (p *PlaceAlgoOrderRequest) Side(side SideType) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) Tag ¶
func (p *PlaceAlgoOrderRequest) Tag(tag string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) TgtCcy ¶
func (p *PlaceAlgoOrderRequest) TgtCcy(tgtCcy string) *PlaceAlgoOrderRequest
func (*PlaceAlgoOrderRequest) TradeMode ¶
func (p *PlaceAlgoOrderRequest) TradeMode(tradeMode string) *PlaceAlgoOrderRequest
type PlaceOrderRequest ¶
type PlaceOrderRequest struct {
// contains filtered or unexported fields
}
func (*PlaceOrderRequest) CCY ¶
func (p *PlaceOrderRequest) CCY(ccy string) *PlaceOrderRequest
func (*PlaceOrderRequest) ClientOrderID ¶
func (p *PlaceOrderRequest) ClientOrderID(clientOrderID string) *PlaceOrderRequest
func (*PlaceOrderRequest) Do ¶
func (r *PlaceOrderRequest) Do(ctx context.Context) (*OrderResponse, error)
func (*PlaceOrderRequest) GetParameters ¶
func (p *PlaceOrderRequest) GetParameters() (map[string]interface{}, error)
func (*PlaceOrderRequest) GetParametersJSON ¶
func (p *PlaceOrderRequest) GetParametersJSON() ([]byte, error)
func (*PlaceOrderRequest) GetParametersQuery ¶
func (p *PlaceOrderRequest) GetParametersQuery() (url.Values, error)
func (*PlaceOrderRequest) InstrumentID ¶
func (p *PlaceOrderRequest) InstrumentID(instrumentID string) *PlaceOrderRequest
func (*PlaceOrderRequest) OrderType ¶
func (p *PlaceOrderRequest) OrderType(orderType OrderType) *PlaceOrderRequest
func (*PlaceOrderRequest) Parameters ¶
func (r *PlaceOrderRequest) Parameters() map[string]interface{}
func (*PlaceOrderRequest) PosSide ¶
func (p *PlaceOrderRequest) PosSide(side PosSideType) *PlaceOrderRequest
func (*PlaceOrderRequest) Price ¶
func (p *PlaceOrderRequest) Price(price string) *PlaceOrderRequest
func (*PlaceOrderRequest) Quantity ¶
func (p *PlaceOrderRequest) Quantity(quantity string) *PlaceOrderRequest
func (*PlaceOrderRequest) ReduceOnly ¶
func (p *PlaceOrderRequest) ReduceOnly(reduceOnly bool) *PlaceOrderRequest
func (*PlaceOrderRequest) Side ¶
func (p *PlaceOrderRequest) Side(side SideType) *PlaceOrderRequest
func (*PlaceOrderRequest) Tag ¶
func (p *PlaceOrderRequest) Tag(tag string) *PlaceOrderRequest
func (*PlaceOrderRequest) TgtCcy ¶
func (p *PlaceOrderRequest) TgtCcy(tgtCcy string) *PlaceOrderRequest
func (*PlaceOrderRequest) TradeMode ¶
func (p *PlaceOrderRequest) TradeMode(tradeMode string) *PlaceOrderRequest
type PosSideType ¶
type PosSideType string
type PublicDataService ¶
type PublicDataService struct {
// contains filtered or unexported fields
}
func (*PublicDataService) NewGetFundingRate ¶
func (s *PublicDataService) NewGetFundingRate() *GetFundingRateRequest
func (*PublicDataService) NewGetInstrumentsRequest ¶
func (s *PublicDataService) NewGetInstrumentsRequest() *GetInstrumentsRequest
type RestClient ¶
type RestClient struct { BaseURL *url.URL Key, Secret, Passphrase string TradeService *TradeService PublicDataService *PublicDataService MarketDataService *MarketDataService // contains filtered or unexported fields }
func NewClient ¶
func NewClient() *RestClient
func (*RestClient) AccountBalances ¶
func (c *RestClient) AccountBalances() (*Account, error)
func (*RestClient) AccountPositions ¶
func (c *RestClient) AccountPositions() (string, error)
func (*RestClient) AssetBalances ¶
func (c *RestClient) AssetBalances() (AssetBalanceList, error)
func (*RestClient) AssetCurrencies ¶
func (c *RestClient) AssetCurrencies() ([]AssetCurrency, error)
func (*RestClient) Auth ¶
func (c *RestClient) Auth(key, secret, passphrase string)
func (*RestClient) CancelAlgos ¶
func (c *RestClient) CancelAlgos(orderid string) (string, error)
func (*RestClient) CancelPendingAlgos ¶
func (c *RestClient) CancelPendingAlgos(symbol string) (string, error)
批量撤单
func (*RestClient) ClosePositions ¶
func (c *RestClient) ClosePositions(direct string) (string, error)
市价平仓
func (*RestClient) MarketTicker ¶
func (c *RestClient) MarketTicker(instId string) (*MarketTicker, error)
func (*RestClient) MarketTickers ¶
func (c *RestClient) MarketTickers(instType InstrumentType) ([]MarketTicker, error)
func (*RestClient) OrdersHistory ¶
func (c *RestClient) OrdersHistory() (string, error)
func (*RestClient) OrdersHistoryMax ¶
func (c *RestClient) OrdersHistoryMax(symbol string, options *types.TradeQueryOptions) (string, error)
type TradeService ¶
type TradeService struct {
// contains filtered or unexported fields
}
func (*TradeService) NewBatchCancelOrderRequest ¶
func (c *TradeService) NewBatchCancelOrderRequest() *BatchCancelOrderRequest
func (*TradeService) NewBatchPlaceOrderRequest ¶
func (c *TradeService) NewBatchPlaceOrderRequest() *BatchPlaceOrderRequest
func (*TradeService) NewCancelOrderRequest ¶
func (c *TradeService) NewCancelOrderRequest() *CancelOrderRequest
func (*TradeService) NewGetAccountPostions ¶
func (c *TradeService) NewGetAccountPostions() *GetPostionRequest
func (*TradeService) NewGetHistoryTrade ¶
func (c *TradeService) NewGetHistoryTrade() *GetHistoryRequest
func (*TradeService) NewGetOrderDetailsRequest ¶
func (c *TradeService) NewGetOrderDetailsRequest() *GetOrderDetailsRequest
func (*TradeService) NewGetPendingOrderRequest ¶
func (c *TradeService) NewGetPendingOrderRequest() *GetPendingOrderRequest
func (*TradeService) NewGetTransactionDetailsRequest ¶
func (c *TradeService) NewGetTransactionDetailsRequest() *GetTransactionDetailsRequest
func (*TradeService) NewPlaceAlgoOrderRequest ¶
func (c *TradeService) NewPlaceAlgoOrderRequest() *PlaceAlgoOrderRequest
func (*TradeService) NewPlaceOrderRequest ¶
func (c *TradeService) NewPlaceOrderRequest() *PlaceOrderRequest
Click to show internal directories.
Click to hide internal directories.