-
Notifications
You must be signed in to change notification settings - Fork 0
/
processor.go
42 lines (39 loc) · 1.08 KB
/
processor.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
package tiki_exchange
import (
"github.com/LampardNguyen234/whale-alert/internal/clients/tiki"
processorCommon "github.com/LampardNguyen234/whale-alert/internal/processor/common"
"github.com/LampardNguyen234/whale-alert/internal/processor/tiki_exchange/order_watch"
"github.com/LampardNguyen234/whale-alert/internal/processor/tiki_exchange/volume_watch"
"github.com/LampardNguyen234/whale-alert/internal/store"
"github.com/LampardNguyen234/whale-alert/logger"
)
func NewProcessors(cfg TikiProcessorConfig,
tikiClient *tiki.TikiClient,
db *store.Store,
log logger.Logger,
) ([]processorCommon.Processor, error) {
ret := make([]processorCommon.Processor, 0)
if cfg.OrderWatch.Enabled {
processor, err := order_watch.NewOrderWatchProcessor(cfg.OrderWatch,
tikiClient,
db,
log,
)
if err != nil {
return nil, err
}
ret = append(ret, processor)
}
if cfg.VolumeWatch.Enabled {
processor, err := volume_watch.NewVolumeWatchProcessor(cfg.VolumeWatch,
tikiClient,
db,
log,
)
if err != nil {
return nil, err
}
ret = append(ret, processor)
}
return ret, nil
}