-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,20 @@ type Position struct { | |
|
||
// Modify position callbacks | ||
modifyCallbacks []func(baseQty fixedpoint.Value, quoteQty fixedpoint.Value, price fixedpoint.Value) | ||
|
||
// ttl is the ttl to keep in persistence | ||
ttl time.Duration | ||
} | ||
|
||
func (s *Position) SetTTL(ttl time.Duration) { | ||
if ttl.Nanoseconds() <= 0 { | ||
return | ||
} | ||
s.ttl = ttl | ||
} | ||
|
||
func (s *Position) Expiration() time.Duration { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||
return s.ttl | ||
} | ||
|
||
func (p *Position) CsvHeader() []string { | ||
|
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