forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathengine_types.go
131 lines (119 loc) · 4.13 KB
/
engine_types.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package engine
import (
"sync"
"time"
)
// Settings stores engine params. Please define a settings struct for automatic
// display of instance settings. For example, if you define a struct named
// ManagerSettings, it will be displayed as a subheading "Manager Settings"
// and individual field names such as 'EnableManager' will be displayed
// as "Enable Manager: true/false".
type Settings struct {
ConfigFile string
DataDir string
MigrationDir string
LogFile string
GoMaxProcs int
CheckParamInteraction bool
CoreSettings
ExchangeSyncerSettings
ForexSettings
ExchangeTuningSettings
GCTScriptSettings
WithdrawSettings
// Main shutdown channel
Shutdown chan struct{}
}
// CoreSettings defines settings related to core engine operations
type CoreSettings struct {
EnableDryRun bool
EnableAllExchanges bool
EnableAllPairs bool
EnableCoinmarketcapAnalysis bool
EnablePortfolioManager bool
EnableDataHistoryManager bool
PortfolioManagerDelay time.Duration
EnableGRPC bool
EnableGRPCProxy bool
EnableGRPCShutdown bool
EnableWebsocketRPC bool
EnableDeprecatedRPC bool
EnableCommsRelayer bool
EnableExchangeSyncManager bool
EnableDepositAddressManager bool
EnableEventManager bool
EnableOrderManager bool
EnableConnectivityMonitor bool
EnableDatabaseManager bool
EnableGCTScriptManager bool
EnableNTPClient bool
EnableWebsocketRoutine bool
EnableCurrencyStateManager bool
EventManagerDelay time.Duration
EnableFuturesTracking bool
Verbose bool
EnableDispatcher bool
DispatchMaxWorkerAmount int
DispatchJobsLimit int
}
// ExchangeSyncerSettings defines settings for the exchange pair synchronisation
type ExchangeSyncerSettings struct {
EnableTickerSyncing bool
EnableOrderbookSyncing bool
EnableTradeSyncing bool
SyncWorkersCount int
SyncContinuously bool
SyncTimeoutREST time.Duration
SyncTimeoutWebsocket time.Duration
}
// ForexSettings defines settings related to the foreign exchange services
type ForexSettings struct {
EnableCurrencyConverter bool
EnableCurrencyLayer bool
EnableExchangeRates bool
EnableFixer bool
EnableOpenExchangeRates bool
}
// ExchangeTuningSettings defines settings related to an exchange
type ExchangeTuningSettings struct {
EnableExchangeHTTPRateLimiter bool
EnableExchangeHTTPDebugging bool
EnableExchangeVerbose bool
ExchangePurgeCredentials bool
EnableExchangeAutoPairUpdates bool
DisableExchangeAutoPairUpdates bool
EnableExchangeRESTSupport bool
EnableExchangeWebsocketSupport bool
TradeBufferProcessingInterval time.Duration
RequestMaxRetryAttempts int
AlertSystemPreAllocationCommsBuffer int // See exchanges/alert.go
ExchangeShutdownTimeout time.Duration
HTTPTimeout time.Duration
HTTPUserAgent string
HTTPProxy string
GlobalHTTPTimeout time.Duration
GlobalHTTPUserAgent string
GlobalHTTPProxy string
}
// GCTScriptSettings defines settings related to the GCTScript virtual machine
type GCTScriptSettings struct {
MaxVirtualMachines uint
}
// WithdrawSettings defines settings related to Withdrawing cryptocurrency
type WithdrawSettings struct {
WithdrawCacheSize uint64
}
const (
// MsgStatusOK message to display when status is "OK"
MsgStatusOK string = "ok"
// MsgStatusSuccess message to display when status is successful
MsgStatusSuccess string = "success"
// MsgStatusError message to display when failure occurs
MsgStatusError string = "error"
grpcName string = "grpc"
grpcProxyName string = "grpc_proxy"
)
// newConfigMutex only locks and unlocks on engine creation functions
// as engine modifies global files, this protects the main bot creation
// functions from interfering with each other
var newEngineMutex sync.Mutex