Обновить конфигурацию: исправить коридор отклонения, изменить идентификатор аккаунта, добавить загрузку конфигурации из YAML

This commit is contained in:
Dmitry
2026-01-06 10:29:17 +03:00
parent 90295d21e6
commit 196caea4a1
5 changed files with 56 additions and 3 deletions

21
app/load_config.py Normal file
View File

@@ -0,0 +1,21 @@
import yaml
from decimal import Decimal
def load_config(config_path: str) -> dict:
with open(config_path, "r") as file:
data = yaml.safe_load(file)
target_weights = {
ticker: Decimal(str(weight)) for ticker, weight in data["portfolio"].items
}
config = {
"account_id": data["account"]["id"],
"is_sandbox": data["account"]["is_sandbox"],
"corridor": Decimal(str(data["settings"]["corridor"])),
"dry_run": data["settings"]["dry_run"],
"target_weights": target_weights,
}
return config