-
Notifications
You must be signed in to change notification settings - Fork 40
/
types.go
43 lines (35 loc) · 791 Bytes
/
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
package main
import (
"fmt"
)
type Price uint16 // 0-65536 eg the price 123.45 = 12345
type OrderID uint64
type Size uint64
type Side int
type Order struct {
symbol string
trader string
side Side
price Price
size Size
}
// Execution Report (send one per opposite-sided order completely filled).
type Execution Order
const (
Bid Side = iota
Ask
)
func (o *Execution) String() string {
return fmt.Sprintf("{symbol: %v, trader: %v, side: %v, price: %v, size: %v}", o.symbol, o.trader, o.side, o.price, o.size)
}
func (o *Order) String() string {
return fmt.Sprintf("{symbol: %v, trader: %v, side: %v, price: %v, size: %v}", o.symbol, o.trader, o.side, o.price, o.size)
}
func (s Side) String() string {
switch s {
case Bid:
return "Bid"
default:
return "Ask"
}
}