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: [atrpin] take profit by expected base balance #1648

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

narumiruna
Copy link
Collaborator

No description provided.

@narumiruna narumiruna requested review from c9s and kbearXD June 2, 2024 06:57
Copy link

codecov bot commented Jun 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 22.66%. Comparing base (5098c3a) to head (fb8a5bb).
Report is 14 commits behind head on main.

Current head fb8a5bb differs from pull request most recent head a1b8e07

Please upload reports for the commit a1b8e07 to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1648      +/-   ##
==========================================
- Coverage   22.71%   22.66%   -0.06%     
==========================================
  Files         619      619              
  Lines       44697    44661      -36     
==========================================
- Hits        10153    10121      -32     
+ Misses      33810    33807       -3     
+ Partials      734      733       -1     

see 8 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 6be3855...a1b8e07. Read the comment docs.

if baseQuantity.Sign() < 0 {
side = types.SideTypeBuy
takerPrice = ticker.Sell
baseQuantity = baseQuantity.Abs()
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 you can check the ClosePosition() method, and maybe we can reuse some of them

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If there is a missing trade, then the position base will be incorrect. Thus I'd like to add the ExpectedBaseBalance to solve the problem.

Copy link
Owner

Choose a reason for hiding this comment

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

can we use query trades to fix the position?

the balance balance could be fixed by xalign, and we will need a correct PnL record

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can't fix the balance by xalign, because atrpin will place order

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

how to query trades?

@narumiruna narumiruna force-pushed the narumi/atrpin-expected-baes-balance branch 2 times, most recently from 852d30f to dd80a8e Compare June 5, 2024 14:36
@narumiruna narumiruna marked this pull request as ready for review June 5, 2024 14:37
@narumiruna narumiruna force-pushed the narumi/atrpin-expected-baes-balance branch from dd80a8e to e40e556 Compare June 6, 2024 07:39
@narumiruna narumiruna force-pushed the narumi/atrpin-expected-baes-balance branch 3 times, most recently from 60e8267 to 7361838 Compare June 19, 2024 05:51
@narumiruna narumiruna force-pushed the narumi/atrpin-expected-baes-balance branch from 7361838 to a1b8e07 Compare June 20, 2024 08:08
@narumiruna narumiruna merged commit 3007fa7 into main Jun 20, 2024
3 checks passed
@narumiruna narumiruna deleted the narumi/atrpin-expected-baes-balance branch June 20, 2024 08:17
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.

2 participants