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

FIX: [rebalance] round down quantity #1663

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

narumiruna
Copy link
Collaborator

No description provided.

@@ -255,9 +256,9 @@ func (s *Strategy) generateOrder(ctx context.Context) (*types.SubmitOrder, error
}

if side == types.SideTypeBuy {
quantity = fixedpoint.Min(quantity, balances[s.QuoteCurrency].Available.Div(ticker.Sell))
quantity = fixedpoint.Min(quantity, balances[s.QuoteCurrency].Available.Div(ticker.Sell)).Round(market.VolumePrecision, fixedpoint.Down)
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 use:

market.RoundDownQuantityByPrecision

and

market.RoundUpQuantityByPrecision

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@narumiruna narumiruna force-pushed the narumi/rebalance-round-down-qty branch from edfeaab to 0eb3856 Compare July 9, 2024 04:08
@narumiruna narumiruna enabled auto-merge July 9, 2024 04:21
@narumiruna narumiruna merged commit be27d32 into main Jul 9, 2024
3 checks passed
@narumiruna narumiruna deleted the narumi/rebalance-round-down-qty branch July 9, 2024 04:21
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