Files
t_tech-gyro/app/load_config.py

22 lines
568 B
Python

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