]>
Commit | Line | Data |
---|---|---|
2f91f20a | 1 | package api |
2 | ||
3 | import ( | |
4 | "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/markets" | |
5 | ) | |
6 | ||
7 | var Poloniex *markets.Poloniex | |
8 | ||
9 | func OpenMarketsConnection() error { | |
10 | for { | |
11 | err := Poloniex.StartTicker() | |
12 | if err != nil { | |
13 | return err | |
14 | } | |
15 | log.Warn("connection to poloniex stream ended, restarting it...") | |
16 | } | |
17 | } | |
18 | ||
19 | func init() { | |
20 | Poloniex = markets.NewPoloniex() | |
21 | ||
22 | // We open markets connections in the background as it can take time. | |
23 | go func() { | |
24 | err := OpenMarketsConnection() | |
25 | if err != nil { | |
26 | ErrorChan <- err | |
27 | } | |
28 | }() | |
29 | } |