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

Allow fractional units #1229

Closed
GitPeterJ opened this issue Feb 26, 2025 · 1 comment
Closed

Allow fractional units #1229

GitPeterJ opened this issue Feb 26, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@GitPeterJ
Copy link

GitPeterJ commented Feb 26, 2025

Enhancement description

I ran into the same problem as in #134 and after reading a bit about it I wondered, what is the reason why this is not allowed? I understand some brokers do not allow it, but some do, so it should be up to the user to decide whether to put this restriction in place.
Can you explain why you did this? The current solution seems a bit.. cumbersome.

@GitPeterJ GitPeterJ added the enhancement New feature or request label Feb 26, 2025
@Zirafnik
Copy link

I think this was added in the last update: https://kernc.github.io/backtesting.py/doc/backtesting/lib.html#backtesting.lib.FractionalBacktest

Change Log: https://github.com/kernc/backtesting.py/blob/master/CHANGELOG.md#062

It basically just uses a trick by dividing the prices with the minimum allowed trade size (e.g. for BTC => one 100 millionth of BTC == 0.00000001 BTC).

I do think the docs are somewhat unclear & confusing... I think the keyword argument being named "satoshi" is confusing for the average user. I also strongly believe that documentation for FractionalBacktest should be located next to docs for Backtest. It took me way too long to realize this is a backtesting class ("duh!") and not a Strategy class.

@kernc kernc closed this as completed in 5928524 Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants