Skip to content
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

Merged
merged 6 commits into from
Jun 14, 2023
Merged

FEATURE: [grid2] recover with twin orders #1174

merged 6 commits into from
Jun 14, 2023

Conversation

kbearXD
Copy link
Collaborator

@kbearXD kbearXD commented May 22, 2023

No description provided.

@kbearXD kbearXD requested review from c9s and gx578007 May 22, 2023 07:06
@bbgokarma-bot
Copy link

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.,

polygon:0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B

Once this pull request is merged, your BBG token will be sent to your wallet.

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 764 BBG

Copy link
Owner

@c9s c9s left a 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

@@ -13,6 +13,14 @@ import (
"github.com/c9s/bbgo/pkg/types"
)

type QueryTradesService interface {
Copy link
Owner

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?

}

type QueryOrderService interface {
QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error)
Copy link
Owner

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

// 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) {
Copy link
Owner

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?

RecoverGridByScanningTrades bool `json:"recoverGridByScanningTrades"`
SkipSpreadCheck bool `json:"skipSpreadCheck"`
RecoverGridByScanningTrades bool `json:"recoverGridByScanningTrades"`
RecoverWithin time.Duration `json:"recoverWithin"`
Copy link
Owner

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 ?

}

sort.Slice(pins, func(i, j int) bool {
return pins[j] < pins[i]
Copy link
Owner

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()

Copy link
Owner

@c9s c9s left a 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

@c9s c9s added feature feature means adding new functionality for users from all perspective, e.g., web, cli, deployment strategy trading strategy related issues labels May 23, 2023
@c9s
Copy link
Owner

c9s commented May 23, 2023

@kbearXD go build fail

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 777 BBG

@codecov
Copy link

codecov bot commented May 24, 2023

Codecov Report

Merging #1174 (fc532fe) into main (5996b32) will decrease coverage by 1.06%.
The diff coverage is 1.04%.

❗ Current head fc532fe differs from pull request most recent head 49971a2. Consider uploading reports for the commit 49971a2 to get more accurate results

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
pkg/strategy/grid2/strategy.go 32.30% <ø> (+0.29%) ⬆️
pkg/strategy/grid2/twin_order.go 0.00% <0.00%> (ø)
pkg/strategy/grid2/recover.go 4.13% <1.55%> (-12.39%) ⬇️

... and 85 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5996b32...49971a2. Read the comment docs.

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 787 BBG

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 792 BBG

@kbearXD kbearXD requested a review from c9s June 12, 2023 09:27
@c9s c9s merged commit c00d7b6 into main Jun 14, 2023
@c9s c9s deleted the feature/grid2/recover branch June 14, 2023 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature means adding new functionality for users from all perspective, e.g., web, cli, deployment strategy trading strategy related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants