-
Notifications
You must be signed in to change notification settings - Fork 6
/
ForgeClient.go
75 lines (58 loc) · 1.72 KB
/
ForgeClient.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
75
package golang_forex_quotes
func CreateForgeClient(apiKey string) *ForgeClient {
return &ForgeClient{
apiKey: apiKey,
restClient: CreateRestClient(apiKey),
socketClient: *CreateSocketClient(apiKey),
}
}
// REST
func (c *ForgeClient) GetQuotes(symbols []string) ([]Quote, error) {
return c.restClient.GetQuotes(symbols)
}
func (c *ForgeClient) GetQuota() (Quota, error) {
return c.restClient.GetQuota()
}
func (c *ForgeClient) Convert(from string, to string, quantity int) (ConversionResult, error) {
return c.restClient.Convert(from, to, quantity)
}
func (c *ForgeClient) GetMarketStatus() (MarketStatus, error) {
return c.restClient.GetMarketStatus()
}
func (c *ForgeClient) GetSymbols() ([]string, error) {
return c.restClient.GetSymbols()
}
// SOCKET
func (c *ForgeClient) Connect() {
c.socketClient.Connect()
}
func (c *ForgeClient) Disconnect() {
c.socketClient.Disconnect()
}
func (c *ForgeClient) SubscribeTo(symbols []string) {
c.socketClient.SubscribeTo(symbols)
}
func (c *ForgeClient) SubscribeToAll() {
c.socketClient.SubscribeToAll()
}
func (c *ForgeClient) UnsubscribeFrom(symbols []string) {
c.socketClient.UnsubscribeFrom(symbols)
}
func (c *ForgeClient) UnsubscribeFromAll() {
c.socketClient.UnsubscribeFromAll()
}
func (c *ForgeClient) OnConnection(callback func()) {
c.socketClient.OnConnection(callback)
}
func (c *ForgeClient) OnDisconnection(callback func()) {
c.socketClient.OnDisconnection(callback)
}
func (c *ForgeClient) OnUpdate(callback func(Quote)) {
c.socketClient.OnUpdate(callback)
}
func (c *ForgeClient) OnMessage(callback func(string)) {
c.socketClient.OnMessage(callback)
}
func (c *ForgeClient) OnLoginSuccess(callback func()) {
c.socketClient.OnLoginSuccess(callback)
}