Documentation
¶
Index ¶
- Constants
- func FormatTimestamp(t time.Time) int64
- func PrettyPrint(i interface{}) string
- type BaseThirdPartyMessage
- type CancelMasterOrderReply
- type CancelMasterOrderService
- func (s *CancelMasterOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CancelMasterOrderReply, err error)
- func (s *CancelMasterOrderService) MasterOrderId(masterOrderId string) *CancelMasterOrderService
- func (s *CancelMasterOrderService) Reason(reason string) *CancelMasterOrderService
- type Client
- func (c *Client) NewCancelMasterOrderService() *CancelMasterOrderService
- func (c *Client) NewCreateListenKeyService() *CreateListenKeyService
- func (c *Client) NewCreateMasterOrderService() *CreateMasterOrderService
- func (c *Client) NewGetMasterOrdersService() *GetMasterOrdersService
- func (c *Client) NewGetOrderFillsService() *GetOrderFillsService
- func (c *Client) NewListExchangeApisService() *ListExchangeApisService
- func (c *Client) NewPingServer() *PingService
- func (c *Client) NewTimestampService() *TimestampService
- func (c *Client) NewTradingPairsService() *TradingPairsService
- func (c *Client) NewWebSocketService() *WebSocketService
- type ClientMessageType
- type ClientPushMessage
- type CreateListenKeyReply
- type CreateListenKeyService
- type CreateMasterOrderReply
- type CreateMasterOrderService
- func (s *CreateMasterOrderService) Algorithm(algorithm trading_enums.Algorithm) *CreateMasterOrderService
- func (s *CreateMasterOrderService) ApiKeyId(apiKeyId string) *CreateMasterOrderService
- func (s *CreateMasterOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateMasterOrderReply, err error)
- func (s *CreateMasterOrderService) EndTime(endTime string) *CreateMasterOrderService
- func (s *CreateMasterOrderService) Exchange(exchange trading_enums.Exchange) *CreateMasterOrderService
- func (s *CreateMasterOrderService) ExecutionDuration(executionDuration int32) *CreateMasterOrderService
- func (s *CreateMasterOrderService) IsTargetPosition(isTargetPosition bool) *CreateMasterOrderService
- func (s *CreateMasterOrderService) LimitPrice(limitPrice float64) *CreateMasterOrderService
- func (s *CreateMasterOrderService) LowTolerance(lowTolerance string) *CreateMasterOrderService
- func (s *CreateMasterOrderService) MakerRateLimit(makerRateLimit float64) *CreateMasterOrderService
- func (s *CreateMasterOrderService) MarginType(marginType trading_enums.MarginType) *CreateMasterOrderService
- func (s *CreateMasterOrderService) MarketType(marketType trading_enums.MarketType) *CreateMasterOrderService
- func (s *CreateMasterOrderService) MustComplete(mustComplete bool) *CreateMasterOrderService
- func (s *CreateMasterOrderService) Notes(notes string) *CreateMasterOrderService
- func (s *CreateMasterOrderService) OrderNotional(orderNotional float64) *CreateMasterOrderService
- func (s *CreateMasterOrderService) PovLimit(povLimit float64) *CreateMasterOrderService
- func (s *CreateMasterOrderService) PovMinLimit(povMinLimit float64) *CreateMasterOrderService
- func (s *CreateMasterOrderService) ReduceOnly(reduceOnly bool) *CreateMasterOrderService
- func (s *CreateMasterOrderService) Side(side trading_enums.OrderSide) *CreateMasterOrderService
- func (s *CreateMasterOrderService) StartTime(startTime string) *CreateMasterOrderService
- func (s *CreateMasterOrderService) StrategyType(strategyType trading_enums.StrategyType) *CreateMasterOrderService
- func (s *CreateMasterOrderService) StrictUpBound(strictUpBound bool) *CreateMasterOrderService
- func (s *CreateMasterOrderService) Symbol(symbol string) *CreateMasterOrderService
- func (s *CreateMasterOrderService) TailOrderProtection(tailOrderProtection bool) *CreateMasterOrderService
- func (s *CreateMasterOrderService) TotalQuantity(totalQuantity float64) *CreateMasterOrderService
- func (s *CreateMasterOrderService) UpTolerance(upTolerance string) *CreateMasterOrderService
- type ExchangeApiInfo
- type FillMessage
- type GetMasterOrdersReply
- type GetMasterOrdersService
- func (s *GetMasterOrdersService) Do(ctx context.Context, opts ...RequestOption) (res *GetMasterOrdersReply, err error)
- func (s *GetMasterOrdersService) EndTime(endTime string) *GetMasterOrdersService
- func (s *GetMasterOrdersService) Exchange(exchange string) *GetMasterOrdersService
- func (s *GetMasterOrdersService) Page(page int32) *GetMasterOrdersService
- func (s *GetMasterOrdersService) PageSize(pageSize int32) *GetMasterOrdersService
- func (s *GetMasterOrdersService) StartTime(startTime string) *GetMasterOrdersService
- func (s *GetMasterOrdersService) Status(status trading_enums.MasterOrderStatus) *GetMasterOrdersService
- func (s *GetMasterOrdersService) Symbol(symbol string) *GetMasterOrdersService
- type GetOrderFillsReply
- type GetOrderFillsService
- func (s *GetOrderFillsService) Do(ctx context.Context, opts ...RequestOption) (res *GetOrderFillsReply, err error)
- func (s *GetOrderFillsService) EndTime(endTime string) *GetOrderFillsService
- func (s *GetOrderFillsService) MasterOrderId(masterOrderId string) *GetOrderFillsService
- func (s *GetOrderFillsService) Page(page int32) *GetOrderFillsService
- func (s *GetOrderFillsService) PageSize(pageSize int32) *GetOrderFillsService
- func (s *GetOrderFillsService) StartTime(startTime string) *GetOrderFillsService
- func (s *GetOrderFillsService) SubOrderId(subOrderId string) *GetOrderFillsService
- func (s *GetOrderFillsService) Symbol(symbol string) *GetOrderFillsService
- type ListExchangeApisReply
- type ListExchangeApisService
- func (s *ListExchangeApisService) Do(ctx context.Context, opts ...RequestOption) (res *ListExchangeApisReply, err error)
- func (s *ListExchangeApisService) Exchange(exchange string) *ListExchangeApisService
- func (s *ListExchangeApisService) Page(page int32) *ListExchangeApisService
- func (s *ListExchangeApisService) PageSize(pageSize int32) *ListExchangeApisService
- type MasterOrderInfo
- type MasterOrderMessage
- type OrderFillInfo
- type OrderMessage
- type PingService
- type RequestOption
- type ThirdPartyMessageType
- type TimeInForceType
- type TimestampMessage
- type TimestampService
- type TradingPairMessage
- type TradingPairs
- type TradingPairsService
- func (s *TradingPairsService) Do(ctx context.Context, opts ...RequestOption) (res []*TradingPairs, err error)
- func (s *TradingPairsService) Exchange(exchange string) *TradingPairsService
- func (s *TradingPairsService) IsCoin(isCoin bool) *TradingPairsService
- func (s *TradingPairsService) MarketType(marketType trading_enums.TradingPairMarketType) *TradingPairsService
- func (s *TradingPairsService) Page(page int32) *TradingPairsService
- func (s *TradingPairsService) PageSize(pageSize int32) *TradingPairsService
- type UserDataEventType
- type WebSocketEventHandlers
- type WebSocketHandler
- type WebSocketService
- func (ws *WebSocketService) Close() error
- func (ws *WebSocketService) Connect(listenKey string) error
- func (ws *WebSocketService) IsConnected() bool
- func (ws *WebSocketService) SetHandlers(handlers *WebSocketEventHandlers) *WebSocketService
- func (ws *WebSocketService) SetLogger(logger *log.Logger) *WebSocketService
- func (ws *WebSocketService) SetPingInterval(interval time.Duration) *WebSocketService
- func (ws *WebSocketService) SetPongTimeout(timeout time.Duration) *WebSocketService
- func (ws *WebSocketService) SetReconnectDelay(delay time.Duration) *WebSocketService
Constants ¶
const Name = "qe-connector-go"
const Version = "0.1.5"
Variables ¶
This section is empty.
Functions ¶
func FormatTimestamp ¶
FormatTimestamp formats a time into Unix timestamp in milliseconds, as requested by Binance.
func PrettyPrint ¶
func PrettyPrint(i interface{}) string
Types ¶
type BaseThirdPartyMessage ¶
type BaseThirdPartyMessage struct {
Type ThirdPartyMessageType `json:"type"`
}
BaseThirdPartyMessage 基础第三方消息接口
type CancelMasterOrderReply ¶
type CancelMasterOrderReply struct { Success bool `json:"success"` Message string `json:"message"` }
CancelMasterOrderReply cancel master order response
type CancelMasterOrderService ¶
type CancelMasterOrderService struct {
// contains filtered or unexported fields
}
CancelMasterOrderService cancel master order
func (*CancelMasterOrderService) Do ¶
func (s *CancelMasterOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CancelMasterOrderReply, err error)
Do send request
func (*CancelMasterOrderService) MasterOrderId ¶
func (s *CancelMasterOrderService) MasterOrderId(masterOrderId string) *CancelMasterOrderService
MasterOrderId set masterOrderId
func (*CancelMasterOrderService) Reason ¶
func (s *CancelMasterOrderService) Reason(reason string) *CancelMasterOrderService
Reason set reason
type Client ¶
type Client struct { APIKey string SecretKey string BaseURL string HTTPClient *http.Client Debug bool Logger *log.Logger TimeOffset int64 // contains filtered or unexported fields }
Client define API client
func NewTestClient ¶
NewTestClient Create client function for initialising new QE Test client
func (*Client) NewCancelMasterOrderService ¶
func (c *Client) NewCancelMasterOrderService() *CancelMasterOrderService
func (*Client) NewCreateListenKeyService ¶
func (c *Client) NewCreateListenKeyService() *CreateListenKeyService
func (*Client) NewCreateMasterOrderService ¶
func (c *Client) NewCreateMasterOrderService() *CreateMasterOrderService
func (*Client) NewGetMasterOrdersService ¶
func (c *Client) NewGetMasterOrdersService() *GetMasterOrdersService
func (*Client) NewGetOrderFillsService ¶
func (c *Client) NewGetOrderFillsService() *GetOrderFillsService
func (*Client) NewListExchangeApisService ¶
func (c *Client) NewListExchangeApisService() *ListExchangeApisService
func (*Client) NewPingServer ¶
func (c *Client) NewPingServer() *PingService
func (*Client) NewTimestampService ¶
func (c *Client) NewTimestampService() *TimestampService
func (*Client) NewTradingPairsService ¶
func (c *Client) NewTradingPairsService() *TradingPairsService
func (*Client) NewWebSocketService ¶
func (c *Client) NewWebSocketService() *WebSocketService
NewWebSocketService create WebSocket service for real-time data streaming
type ClientMessageType ¶
type ClientMessageType string
ClientMessageType 客户端消息类型
const ( ClientDataType ClientMessageType = "data" ClientStatusType ClientMessageType = "status" ClientErrorType ClientMessageType = "error" ClientMasterDetailType ClientMessageType = "master_data" ClientOrderFillDetailType ClientMessageType = "order_data" )
type ClientPushMessage ¶
type ClientPushMessage struct { Type ClientMessageType `json:"type"` MessageId string `json:"messageId"` UserId string `json:"userId"` Data string `json:"data"` }
ClientPushMessage 客户端推送消息
type CreateListenKeyReply ¶
type CreateListenKeyReply struct { ListenKey string `json:"listenKey"` ExpireAt string `json:"expireAt"` Success bool `json:"success"` Message string `json:"message"` }
CreateListenKeyReply create listen key response
type CreateListenKeyService ¶
type CreateListenKeyService struct {
// contains filtered or unexported fields
}
CreateListenKeyService create listen key
func (*CreateListenKeyService) Do ¶
func (s *CreateListenKeyService) Do(ctx context.Context, opts ...RequestOption) (res *CreateListenKeyReply, err error)
Do send request
type CreateMasterOrderReply ¶
type CreateMasterOrderReply struct { MasterOrderId string `json:"masterOrderId"` Success bool `json:"success"` Message string `json:"message"` }
CreateMasterOrderReply create master order response
type CreateMasterOrderService ¶
type CreateMasterOrderService struct {
// contains filtered or unexported fields
}
CreateMasterOrderService create master order
func (*CreateMasterOrderService) Algorithm ¶
func (s *CreateMasterOrderService) Algorithm(algorithm trading_enums.Algorithm) *CreateMasterOrderService
Algorithm set algorithm
func (*CreateMasterOrderService) ApiKeyId ¶
func (s *CreateMasterOrderService) ApiKeyId(apiKeyId string) *CreateMasterOrderService
ApiKeyId set apiKeyId
func (*CreateMasterOrderService) Do ¶
func (s *CreateMasterOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateMasterOrderReply, err error)
Do send request
func (*CreateMasterOrderService) EndTime ¶
func (s *CreateMasterOrderService) EndTime(endTime string) *CreateMasterOrderService
EndTime set endTime
func (*CreateMasterOrderService) Exchange ¶
func (s *CreateMasterOrderService) Exchange(exchange trading_enums.Exchange) *CreateMasterOrderService
Exchange set exchange
func (*CreateMasterOrderService) ExecutionDuration ¶
func (s *CreateMasterOrderService) ExecutionDuration(executionDuration int32) *CreateMasterOrderService
ExecutionDuration set executionDuration
func (*CreateMasterOrderService) IsTargetPosition ¶
func (s *CreateMasterOrderService) IsTargetPosition(isTargetPosition bool) *CreateMasterOrderService
IsTargetPosition set tailOrderProtection
func (*CreateMasterOrderService) LimitPrice ¶
func (s *CreateMasterOrderService) LimitPrice(limitPrice float64) *CreateMasterOrderService
LimitPrice set limitPrice
func (*CreateMasterOrderService) LowTolerance ¶
func (s *CreateMasterOrderService) LowTolerance(lowTolerance string) *CreateMasterOrderService
LowTolerance set lowTolerance
func (*CreateMasterOrderService) MakerRateLimit ¶
func (s *CreateMasterOrderService) MakerRateLimit(makerRateLimit float64) *CreateMasterOrderService
MakerRateLimit set makerRateLimit
func (*CreateMasterOrderService) MarginType ¶
func (s *CreateMasterOrderService) MarginType(marginType trading_enums.MarginType) *CreateMasterOrderService
MarginType set marginType
func (*CreateMasterOrderService) MarketType ¶
func (s *CreateMasterOrderService) MarketType(marketType trading_enums.MarketType) *CreateMasterOrderService
MarketType set marketType
func (*CreateMasterOrderService) MustComplete ¶
func (s *CreateMasterOrderService) MustComplete(mustComplete bool) *CreateMasterOrderService
MustComplete set mustComplete
func (*CreateMasterOrderService) Notes ¶
func (s *CreateMasterOrderService) Notes(notes string) *CreateMasterOrderService
Notes set notes
func (*CreateMasterOrderService) OrderNotional ¶
func (s *CreateMasterOrderService) OrderNotional(orderNotional float64) *CreateMasterOrderService
OrderNotional set orderNotional
func (*CreateMasterOrderService) PovLimit ¶
func (s *CreateMasterOrderService) PovLimit(povLimit float64) *CreateMasterOrderService
PovLimit set povLimit
func (*CreateMasterOrderService) PovMinLimit ¶
func (s *CreateMasterOrderService) PovMinLimit(povMinLimit float64) *CreateMasterOrderService
PovMinLimit set povMinLimit
func (*CreateMasterOrderService) ReduceOnly ¶
func (s *CreateMasterOrderService) ReduceOnly(reduceOnly bool) *CreateMasterOrderService
ReduceOnly set reduceOnly
func (*CreateMasterOrderService) Side ¶
func (s *CreateMasterOrderService) Side(side trading_enums.OrderSide) *CreateMasterOrderService
Side set side
func (*CreateMasterOrderService) StartTime ¶
func (s *CreateMasterOrderService) StartTime(startTime string) *CreateMasterOrderService
StartTime set startTime
func (*CreateMasterOrderService) StrategyType ¶
func (s *CreateMasterOrderService) StrategyType(strategyType trading_enums.StrategyType) *CreateMasterOrderService
StrategyType set strategyType
func (*CreateMasterOrderService) StrictUpBound ¶
func (s *CreateMasterOrderService) StrictUpBound(strictUpBound bool) *CreateMasterOrderService
StrictUpBound set strictUpBound
func (*CreateMasterOrderService) Symbol ¶
func (s *CreateMasterOrderService) Symbol(symbol string) *CreateMasterOrderService
Symbol set symbol
func (*CreateMasterOrderService) TailOrderProtection ¶
func (s *CreateMasterOrderService) TailOrderProtection(tailOrderProtection bool) *CreateMasterOrderService
TailOrderProtection set tailOrderProtection
func (*CreateMasterOrderService) TotalQuantity ¶
func (s *CreateMasterOrderService) TotalQuantity(totalQuantity float64) *CreateMasterOrderService
TotalQuantity set totalQuantity
func (*CreateMasterOrderService) UpTolerance ¶
func (s *CreateMasterOrderService) UpTolerance(upTolerance string) *CreateMasterOrderService
UpTolerance set upTolerance
type ExchangeApiInfo ¶
type ExchangeApiInfo struct { Id string `json:"id"` CreatedAt string `json:"createdAt"` AccountName string `json:"accountName"` Exchange string `json:"exchange"` ApiKey string `json:"apiKey"` VerificationMethod string `json:"verificationMethod"` Balance float64 `json:"balance"` Status string `json:"status"` IsValid bool `json:"isValid"` IsTradingEnabled bool `json:"isTradingEnabled"` IsDefault bool `json:"isDefault"` IsPm bool `json:"isPm"` }
ExchangeApiInfo exchange API info
type FillMessage ¶
type FillMessage struct { Type ThirdPartyMessageType `json:"type"` MasterOrderID string `json:"master_order_id"` OrderID string `json:"order_id"` Symbol string `json:"symbol"` Category string `json:"category"` Side string `json:"side"` FillPrice float64 `json:"fill_price"` FilledQty float64 `json:"filled_qty"` FillTime int64 `json:"fill_time"` Timestamp int64 `json:"timestamp"` }
FillMessage 成交消息
type GetMasterOrdersReply ¶
type GetMasterOrdersReply struct { Items []MasterOrderInfo `json:"items"` Total string `json:"total"` Page int32 `json:"page"` PageSize int32 `json:"pageSize"` }
GetMasterOrdersReply get master orders response
type GetMasterOrdersService ¶
type GetMasterOrdersService struct {
// contains filtered or unexported fields
}
GetMasterOrdersService get master orders
func (*GetMasterOrdersService) Do ¶
func (s *GetMasterOrdersService) Do(ctx context.Context, opts ...RequestOption) (res *GetMasterOrdersReply, err error)
Do send request
func (*GetMasterOrdersService) EndTime ¶
func (s *GetMasterOrdersService) EndTime(endTime string) *GetMasterOrdersService
EndTime set endTime
func (*GetMasterOrdersService) Exchange ¶
func (s *GetMasterOrdersService) Exchange(exchange string) *GetMasterOrdersService
Exchange set exchange
func (*GetMasterOrdersService) Page ¶
func (s *GetMasterOrdersService) Page(page int32) *GetMasterOrdersService
Page set page
func (*GetMasterOrdersService) PageSize ¶
func (s *GetMasterOrdersService) PageSize(pageSize int32) *GetMasterOrdersService
PageSize set pageSize
func (*GetMasterOrdersService) StartTime ¶
func (s *GetMasterOrdersService) StartTime(startTime string) *GetMasterOrdersService
StartTime set startTime
func (*GetMasterOrdersService) Status ¶
func (s *GetMasterOrdersService) Status(status trading_enums.MasterOrderStatus) *GetMasterOrdersService
Status set status
func (*GetMasterOrdersService) Symbol ¶
func (s *GetMasterOrdersService) Symbol(symbol string) *GetMasterOrdersService
Symbol set symbol
type GetOrderFillsReply ¶
type GetOrderFillsReply struct { Items []OrderFillInfo `json:"items"` Total string `json:"total"` Page int32 `json:"page"` PageSize int32 `json:"pageSize"` }
GetOrderFillsReply get order fills response
type GetOrderFillsService ¶
type GetOrderFillsService struct {
// contains filtered or unexported fields
}
GetOrderFillsService get order fills
func (*GetOrderFillsService) Do ¶
func (s *GetOrderFillsService) Do(ctx context.Context, opts ...RequestOption) (res *GetOrderFillsReply, err error)
Do send request
func (*GetOrderFillsService) EndTime ¶
func (s *GetOrderFillsService) EndTime(endTime string) *GetOrderFillsService
EndTime set endTime
func (*GetOrderFillsService) MasterOrderId ¶
func (s *GetOrderFillsService) MasterOrderId(masterOrderId string) *GetOrderFillsService
MasterOrderId set masterOrderId
func (*GetOrderFillsService) Page ¶
func (s *GetOrderFillsService) Page(page int32) *GetOrderFillsService
Page set page
func (*GetOrderFillsService) PageSize ¶
func (s *GetOrderFillsService) PageSize(pageSize int32) *GetOrderFillsService
PageSize set pageSize
func (*GetOrderFillsService) StartTime ¶
func (s *GetOrderFillsService) StartTime(startTime string) *GetOrderFillsService
StartTime set startTime
func (*GetOrderFillsService) SubOrderId ¶
func (s *GetOrderFillsService) SubOrderId(subOrderId string) *GetOrderFillsService
SubOrderId set subOrderId
func (*GetOrderFillsService) Symbol ¶
func (s *GetOrderFillsService) Symbol(symbol string) *GetOrderFillsService
Symbol set symbol
type ListExchangeApisReply ¶
type ListExchangeApisReply struct { Items []ExchangeApiInfo `json:"items"` Total int32 `json:"total"` Page int32 `json:"page"` PageSize int32 `json:"pageSize"` }
ListExchangeApisReply list exchange APIs response
type ListExchangeApisService ¶
type ListExchangeApisService struct {
// contains filtered or unexported fields
}
ListExchangeApisService list exchange APIs
func (*ListExchangeApisService) Do ¶
func (s *ListExchangeApisService) Do(ctx context.Context, opts ...RequestOption) (res *ListExchangeApisReply, err error)
Do send request
func (*ListExchangeApisService) Exchange ¶
func (s *ListExchangeApisService) Exchange(exchange string) *ListExchangeApisService
Exchange set exchange
func (*ListExchangeApisService) Page ¶
func (s *ListExchangeApisService) Page(page int32) *ListExchangeApisService
Page set page
func (*ListExchangeApisService) PageSize ¶
func (s *ListExchangeApisService) PageSize(pageSize int32) *ListExchangeApisService
PageSize set pageSize
type MasterOrderInfo ¶
type MasterOrderInfo struct { MasterOrderId string `json:"masterOrderId"` Algorithm string `json:"algorithm"` AlgorithmType string `json:"algorithmType"` Exchange string `json:"exchange"` Symbol string `json:"symbol"` MarketType string `json:"marketType"` Side string `json:"side"` TotalQuantity float64 `json:"totalQuantity"` FilledQuantity float64 `json:"filledQuantity"` AveragePrice float64 `json:"averagePrice"` Status string `json:"status"` ExecutionDuration int32 `json:"executionDuration"` PriceLimit float64 `json:"priceLimit"` StartTime string `json:"startTime"` EndTime string `json:"endTime"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` Notes string `json:"notes"` MarginType string `json:"marginType"` ReduceOnly bool `json:"reduceOnly"` StrategyType string `json:"strategyType"` OrderNotional float64 `json:"orderNotional"` MustComplete bool `json:"mustComplete"` MakerRateLimit float64 `json:"makerRateLimit"` PovLimit float64 `json:"povLimit"` ClientId string `json:"clientId"` Date string `json:"date"` TicktimeInt string `json:"ticktimeInt"` LimitPriceString string `json:"limitPriceString"` UpTolerance string `json:"upTolerance"` LowTolerance string `json:"lowTolerance"` StrictUpBound bool `json:"strictUpBound"` TicktimeMs string `json:"ticktimeMs"` Category string `json:"category"` FilledAmount float64 `json:"filledAmount"` TotalValue float64 `json:"totalValue"` Base string `json:"base"` Quote string `json:"quote"` CompletionProgress float64 `json:"completionProgress"` Reason string `json:"reason"` }
MasterOrderInfo master order info
type MasterOrderMessage ¶
type MasterOrderMessage struct { Type ThirdPartyMessageType `json:"type"` MasterOrderID string `json:"master_order_id"` ClientID string `json:"client_id"` Strategy string `json:"strategy"` Symbol string `json:"symbol"` Side string `json:"side"` Qty float64 `json:"qty"` DurationSecs float64 `json:"duration_secs"` Category string `json:"category"` Action string `json:"action"` ReduceOnly bool `json:"reduce_only"` Status string `json:"status"` Date float64 `json:"date"` TicktimeInt int64 `json:"ticktime_int"` TicktimeMs int64 `json:"ticktime_ms"` Reason string `json:"reason"` Timestamp int64 `json:"timestamp"` }
MasterOrderMessage 主订单消息
type OrderFillInfo ¶
type OrderFillInfo struct { Id string `json:"id"` OrderCreatedTime string `json:"orderCreatedTime"` MasterOrderId string `json:"masterOrderId"` Exchange string `json:"exchange"` Category string `json:"category"` Symbol string `json:"symbol"` Side string `json:"side"` FilledValue float64 `json:"filledValue"` FilledQuantity float64 `json:"filledQuantity"` AvgPrice float64 `json:"avgPrice"` Price float64 `json:"price"` Fee float64 `json:"fee"` TradingAccount string `json:"tradingAccount"` Status string `json:"status"` RejectReason string `json:"rejectReason"` Base string `json:"base"` Quote string `json:"quote"` Type string `json:"type"` }
OrderFillInfo order fill info
type OrderMessage ¶
type OrderMessage struct { Type ThirdPartyMessageType `json:"type"` MasterOrderID string `json:"master_order_id"` OrderID string `json:"order_id"` Symbol string `json:"symbol"` Category string `json:"category"` Side string `json:"side"` Price float64 `json:"price"` Quantity float64 `json:"quantity"` Status string `json:"status"` CreatedTime int64 `json:"created_time"` FillQty float64 `json:"fill_qty"` FillPrice float64 `json:"fill_price"` CumFilledQty float64 `json:"cum_filled_qty"` QuantityRemaining float64 `json:"quantity_remaining"` AckTime int64 `json:"ack_time"` LastFillTime int64 `json:"last_fill_time"` CancelTime int64 `json:"cancel_time"` PriceType string `json:"price_type"` Reason string `json:"reason"` Timestamp int64 `json:"timestamp"` }
OrderMessage 订单消息
type PingService ¶
type PingService struct {
// contains filtered or unexported fields
}
PingService ping to server
func (*PingService) Do ¶
func (s *PingService) Do(ctx context.Context, opts ...RequestOption) (err error)
Do send request
type RequestOption ¶
type RequestOption func(*request)
RequestOption define option type for request
func WithRecvWindow ¶
func WithRecvWindow(recvWindow int64) RequestOption
Append `WithRecvWindow(insert_recvwindow)` to request to modify the default recvWindow value
type ThirdPartyMessageType ¶
type ThirdPartyMessageType string
ThirdPartyMessageType 第三方消息类型
const ( MasterOrderType ThirdPartyMessageType = "master_order" OrderType ThirdPartyMessageType = "order" FillType ThirdPartyMessageType = "fill" )
type TimeInForceType ¶
type TimeInForceType string
TimeInForceType define time in force type of order
type TimestampMessage ¶
type TimestampMessage struct {
ServerTimeMilli int64 `json:"serverTimeMilli"`
}
type TimestampService ¶
type TimestampService struct {
// contains filtered or unexported fields
}
TimestampService get service timestamp milli
func (*TimestampService) Do ¶
func (s *TimestampService) Do(ctx context.Context, opts ...RequestOption) (res int64, err error)
Do send request
type TradingPairMessage ¶
type TradingPairMessage struct { Items []*TradingPairs `json:"items"` Page int `json:"page"` PageSize int `json:"pageSize"` Total string `json:"total"` }
type TradingPairs ¶
type TradingPairs struct { BaseAsset string `json:"baseAsset"` ContractType string `json:"contractType"` CreatedAt string `json:"createdAt"` DeliveryDate string `json:"deliveryDate"` Exchange string `json:"exchange"` Id int `json:"id"` MarketType string `json:"marketType"` QuoteAsset string `json:"quoteAsset"` Status string `json:"status"` Symbol string `json:"symbol"` UpdatedAt string `json:"updatedAt"` }
type TradingPairsService ¶
type TradingPairsService struct {
// contains filtered or unexported fields
}
TradingPairsService list trading pairs
func (*TradingPairsService) Do ¶
func (s *TradingPairsService) Do(ctx context.Context, opts ...RequestOption) (res []*TradingPairs, err error)
Do send request
func (*TradingPairsService) Exchange ¶
func (s *TradingPairsService) Exchange(exchange string) *TradingPairsService
Exchange set exchange
func (*TradingPairsService) IsCoin ¶
func (s *TradingPairsService) IsCoin(isCoin bool) *TradingPairsService
IsCoin set isCoin
func (*TradingPairsService) MarketType ¶
func (s *TradingPairsService) MarketType(marketType trading_enums.TradingPairMarketType) *TradingPairsService
MarketType set marketType
func (*TradingPairsService) Page ¶
func (s *TradingPairsService) Page(page int32) *TradingPairsService
Page set page
func (*TradingPairsService) PageSize ¶
func (s *TradingPairsService) PageSize(pageSize int32) *TradingPairsService
PageSize set pageSize
type UserDataEventType ¶
type UserDataEventType string
UserDataEventType define spot user data event type
type WebSocketEventHandlers ¶
type WebSocketEventHandlers struct { OnMasterOrder func(msg *MasterOrderMessage) error OnOrder func(msg *OrderMessage) error OnFill func(msg *FillMessage) error OnStatus func(data string) error OnError func(err error) OnConnected func() OnDisconnected func() OnRawMessage func(msg *ClientPushMessage) error }
WebSocketEventHandlers 事件处理器集合
type WebSocketService ¶
type WebSocketService struct {
// contains filtered or unexported fields
}
WebSocketService WebSocket 服务
func NewWebSocketService ¶
func NewWebSocketService(c *Client) *WebSocketService
NewWebSocketService 创建 WebSocket 服务
func (*WebSocketService) Connect ¶
func (ws *WebSocketService) Connect(listenKey string) error
Connect 连接 WebSocket
func (*WebSocketService) IsConnected ¶
func (ws *WebSocketService) IsConnected() bool
IsConnected 是否已连接
func (*WebSocketService) SetHandlers ¶
func (ws *WebSocketService) SetHandlers(handlers *WebSocketEventHandlers) *WebSocketService
SetHandlers 设置事件处理器
func (*WebSocketService) SetLogger ¶
func (ws *WebSocketService) SetLogger(logger *log.Logger) *WebSocketService
SetLogger 设置日志记录器
func (*WebSocketService) SetPingInterval ¶
func (ws *WebSocketService) SetPingInterval(interval time.Duration) *WebSocketService
SetPingInterval 设置心跳间隔
func (*WebSocketService) SetPongTimeout ¶
func (ws *WebSocketService) SetPongTimeout(timeout time.Duration) *WebSocketService
SetPongTimeout 设置 Pong 超时时间
func (*WebSocketService) SetReconnectDelay ¶
func (ws *WebSocketService) SetReconnectDelay(delay time.Duration) *WebSocketService
SetReconnectDelay 设置重连延迟