messages

package
v0.0.0-...-8310cb8 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(e error)

Check checks the error

func Close

func Close(handler *FileHandler)

func ConvertDone

func ConvertDone(message *Done) []byte

ConvertDone done to flatbuffer type

func ConvertMatch

func ConvertMatch(message *Match) []byte

ConvertMatch match to flatbuffer type

func ConvertOpen

func ConvertOpen(message *Open) []byte

ConvertOpen open to flatbuffer type

func ConvertReceived

func ConvertReceived(message *Received) []byte

ConvertReceived received to flatbuffer type

func CreateL2Snapshot

func CreateL2Snapshot(symbol string, json map[string]interface{}) []byte

func GenerateNewFileName

func GenerateNewFileName(handler *FileHandler) string

func ParseTimestamp

func ParseTimestamp(ts string) (int64, error)

ParseTimestamp parse utc formatted Timestamp to unix nanos

func Update

func Update(handler *FileHandler) error

Types

type Activate

type Activate struct {
	Type      string `json:"type"`
	ProductID string `json:"product_id"`
	Timestamp string `json:"Timestamp"`
	UserID    string `json:"user_id"`
	ProfileID string `json:"profile_id"`
	OrderID   string `json:"order_id"`
	StopType  string `json:"stop_type"`
	Side      string `json:"side"`
	StopPrice string `json:"stop_price"`
	Size      string `json:"size"`
	Funds     string `json:"funds"`
	Private   bool   `json:"private"`
}

Activate Exchange activate ordre message

type Change

type Change struct {
	Type      string `json:"type"`
	Time      string `json:"time"`
	ProductID string `json:"product_id"`
	Sequence  int64  `json:"sequence"`
	OrderID   string `json:"order_id"`
	NewSize   string `json:"new_size"`
	OldSize   string `json:"old_size"`
	Price     string `json:"price"`
	Side      string `json:"side"`
}

Change Exchange order change message

type Done

type Done struct {
	Type          string `json:"type"`
	Time          string `json:"time"`
	ProductID     string `json:"product_id"`
	Sequence      int64  `json:"sequence"`
	OrderID       string `json:"order_id"`
	Price         string `json:"price"`
	Side          string `json:"side"`
	Reason        string `json:"reason"`
	RemainingSize string `json:"remaining_size"`
}

Done Exchange order done message

type FileHandler

type FileHandler struct {
	Timestamp int64
	Frequency int64
	Filename  string
	File      *os.File
	Directory string
}

type Heartbeat

type Heartbeat struct {
	Type        string `json:"type"`
	Sequence    int64  `json:"sequence"`
	LastTradeID int64  `json:"last_trade_id"`
	ProductID   string `json:"product_id"`
	Time        string `json:"time"`
}

Heartbeat Exchange heartbeat message

type L2Update

type L2Update struct {
	Type      string     `json:"type"`
	ProductID string     `json:"product_id"`
	Time      string     `json:"time"`
	Changes   [][]string `json:"changes"`
}

L2Update received from the exchange

type Match

type Match struct {
	Type         string `json:"type"`
	TradeID      int64  `json:"trade_id"`
	Time         string `json:"time"`
	ProductID    string `json:"product_id"`
	Sequence     int64  `json:"sequence"`
	MakerOrderID string `json:"maker_order_id"`
	TakerOrderID string `json:"taker_order_id"`
	Size         string `json:"size"`
	Price        string `json:"price"`
	Side         string `json:"side"`
}

Match Exchange order match message

type Open

type Open struct {
	Type          string `json:"type"`
	Time          string `json:"time"`
	ProductID     string `json:"product_id"`
	Sequence      int64  `json:"sequence"`
	OrderID       string `json:"order_id"`
	Price         string `json:"price"`
	RemainingSize string `json:"remaining_size"`
	Side          string `json:"side"`
}

Open Exchange open order message

type Received

type Received struct {
	Type      string `json:"type"`
	Time      string `json:"time"`
	ProductID string `json:"product_id"`
	Sequence  int64  `json:"sequence"`
	OrderID   string `json:"order_id"`
	Size      string `json:"size"`
	Price     string `json:"price"`
	Side      string `json:"side"`
	OrderType string `json:"order_type"`
	Funds     string `json:"funds"`
}

Received Exchange received message:

type Snapshot

type Snapshot struct {
	Type      string     `json:"type"`
	ProductID string     `json:"product_id"`
	Bids      [][]string `json:"bids"`
	Asks      [][]string `json:"asks"`
}

Snapshot received from the exchange

type SubscriptionMessage

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

SubscriptionMessage sent to the exchange

Jump to

Keyboard shortcuts

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