feat: add dry_run_wallet helper
This commit is contained in:
@@ -11,6 +11,7 @@ from freqtrade.util.datetime_helpers import (
|
|||||||
format_ms_time,
|
format_ms_time,
|
||||||
shorten_date,
|
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.formatters import decimals_per_coin, fmt_coin, fmt_coin2, round_value
|
||||||
from freqtrade.util.ft_precise import FtPrecise
|
from freqtrade.util.ft_precise import FtPrecise
|
||||||
from freqtrade.util.measure_time import MeasureTime
|
from freqtrade.util.measure_time import MeasureTime
|
||||||
@@ -35,6 +36,7 @@ __all__ = [
|
|||||||
"dt_utc",
|
"dt_utc",
|
||||||
"format_date",
|
"format_date",
|
||||||
"format_ms_time",
|
"format_ms_time",
|
||||||
|
"get_dry_run_wallet",
|
||||||
"FtPrecise",
|
"FtPrecise",
|
||||||
"PeriodicCache",
|
"PeriodicCache",
|
||||||
"shorten_date",
|
"shorten_date",
|
||||||
|
|||||||
@@ -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")
|
||||||
Reference in New Issue
Block a user