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

[dca2] add dev mode field for dev #1515

Merged
merged 1 commit into from
Feb 5, 2024
Merged

[dca2] add dev mode field for dev #1515

merged 1 commit into from
Feb 5, 2024

Conversation

kbearXD
Copy link
Collaborator

@kbearXD kbearXD commented Jan 26, 2024

No description provided.

@bbgokarma-bot
Copy link

Welcome back! @kbearXD, This pull request may get 251 BBG.

@CLAassistant
Copy link

CLAassistant commented Jan 26, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


chiahung.lin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 50 lines in your changes are missing coverage. Please review.

Comparison is base (565cdef) 21.78% compared to head (3f6fffa) 21.77%.

❗ Current head 3f6fffa differs from pull request most recent head dfb65ba. Consider uploading reports for the commit dfb65ba to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1515      +/-   ##
==========================================
- Coverage   21.78%   21.77%   -0.01%     
==========================================
  Files         604      605       +1     
  Lines       43885    43879       -6     
==========================================
- Hits         9559     9556       -3     
+ Misses      33643    33642       -1     
+ Partials      683      681       -2     
Files Coverage Δ
pkg/strategy/dca2/profit_stats.go 0.00% <0.00%> (ø)
pkg/strategy/dca2/open_position.go 45.56% <0.00%> (-6.61%) ⬇️
pkg/strategy/dca2/strategy.go 0.82% <0.00%> (-0.04%) ⬇️
pkg/strategy/dca2/recover.go 37.35% <52.72%> (+2.24%) ⬆️

... and 12 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 565cdef...dfb65ba. Read the comment docs.


// DevMode, if Enabled is true. it means it will check the running field
type DevMode struct {
On bool `json:"on"`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use enabled

// DevMode, if Enabled is true. it means it will check the running field
type DevMode struct {
On bool `json:"on"`
IsNewStrategy bool `json:"isNewStrategy"`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about newAccount ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's not new account. This field is used to make dca2 strategy not recover with long time ago trades.

@@ -66,6 +66,9 @@ type Strategy struct {
// UseCancelAllOrdersApiWhenClose uses a different API to cancel all the orders on the market when closing a grid
UseCancelAllOrdersApiWhenClose bool `json:"useCancelAllOrdersApiWhenClose"`

// dev mode
DevMode DevMode `json:"devMode"`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better to use DevMode *DevMode

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we use pointer here, we can remove Enabled field.

@@ -32,6 +33,21 @@ func (s *Strategy) placeOpenPositionOrders(ctx context.Context) error {

s.debugOrders(createdOrders)

if s.DevMode.On && s.DevMode.IsNewStrategy {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and check s.DevMode != nil here

@bbgokarma-bot
Copy link

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

@kbearXD kbearXD requested a review from c9s January 29, 2024 05:34
@bbgokarma-bot
Copy link

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

@bbgokarma-bot
Copy link

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

@kbearXD kbearXD force-pushed the kbearXD/dca2/dev-mode branch from 6f21b34 to ddd2117 Compare January 29, 2024 07:34
@bbgokarma-bot
Copy link

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

@kbearXD kbearXD force-pushed the kbearXD/dca2/dev-mode branch from ddd2117 to daeb5fc Compare January 29, 2024 09:50
@bbgokarma-bot
Copy link

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

@kbearXD kbearXD force-pushed the kbearXD/dca2/dev-mode branch from daeb5fc to 3f6fffa Compare January 30, 2024 07:56
@bbgokarma-bot
Copy link

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

@kbearXD kbearXD force-pushed the kbearXD/dca2/dev-mode branch from 3f6fffa to 54ea684 Compare February 5, 2024 08:05
@bbgokarma-bot
Copy link

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

use pointer

IsNewStrategy -> IsNewAccount

[dca2] recover at cancelling stage

new var recoverSinceLimit

fix profit stats round bug
@kbearXD kbearXD force-pushed the kbearXD/dca2/dev-mode branch from 54ea684 to dfb65ba Compare February 5, 2024 08:20
@bbgokarma-bot
Copy link

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

@c9s c9s merged commit 7cc3d1b into main Feb 5, 2024
2 of 3 checks passed
@c9s c9s deleted the kbearXD/dca2/dev-mode branch February 5, 2024 11:04
@bbgokarma-bot
Copy link

Hi @kbearXD,

Well done! 409 BBG has been sent to your polygon wallet. Please check the following tx:

https://polygonscan.com/tx/0xae83f4b02970a7b592932a581875d165986d72811e5db2d10677e9c3254b0e40

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants