-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtypes.go
47 lines (38 loc) · 1.21 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package orderbook
import (
"fmt"
decimal "github.com/geseq/udecimal"
)
// MsgType represents the type of message
type MsgType byte
// ClassType of the order
type ClassType byte
// SideType of the order
type SideType byte
// FlagType of the order
type FlagType byte
// Order strores information about request
type Order struct {
ID uint64 `json:"id" `
Class ClassType `json:"class" `
Side SideType `json:"side" `
Flag FlagType `json:"flag" `
Qty decimal.Decimal `json:"qty" `
Price decimal.Decimal `json:"price" `
TrigPrice decimal.Decimal `json:"trigPrice" `
queue *orderQueue
prev *Order
next *Order
}
// Trade strores information about request
type Trade struct {
MakerOrderID uint64 `json:"makerOrderId" `
TakerOrderID uint64 `json:"takerOrderId" `
MakerStatus OrderStatus `json:"makerStatus" `
TakerStatus OrderStatus `json:"takerStatus" `
Qty decimal.Decimal `json:"qty"`
Price decimal.Decimal `json:"price" `
}
func (t Trade) String() string {
return fmt.Sprintf("%d %d %s %s %s %s", t.MakerOrderID, t.TakerOrderID, t.MakerStatus, t.TakerStatus, t.Qty.String(), t.Price.String())
}