-
Notifications
You must be signed in to change notification settings - Fork 0
/
deal.go
46 lines (39 loc) · 895 Bytes
/
deal.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
package broker
import "time"
// DealType deal type.
type DealType string
const (
// Buy deal of buying.
Buy DealType = "BUY"
// Sell deal of selling.
Sell DealType = "SELL"
)
// DealStatus deal status.
type DealStatus string
const (
// DealStatusNew new deal status.
DealStatusNew DealStatus = "NEW"
// DealStatusCompleted completed deal status.
DealStatusCompleted DealStatus = "COMPLETED"
// DealStatusCanceled canceled deal status.
DealStatusCanceled DealStatus = "CANCELED"
)
// Deal user deal.
type Deal struct {
ID int64
ClientID int64
Ticker string
Type DealType
Amount int32
Partial bool
Price float64
Status DealStatus
Time time.Time
}
// DealRepo deal repository.
type DealRepo interface {
Add(deal Deal) error
GetOpened(clientID int64) ([]Deal, error)
Update(deal Deal) error
UpdateStatus(dealID int64, status DealStatus) error
}