feat: add dry_run_wallet helper

This commit is contained in:
Matthias
2024-12-03 07:26:47 +01:00
parent 09308e568d
commit c082e5f6a6
2 changed files with 14 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ from freqtrade.util.datetime_helpers import (
format_ms_time,
shorten_date,
)
from freqtrade.util.dry_run_wallet import get_dry_run_wallet
from freqtrade.util.formatters import decimals_per_coin, fmt_coin, fmt_coin2, round_value
from freqtrade.util.ft_precise import FtPrecise
from freqtrade.util.measure_time import MeasureTime
@@ -35,6 +36,7 @@ __all__ = [
"dt_utc",
"format_date",
"format_ms_time",
"get_dry_run_wallet",
"FtPrecise",
"PeriodicCache",
"shorten_date",

View File

@@ -0,0 +1,12 @@
from pytest import Config
def get_dry_run_wallet(config: Config) -> int | float:
"""
Return dry-run wallet balance in stake currency from configuration.
This setup also supports dictionary mode for dry-run-wallet.
"""
if isinstance(_start_cap := config["dry_run_wallet"], float | int):
return _start_cap
else:
return _start_cap.get("stake_currency")