-
Notifications
You must be signed in to change notification settings - Fork 126
/
APIDerivativesScraper.go
37 lines (30 loc) · 1.01 KB
/
APIDerivativesScraper.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
package scrapers
import (
"sync"
"github.com/diadata-org/diadata/pkg/model"
"github.com/gorilla/websocket"
zap "go.uber.org/zap"
)
// DeribitScraperKind - used to distinguish between the futures and options scrapers
type DeribitScraperKind int
const (
// DeribitFuture - constant to signal the futures scraper
DeribitFuture DeribitScraperKind = iota + 1
// DeribitOption - constant to signal the options scraper
DeribitOption
)
// DeribitScraper - used in conjunction with the DeribitScraperKind in a new struct to define futures and options scrapers
type DeribitScraper struct {
Markets []string
WaitGroup *sync.WaitGroup
Logger *zap.SugaredLogger
DataStore *models.DB
WsConnection *websocket.Conn
// required for deribit to:
// 1. authenticate (trades is a private channel)
// 2. referesh the token from step 1., so that the channel isn't closed
AccessKey string
AccessSecret string
RefreshTokenEvery int16 // how often we refresh the token (in seconds)
MarketKind DeribitScraperKind
}