pushing

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Level2TypeSnapshot = Level2Type("snapshot")
	Level2TypeUpdate   = Level2Type("l2update")

	ChannelTicker = Channel("ticker")
	ChannelMatch  = Channel("match")
	ChannelTrade  = Channel("trade")
	ChannelLevel2 = Channel("level2")
	ChannelFunds  = Channel("funds")
	ChannelOrder  = Channel("order")

	ChannelCandles1m    = Channel("candles_1m")
	ChannelCandles3m    = Channel("candles_3m")
	ChannelCandles5m    = Channel("candles_5m")
	ChannelCandles15m   = Channel("candles_15m")
	ChannelCandles30m   = Channel("candles_30m")
	ChannelCandles60m   = Channel("candles_60m")
	ChannelCandles120m  = Channel("candles_120m")
	ChannelCandles240m  = Channel("candles_240m")
	ChannelCandles360m  = Channel("candles_360m")
	ChannelCandles720m  = Channel("candles_720m")
	ChannelCandles1440m = Channel("candles_1440m")
)

Variables

This section is empty.

Functions

func CandlesFormatWithGranularityProductId

func CandlesFormatWithGranularityProductId(granularity int64, productId string) string

func StartServer

func StartServer()

Types

type CandlesMessage

type CandlesMessage struct {
	Type      string `json:"type"`
	ProductId string `json:"productId"`
	Time      string `json:"time"`
	Open      string `json:"open"`
	Close     string `json:"close"`
	Low       string `json:"low"`
	High      string `json:"high"`
	Volume    string `json:"volume"`
}

type Channel

type Channel string

func (Channel) Format

func (t Channel) Format(productId string, userId int64) string

func (Channel) FormatWithProductId

func (t Channel) FormatWithProductId(productId string) string

func (Channel) FormatWithUserId

func (t Channel) FormatWithUserId(userId int64) string

type Client

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

每个连接对应一个client,client负责该连接的数据I/O

func NewClient

func NewClient(conn *websocket.Conn, sub *subscription) *Client

type FundsMessage

type FundsMessage struct {
	Type      string `json:"type"`
	Sequence  int64  `json:"sequence"`
	UserId    string `json:"userId"`
	Currency  string `json:"currencyCode"`
	Available string `json:"available"`
	Hold      string `json:"hold"`
}

type Level2Change

type Level2Change struct {
	Seq       int64
	ProductId string
	Side      string
	Price     string
	Size      string
}

type Level2SnapshotMessage

type Level2SnapshotMessage struct {
	Type      Level2Type       `json:"type"`
	ProductId string           `json:"productId"`
	Bids      [][3]interface{} `json:"bids"` // [["6500.15", "0.57753524"]]
	Asks      [][3]interface{} `json:"asks"`
}

type Level2Type

type Level2Type string

type Level2UpdateMessage

type Level2UpdateMessage struct {
	Type      Level2Type       `json:"type"`
	ProductId string           `json:"productId"`
	Changes   [][3]interface{} `json:"changes"` // ["buy", "6500.09", "0.84702376"],
}

type MatchMessage

type MatchMessage struct {
	Type         string `json:"type"`
	TradeSeq     int64  `json:"tradeSeq"`
	Sequence     int64  `json:"sequence"`
	Time         string `json:"time"`
	ProductId    string `json:"productId"`
	Price        string `json:"price"`
	Size         string `json:"size"`
	MakerOrderId string `json:"makerOrderId"`
	TakerOrderId string `json:"takerOrderId"`
	Side         string `json:"side"`
}

type MatchStream

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

func (*MatchStream) OnDoneLog

func (s *MatchStream) OnDoneLog(log *matching.DoneLog, offset int64)

func (*MatchStream) OnMatchLog

func (s *MatchStream) OnMatchLog(log *matching.MatchLog, offset int64)

func (*MatchStream) OnOpenLog

func (s *MatchStream) OnOpenLog(log *matching.OpenLog, offset int64)

