Reorganized structure, seperating implementations from core logic
This commit is contained in:
12
pkg/data/events/bar.go
Normal file
12
pkg/data/events/bar.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package events
|
||||
|
||||
import "time"
|
||||
|
||||
type Bar struct {
|
||||
Open float64
|
||||
High float64
|
||||
Low float64
|
||||
Close float64
|
||||
Volume float64
|
||||
Interval time.Duration
|
||||
}
|
||||
6
pkg/data/events/custom.go
Normal file
6
pkg/data/events/custom.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package events
|
||||
|
||||
type Custom struct {
|
||||
Bytes []byte
|
||||
ContentType string
|
||||
}
|
||||
22
pkg/data/events/domain.go
Normal file
22
pkg/data/events/domain.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Package events ...
|
||||
package events
|
||||
|
||||
type DataType uint8
|
||||
|
||||
const (
|
||||
TradeType DataType = iota
|
||||
QuoteType
|
||||
BarType
|
||||
MBPDeltaType
|
||||
MBPSnapshotType
|
||||
MBODeltaType
|
||||
MBOSnapshotType
|
||||
CustomType
|
||||
)
|
||||
|
||||
type Side uint8
|
||||
|
||||
const (
|
||||
Bid Side = iota
|
||||
Ask
|
||||
)
|
||||
20
pkg/data/events/mbodelta.go
Normal file
20
pkg/data/events/mbodelta.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package events
|
||||
|
||||
type MBODelta struct {
|
||||
Operation MBOOrderOp
|
||||
OrderID string
|
||||
Side Side
|
||||
Price float64
|
||||
Size float64
|
||||
IsMaker bool
|
||||
Seq uint64
|
||||
ParentID string
|
||||
}
|
||||
|
||||
type MBOOrderOp uint8
|
||||
|
||||
const (
|
||||
OrderAdd MBOOrderOp = iota
|
||||
OrderMod
|
||||
OrderDel
|
||||
)
|
||||
14
pkg/data/events/mbosnapshot.go
Normal file
14
pkg/data/events/mbosnapshot.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package events
|
||||
|
||||
type MBOSnapshot struct {
|
||||
Orders []OrderEntry
|
||||
Seq uint64
|
||||
}
|
||||
|
||||
type OrderEntry struct {
|
||||
OrderID string
|
||||
Side Side
|
||||
Price float64
|
||||
Size float64
|
||||
IsMaker bool
|
||||
}
|
||||
8
pkg/data/events/mbpdelta.go
Normal file
8
pkg/data/events/mbpdelta.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package events
|
||||
|
||||
type MBPDelta struct {
|
||||
Side Side
|
||||
Price float64
|
||||
Size float64
|
||||
Seq uint64
|
||||
}
|
||||
13
pkg/data/events/mbpsnapshot.go
Normal file
13
pkg/data/events/mbpsnapshot.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package events
|
||||
|
||||
type MBPSnapshot struct {
|
||||
Bids []PriceLevel
|
||||
Asks []PriceLevel
|
||||
Depth int
|
||||
Seq uint64
|
||||
}
|
||||
|
||||
type PriceLevel struct {
|
||||
Price float64
|
||||
Size float64
|
||||
}
|
||||
8
pkg/data/events/quote.go
Normal file
8
pkg/data/events/quote.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package events
|
||||
|
||||
type Quote struct {
|
||||
BidPrice float64
|
||||
BidSize float64
|
||||
AskPrice float64
|
||||
AskSize float64
|
||||
}
|
||||
16
pkg/data/events/trade.go
Normal file
16
pkg/data/events/trade.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package events
|
||||
|
||||
type Trade struct {
|
||||
Price float64
|
||||
Qty float64
|
||||
Aggressor AggressorSide
|
||||
TradeID string
|
||||
}
|
||||
|
||||
type AggressorSide uint8
|
||||
|
||||
const (
|
||||
AggUnknown AggressorSide = iota
|
||||
AggBuy
|
||||
AggSell
|
||||
)
|
||||
Reference in New Issue
Block a user