ws

package
v0.0.0-...-97d3e4a Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceEvent

type BalanceEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  struct {
		Balances map[string]struct {
			Holding          float64 `json:"holding"`
			Frozen           float64 `json:"frozen"`
			Interest         float64 `json:"interest"`
			PendingShortQty  float64 `json:"pendingShortQty"`
			PendingLongQty   float64 `json:"pendingLongQty"`
			Version          float64 `json:"version"`
			Staked           float64 `json:"staked"`
			Unbonding        float64 `json:"unbonding"`
			Vault            float64 `json:"vault"`
			LaunchpadVault   float64 `json:"launchpadVault"`
			Earn             float64 `json:"earn"`
			AverageOpenPrice float64 `json:"averageOpenPrice"`
			Pnl24H           float64 `json:"pnl24H"`
			Fee24H           float64 `json:"fee24H"`
			MarkPrice        float64 `json:"markPrice"`
		} `json:"balances"`
	} `json:"data"`
}

func (BalanceEvent) GetTopic

func (e BalanceEvent) GetTopic() string

type BestBookOfferEvent

type BestBookOfferEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  struct {
		Symbol  string  `json:"symbol"`
		Ask     float64 `json:"ask"`
		AskSize float64 `json:"askSize"`
		Bid     float64 `json:"bid"`
		BidSize float64 `json:"bidSize"`
	} `json:"data"`
}

func (BestBookOfferEvent) GetTopic

func (e BestBookOfferEvent) GetTopic() string

type BestBooksOffersEvent

type BestBooksOffersEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  []struct {
		Symbol  string  `json:"symbol"`
		Ask     float64 `json:"ask"`
		AskSize float64 `json:"askSize"`
		Bid     float64 `json:"bid"`
		BidSize float64 `json:"bidSize"`
	} `json:"data"`
}

func (BestBooksOffersEvent) GetTopic

func (e BestBooksOffersEvent) GetTopic() string

type EstFundingRateEvent

type EstFundingRateEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  struct {
		Symbol      string  `json:"symbol"`
		FundingRate float64 `json:"fundingRate"`
		FundingTs   int64   `json:"fundingTs"`
	} `json:"data"`
}

func (EstFundingRateEvent) GetTopic

func (e EstFundingRateEvent) GetTopic() string

type EventI

type EventI interface {
	GetTopic() string
}

type ExecutionReportEvent

type ExecutionReportEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  struct {
		MsgType               ExecutionType `json:"msgType"`
		Symbol                string        `json:"symbol"`
		ClientOrderID         int           `json:"clientOrderId"`
		OrderID               int           `json:"orderId"`
		Type                  string        `json:"type"`
		Side                  string        `json:"side"`
		Quantity              float64       `json:"quantity"`
		Price                 float64       `json:"price"`
		TradeID               int           `json:"tradeId"`
		ExecutedPrice         float64       `json:"executedPrice"`
		ExecutedQuantity      float64       `json:"executedQuantity"`
		Fee                   float64       `json:"fee"`
		FeeAsset              string        `json:"feeAsset"`
		TotalExecutedQuantity float64       `json:"totalExecutedQuantity"`
		AvgPrice              float64       `json:"avgPrice"`
		Status                string        `json:"status"`
		Reason                string        `json:"reason"`
		OrderTag              string        `json:"orderTag"`
		TotalFee              float64       `json:"totalFee"`
		Visible               float64       `json:"visible"`
		Timestamp             int64         `json:"timestamp"`
		ReduceOnly            bool          `json:"reduceOnly"`
		Maker                 bool          `json:"maker"`
	} `json:"data"`
}

func (ExecutionReportEvent) GetTopic

func (e ExecutionReportEvent) GetTopic() string

type ExecutionType

type ExecutionType int
var (
	ExecutionNew             ExecutionType = 0
	ExecutionReject          ExecutionType = 1
	ExecutionCancelReject    ExecutionType = 2
	ExecutionCancelAllReject ExecutionType = 3
)

type OpenInterestEvent

type OpenInterestEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  []struct {
		Symbol       string  `json:"symbol"`
		Openinterest float64 `json:"openinterest"`
	} `json:"data"`
}

func (OpenInterestEvent) GetTopic

func (e OpenInterestEvent) GetTopic() string

type OrderbookEvent

type OrderbookEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  struct {
		Symbol string      `json:"symbol"`
		Asks   [][]float64 `json:"asks"`
		Bids   [][]float64 `json:"bids"`
	} `json:"data"`
}

