mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-20 14:00:38 +00:00
feat: add dry_run_wallet helper
This commit is contained in:
@@ -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",
|
||||
|
||||
12
freqtrade/util/dry_run_wallet.py
Normal file
12
freqtrade/util/dry_run_wallet.py
Normal 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")
|
||||
Reference in New Issue
Block a user