-
Notifications
You must be signed in to change notification settings - Fork 820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
engine/sync-manager: add config support #1326
engine/sync-manager: add config support #1326
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Minor nits.
log.Warnf(log.ConfigMgr, "invalid sync manager pair format value %v, defaulting to %v\n", c.SyncManagerConfig.PairFormatDisplay, c.CurrencyPairFormat) | ||
c.SyncManagerConfig.PairFormatDisplay = c.CurrencyPairFormat | ||
} | ||
if c.SyncManagerConfig.TimeoutREST <= 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I purge fiat display currency it purges and never comes back and stops the sync manager from working🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well don't do that 😆 Will look into it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still an issue, when I remove this fiatdisplayCurrency
from the config it stops the starting of the syncMnager
engine/helpers.go
Outdated
FiatDisplayCurrency: bot.Config.Currency.FiatDisplayCurrency, | ||
Verbose: bot.Settings.Verbose, | ||
cfg := bot.Config.SyncManagerConfig | ||
cfg.SynchronizeTicker = bot.Settings.EnableTickerSyncing && cfg.SynchronizeTicker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When ticker sync is enabled in config this pattern used to override if set using flagSet.WithBool
functionality in engine.
.\gocryptotrader -orderbooksync=true -tickersync=false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rephrase that please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When ticker sync is set to true in config, when I try to set it to false via command line it will not. I don't english well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the inverse if I have both set to false in config and I run this command, it doesn't work:
.\gocryptotrader --orderbooksync=true --tickersync=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default app param values have now become false
to address this. But then that will mean you can't disable it via command line.
I'm thinking to remove them based on what you're after
edit: still reworking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved, I forgot about the lovely existing helper functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for changes, just 2 things I noticed.
log.Warnf(log.ConfigMgr, "invalid sync manager pair format value %v, defaulting to %v\n", c.SyncManagerConfig.PairFormatDisplay, c.CurrencyPairFormat) | ||
c.SyncManagerConfig.PairFormatDisplay = c.CurrencyPairFormat | ||
} | ||
if c.SyncManagerConfig.TimeoutREST <= 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still an issue, when I remove this fiatdisplayCurrency
from the config it stops the starting of the syncMnager
config/config.go
Outdated
c.SyncManagerConfig.TimeoutWebsocket = DefaultSyncerTimeoutWebsocket | ||
} | ||
if c.SyncManagerConfig.PairFormatDisplay == nil { | ||
log.Warnf(log.ConfigMgr, "invalid sync manager pair format value %v, using default format eg BTC-USD\n", c.SyncManagerConfig.PairFormatDisplay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
engine/helpers.go
Outdated
FiatDisplayCurrency: bot.Config.Currency.FiatDisplayCurrency, | ||
Verbose: bot.Settings.Verbose, | ||
cfg := bot.Config.SyncManagerConfig | ||
cfg.SynchronizeTicker = bot.Settings.EnableTickerSyncing && cfg.SynchronizeTicker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the inverse if I have both set to false in config and I run this command, it doesn't work:
.\gocryptotrader --orderbooksync=true --tickersync=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just some minor nitters
Co-authored-by: Adrian Gallagher <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like a glorious beef stroganoff!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ch ACK
* allows sync manager customisation for values and logs * config-example add * who doesnt like more coverage? * ensures you can actually disable it via config el oh el * less ifs, better control * fix verbose * sync trades default false * fix summary being printed when not enabled * fixes config checker and output * nits * I can put this behind me now * Fixed logCaSiNg Co-authored-by: Adrian Gallagher <[email protected]> * combines if statements --------- Co-authored-by: Adrian Gallagher <[email protected]>
PR Description
This is a quick & basic QoL improvement which adds the sync manager config to our config file. No longer do you need to add so many params when running the application to change behaviour. You can still use the running params to override your config.
Also, the sync manager is a pretty trustworthy subsystem now, so I've added the ability to modify what logging events to output. You can toggle whether you want to see:
Errors, default subsystem logs all still show and Verbose is still a thing.
Please delete options that are not relevant and add an
x
in[]
as item is complete.How has this been tested
TestGetDefaultSyncManagerConfig()
Checklist