Обновить конфигурацию: исправить коридор отклонения, изменить идентификатор аккаунта, добавить загрузку конфигурации из YAML
This commit is contained in:
21
app/load_config.py
Normal file
21
app/load_config.py
Normal 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
|
||||
Reference in New Issue
Block a user