50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
MARKET_PRESET_OPTIONS = [
|
|
"Custom",
|
|
"Stocks Swing",
|
|
"Crypto Intraday",
|
|
"Crypto Swing",
|
|
]
|
|
|
|
|
|
def apply_market_preset(base: dict[str, Any], preset: str) -> dict[str, Any]:
|
|
updated = dict(base)
|
|
if preset == "Stocks Swing":
|
|
updated.update(
|
|
{
|
|
"interval": "1d",
|
|
"period": "6mo",
|
|
"max_bars": 500,
|
|
"drop_live": True,
|
|
"hide_market_closed_gaps": True,
|
|
"enable_auto_refresh": False,
|
|
}
|
|
)
|
|
elif preset == "Crypto Intraday":
|
|
updated.update(
|
|
{
|
|
"interval": "1h",
|
|
"period": "3mo",
|
|
"max_bars": 1000,
|
|
"drop_live": True,
|
|
"hide_market_closed_gaps": False,
|
|
"enable_auto_refresh": True,
|
|
"refresh_sec": 60,
|
|
}
|
|
)
|
|
elif preset == "Crypto Swing":
|
|
updated.update(
|
|
{
|
|
"interval": "4h",
|
|
"period": "6mo",
|
|
"max_bars": 800,
|
|
"drop_live": True,
|
|
"hide_market_closed_gaps": False,
|
|
"enable_auto_refresh": False,
|
|
}
|
|
)
|
|
return updated
|