65 lines
1.2 KiB
Go
65 lines
1.2 KiB
Go
package main
|
|
|
|
// Tick represents a single trade event persisted into hot storage.
|
|
type Tick struct {
|
|
// Exchange identifiers
|
|
TradeID string
|
|
Seq int64
|
|
|
|
// Timing
|
|
TradeTS int64 // Bybit trade timestamp (T)
|
|
MessageTS int64
|
|
RecvTS int64 // Local receive timestamp
|
|
|
|
// Trade data
|
|
Symbol string
|
|
Side string
|
|
Price float64
|
|
Volume float64
|
|
|
|
// Exchange metadata
|
|
TickDir string // L
|
|
BlockTrade bool // BT
|
|
RPI bool // RPI
|
|
}
|
|
|
|
|
|
// FeatureBucket holds aggregated 5-second feature data.
|
|
type FeatureBucket struct {
|
|
Timestamp int64
|
|
LogReturn float64
|
|
RealizedVol float64
|
|
OFI float64
|
|
VolumeSum float64
|
|
ClosePrice float64
|
|
VWAP float64
|
|
}
|
|
|
|
// Top-level websocket message.
|
|
type BybitWSMessage struct {
|
|
Topic string `json:"topic"`
|
|
Type string `json:"type"`
|
|
TS int64 `json:"ts"`
|
|
Data []BybitTradeRaw `json:"data"`
|
|
}
|
|
|
|
// Raw trade from Bybit publicTrade stream.
|
|
type BybitTradeRaw struct {
|
|
T int64 `json:"T"`
|
|
|
|
S string `json:"s"`
|
|
SD string `json:"S"`
|
|
|
|
V string `json:"v"`
|
|
P string `json:"p"`
|
|
|
|
L string `json:"L"`
|
|
|
|
I string `json:"i"`
|
|
|
|
BT bool `json:"BT"`
|
|
RPI bool `json:"RPI"`
|
|
|
|
Seq int64 `json:"seq"`
|
|
}
|