From 2432b7d6dc0b55f8e48d491ec3c7273946b92a7c Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 26 May 2025 15:50:17 +0200 Subject: [PATCH] pass pairs down --- xexe/cli.py | 1 + xexe/processes.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xexe/cli.py b/xexe/cli.py index cf52231..442d4c9 100644 --- a/xexe/cli.py +++ b/xexe/cli.py @@ -91,6 +91,7 @@ def get_rates( start_date=start_date, end_date=end_date, currencies=currencies, + pairs=pairs, dry_run=dry_run, rates_source=rates_source, ignore_warnings=ignore_warnings, diff --git a/xexe/processes.py b/xexe/processes.py index 159161d..d12f723 100644 --- a/xexe/processes.py +++ b/xexe/processes.py @@ -1,12 +1,13 @@ import logging import os import pathlib -from typing import List +from typing import List, Set, Union from money.currency import Currency from xecd_rates_client import XecdClient from xexe.constants import RATES_SOURCES +from xexe.currency_pair import CurrencyPair from xexe.exchange_rates import ExchangeRates, add_equal_rates, add_inverse_rates from xexe.rate_fetching import build_rate_fetcher from xexe.rate_writing import build_rate_writer @@ -67,11 +68,12 @@ def run_dwh_healthcheck(): def run_get_rates( date_range: DateRange, - currencies: List[Currency], dry_run: bool, rates_source: str, ignore_warnings: bool, output: pathlib.Path, + currencies: Union[Set[Currency], None] = None, + pairs: Union[Set[CurrencyPair], None] = None, ) -> None: logger.info("Getting rates") @@ -80,6 +82,7 @@ def run_get_rates( rates = obtain_rates_from_source( rates_source=rates_source, date_range=date_range, + pairs=pairs, currencies=currencies, ignore_warnings=ignore_warnings, ) @@ -95,8 +98,9 @@ def run_get_rates( def obtain_rates_from_source( rates_source: str, date_range: DateRange, - currencies: List[Currency], ignore_warnings: bool, + currencies: Union[Set[Currency], None] = None, + pairs: Union[Set[CurrencyPair], None] = None, ) -> ExchangeRates: rates_fetcher = build_rate_fetcher( rates_source=rates_source, rate_sources_mapping=RATES_SOURCES