-
-
Notifications
You must be signed in to change notification settings - Fork 293
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: [grid2] recover with twin orders #1174
Conversation
Hi @kbearXD, This pull request may get 383 BBG. To receive BBG token, please left your polygon address as an issue comment in this pull request with the following format, e.g.,
Once this pull request is merged, your BBG token will be sent to your wallet. |
Re-estimated karma: this pull request may get 764 BBG |
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 CR also prevents merge
pkg/strategy/grid2/recover.go
Outdated
@@ -13,6 +13,14 @@ import ( | |||
"github.com/c9s/bbgo/pkg/types" | |||
) | |||
|
|||
type QueryTradesService interface { |
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.
can you move this to pkg/types?
pkg/strategy/grid2/recover.go
Outdated
} | ||
|
||
type QueryOrderService interface { | ||
QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error) |
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 have this defined in pkg/types
pkg/strategy/grid2/recover.go
Outdated
// It will skip the orders on pins at which open orders are already | ||
func (s *Strategy) buildFilledPinOrderMapFromTrades(ctx context.Context, historyService types.ExchangeTradeHistoryService, pinOrdersOpen PinOrderMap) (PinOrderMap, error) { | ||
pinOrdersFilled := make(PinOrderMap) | ||
func (s *Strategy) buildFilledTwinOrderMapFromTrades(ctx context.Context, queryTradesService QueryTradesService, queryOrderService QueryOrderService, twinOrdersOpen TwinOrderMap, expectedFillNum int) (TwinOrderMap, error) { |
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 thought these queryTradesService QueryTradesService, queryOrderService QueryOrderService
are already defined in the Strategy struct?
pkg/strategy/grid2/strategy.go
Outdated
RecoverGridByScanningTrades bool `json:"recoverGridByScanningTrades"` | ||
SkipSpreadCheck bool `json:"skipSpreadCheck"` | ||
RecoverGridByScanningTrades bool `json:"recoverGridByScanningTrades"` | ||
RecoverWithin time.Duration `json:"recoverWithin"` |
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.
Make the prefix consistent? RecoverGridWithin
?
pkg/strategy/grid2/twin_order.go
Outdated
} | ||
|
||
sort.Slice(pins, func(i, j int) bool { | ||
return pins[j] < pins[i] |
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't compare Pin with <
or >
, you need to use .Compare()
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 CR also prevents merge
@kbearXD go build fail |
Re-estimated karma: this pull request may get 777 BBG |
Codecov Report
@@ Coverage Diff @@
## main #1174 +/- ##
==========================================
- Coverage 20.98% 19.92% -1.06%
==========================================
Files 503 479 -24
Lines 34859 34783 -76
==========================================
- Hits 7315 6932 -383
- Misses 26999 27294 +295
- Partials 545 557 +12
... and 85 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
fc532fe
to
267ab61
Compare
Re-estimated karma: this pull request may get 787 BBG |
267ab61
to
49971a2
Compare
Re-estimated karma: this pull request may get 792 BBG |
No description provided.