func (*MatchStream) Start

func (s *MatchStream) Start()

type OrderBookFullSnapshot

type OrderBookFullSnapshot struct {
	ProductId string
	Seq       int64
	LogOffset int64
	LogSeq    int64
	Orders    []matching.BookOrder
}

type OrderBookLevel2Snapshot

type OrderBookLevel2Snapshot struct {
	ProductId string
	Seq       int64
	Asks      [][3]interface{}
	Bids      [][3]interface{}
}

type OrderBookStream

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

func (*OrderBookStream) OnDoneLog

func (s *OrderBookStream) OnDoneLog(log *matching.DoneLog, offset int64)

func (*OrderBookStream) OnMatchLog

func (s *OrderBookStream) OnMatchLog(log *matching.MatchLog, offset int64)

func (*OrderBookStream) OnOpenLog

func (s *OrderBookStream) OnOpenLog(log *matching.OpenLog, offset int64)

func (*OrderBookStream) Start

func (s *OrderBookStream) Start()

type OrderMessage

type OrderMessage struct {
	UserId        int64  `json:"userId"`
	Type          string `json:"type"`
	Sequence      int64  `json:"sequence"`
	Id            string `json:"id"`
	Price         string `json:"price"`
	Size          string `json:"size"`
	Funds         string `json:"funds"`
	ProductId     string `json:"productId"`
	Side          string `json:"side"`
	OrderType     string `json:"orderType"`
	CreatedAt     string `json:"createdAt"`
	FillFees      string `json:"fillFees"`
	FilledSize    string `json:"filledSize"`
	ExecutedValue string `json:"executedValue"`
	Status        string `json:"status"`
	Settled       bool   `json:"settled"`
}

type PriceLevel

type PriceLevel struct {
	Price      decimal.Decimal
	Size       decimal.Decimal
	OrderCount int64
}

type Request

type Request struct {
	Type        string   `json:"type"`
	ProductIds  []string `json:"product_ids"`
	CurrencyIds []string `json:"currency_ids"`
	Channels    []string `json:"channels"`
	Token       string   `json:"token"`
}

type Response

type Response struct {
	Type       string   `json:"type"`
	ProductIds []string `json:"product_ids"`
	Channels   []string `json:"channels"`
	Token      string   `json:"token"`
}

type Server

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

func NewServer

func NewServer(addr, path string, sub *subscription) *Server

func (*Server) Run

func (s *Server) Run()

type TickerMessage

type TickerMessage struct {
	Type      string `json:"type"`
	TradeSeq  int64  `json:"tradeSeq"`
	Sequence  int64  `json:"sequence"`
	Time      string `json:"time"`
	ProductId string `json:"productId"`
	Price     string `json:"price"`
	Side      string `json:"side"`
	LastSize  string `json:"lastSize"`
	BestBid   string `json:"bestBid"`
	BestAsk   string `json:"bestAsk"`
	Volume24h string `json:"volume24h"`
	Volume30d string `json:"volume30d"`
	Low24h    string `json:"low24h"`
	Open24h   string `json:"open24h"`
}

type TickerStream

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

func (*TickerStream) OnDoneLog

func (s *TickerStream) OnDoneLog(log *matching.DoneLog, offset int64)

func (*TickerStream) OnMatchLog

func (s *TickerStream) OnMatchLog(log *matching.MatchLog, offset int64)

func (*TickerStream) OnOpenLog

func (s *TickerStream) OnOpenLog(log *matching.OpenLog, offset int64)

func (*TickerStream) Start

func (s *TickerStream) Start()

type TradeMessage

type TradeMessage struct {
	Type         string `json:"type"`
	Time         string `json:"time"`
	ProductId    string `json:"productId"`
	Price        string `json:"price"`
	Size         string `json:"size"`
	MakerOrderId string `json:"makerOrderId"`
	TakerOrderId string `json:"takerOrderId"`
	Side         string `json:"side"`
}

Jump to

Keyboard shortcuts

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