-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
FEATURE: add ttl for position/grid2.profit_stats persistence #1396
Conversation
Welcome back! @kbearXD, This pull request may get 242 BBG. |
Codecov Report
@@ Coverage Diff @@
## main #1396 +/- ##
==========================================
- Coverage 21.12% 21.10% -0.02%
==========================================
Files 568 569 +1
Lines 40956 41069 +113
==========================================
+ Hits 8653 8669 +16
- Misses 31667 31763 +96
- Partials 636 637 +1
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
s.ttl = ttl | ||
} | ||
|
||
func (s *Position) Expiration() time.Duration { |
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.
do we check the returned Expiration() in the caller? e.g., skip 0 expiration?
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.
I think we don't need to do it. Because if the value is 0, it means it will not expire anymore.
pkg/strategy/grid2/strategy.go
Outdated
@@ -1835,13 +1836,17 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo. | |||
s.ProfitSpread = s.Market.TruncatePrice(s.ProfitSpread) | |||
} | |||
|
|||
s.logger.Infof("ttl: %s", s.PersistenceTTL.Duration()) |
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.
using persistence ttl: %s
if s.GridProfitStats == nil { | ||
s.GridProfitStats = newGridProfitStats(s.Market) | ||
} | ||
s.GridProfitStats.SetTTL(s.PersistenceTTL.Duration()) |
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.
should only call SetTTL when .PersistenceTTL is set and > 0
Re-estimated karma: this pull request may get 291 BBG |
Re-estimated karma: this pull request may get 312 BBG |
if err := syncActiveOrders(ctx, opts); err != nil { | ||
log.WithError(err).Errorf("unable to sync active orders") | ||
s.recoverC <- struct{}{} | ||
bbgo.Sync(ctx, s) |
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.
you can remove this?
@@ -30,7 +30,7 @@ func (s *Strategy) initializeRecoverC() bool { | |||
|
|||
if s.recoverC == nil { | |||
s.logger.Info("initializing recover channel") | |||
s.recoverC = make(chan struct{}, 1) | |||
s.recoverC = make(chan struct{}, 10) |
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.
why use 10?
Re-estimated karma: this pull request may get 337 BBG |
Re-estimated karma: this pull request may get 341 BBG |
Hi @kbearXD, Well done! 346 BBG has been sent to your polygon wallet. Please check the following tx: https://polygonscan.com/tx/0x0f7c74be38027f9546371757068be79f84ee0ab5781f0d39522c3a2fa47be956 Thank you for your contribution! |
No description provided.