aboutsummaryrefslogtreecommitdiff
path: root/api/markets.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/markets.go')
-rw-r--r--api/markets.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/api/markets.go b/api/markets.go
new file mode 100644
index 0000000..60fb912
--- /dev/null
+++ b/api/markets.go
@@ -0,0 +1,29 @@
1package api
2
3import (
4 "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/markets"
5)
6
7var Poloniex *markets.Poloniex
8
9func 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
19func 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}