func (OrderbookEvent) GetTopic

func (e OrderbookEvent) GetTopic() string

type PositionPushEvent

type PositionPushEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  struct {
		Positions map[string]struct {
			Holding          int     `json:"holding"`
			PendingLongQty   float64 `json:"pendingLongQty"`
			PendingShortQty  float64 `json:"pendingShortQty"`
			AverageOpenPrice float64 `json:"averageOpenPrice"`
			Pnl24H           float64 `json:"pnl24H"`
			Fee24H           float64 `json:"fee24H"`
			SettlePrice      float64 `json:"settlePrice"`
			MarkPrice        float64 `json:"markPrice"`
			Version          int     `json:"version"`
			OpeningTime      int     `json:"openingTime"`
			Pnl24HPercentage float64 `json:"pnl24HPercentage"`
			AdlQuantile      float64 `json:"adlQuantile"`
		} `json:"positions"`
	} `json:"data"`
}

func (PositionPushEvent) GetTopic

func (e PositionPushEvent) GetTopic() string

type PrivateRequest

type PrivateRequest struct {
	ID     string        `json:"id"`
	Event  string        `json:"event"`
	Topic  string        `json:"topic"`
	Params RequestParams `json:"params"`
}

type PrivateStream

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

func NewPrivateStream

func NewPrivateStream(applicationId, apiKey, apiSecret string) *PrivateStream

func (*PrivateStream) SubBalance

func (s *PrivateStream) SubBalance(ctx context.Context) (<-chan BalanceEvent, error)

func (*PrivateStream) SubExecutionReport

func (s *PrivateStream) SubExecutionReport(ctx context.Context) (<-chan ExecutionReportEvent, error)

func (*PrivateStream) SubPositionPush

func (s *PrivateStream) SubPositionPush(ctx context.Context) (<-chan PositionPushEvent, error)

type PublicStream

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

func NewPublicStream

func NewPublicStream(applicationId string) *PublicStream

func (*PublicStream) SubBestBookOffer

func (s *PublicStream) SubBestBookOffer(ctx context.Context, symbols ...string) (<-chan BestBookOfferEvent, error)

func (*PublicStream) SubBestBooksOffers

func (s *PublicStream) SubBestBooksOffers(ctx context.Context) (<-chan BestBooksOffersEvent, error)

func (*PublicStream) SubEstFundingRate

func (s *PublicStream) SubEstFundingRate(ctx context.Context, symbols ...string) (<-chan EstFundingRateEvent, error)

func (*PublicStream) SubOpenInterest

func (s *PublicStream) SubOpenInterest(ctx context.Context) (<-chan OpenInterestEvent, error)

func (*PublicStream) SubOrderBook

func (s *PublicStream) SubOrderBook(ctx context.Context, is100 bool, symbols ...string) (<-chan OrderbookEvent, error)

func (*PublicStream) SubTrade

func (s *PublicStream) SubTrade(ctx context.Context, symbols ...string) (<-chan TradeEvent, error)

type Request

type Request struct {
	ID    string `json:"id"`
	Event string `json:"event"`
	Topic string `json:"topic"`
}

type RequestParams

type RequestParams struct {
	Apikey    string `json:"apikey"`
	Sign      string `json:"sign"`
	Timestamp string `json:"timestamp"`
}

type SubscribeSuccessEvent

type SubscribeSuccessEvent struct {
	Ts      int64  `json:"ts"`
	ID      string `json:"id"`
	Event   string `json:"event"`
	Data    string `json:"data"`
	Success bool   `json:"success"`
}

func (SubscribeSuccessEvent) GetTopic

func (e SubscribeSuccessEvent) GetTopic() string

type TradeEvent

type TradeEvent struct {
	Topic string `json:"topic"`
	Ts    int64  `json:"ts"`
	Data  struct {
		Symbol string  `json:"symbol"`
		Price  float64 `json:"price"`
		Size   float64 `json:"size"`
		Side   string  `json:"side"`
		Source int     `json:"source"`
	} `json:"data"`
}

func (TradeEvent) GetTopic

func (e TradeEvent) GetTopic() string

type WSEventI

type WSEventI interface {
	GetTopic() string
}

type WSRequest

type WSRequest struct {
	ID    string `json:"id"`
	Event string `json:"event"`
	Topic string `json:"topic"`
}

Jump to

Keyboard shortcuts

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