-
Notifications
You must be signed in to change notification settings - Fork 6
/
Types.go
74 lines (63 loc) · 1.61 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package golang_forex_quotes
import (
socket "github.com/sacOO7/gowebsocket"
)
const (
LOGIN = "login"
SUBSCRIBE_TO = "subscribe_to"
UNSUBSCRIBE_FROM = "unsubscribe_from"
SUBSCRIBE_TO_ALL = "subscribe_to_all"
UNSUBSCRIBE_FROM_ALL = "unsubscribe_from_all"
MESSAGE = "message"
FORCE_CLOSE = "force_close"
POST_LOGIN_SUCCESS = "post_login_success"
UPDATE = "update"
)
type Quote struct {
Symbol string `json:"s"`
Bid float32 `json:"b"`
Ask float32 `json:"a"`
Price float32 `json:"p"`
Time int `json:"t"`
}
type SocketClient struct {
ApiKey string
socket *socket.Socket
connectCallback func()
disconnectCallback func()
messageCallback func(string)
updateCallback func(Quote)
loginSuccessCallback func()
}
type ForgeClient struct {
apiKey string
restClient RestClient
socketClient SocketClient
}
type ConversionResult struct {
Value float32
Text string
Timestamp int
}
type Quota struct {
QuotaUsed int `json:"quota_used"`
QuotaLimit int `json:"quota_limit"` //0 = Unlimited
QuotaRemaining int `json:"quota_remaining"`
HoursUntilReset int `json:"hours_until_reset"`
}
type UnlimitedQuota struct {
QuotaUsed int `json:"quota_used"`
QuotaLimit string `json:"quota_limit"`
QuotaRemaining string `json:"quota_remaining"`
HoursUntilReset int `json:"hours_until_reset"`
}
type MarketStatus struct {
MarketIsOpen bool `json:"market_is_open"`
}
type RestError struct {
Error bool
Message string
}
type RestClient struct {
ApiKey string
}