refactor: extract 'bitfinex' and 'BTC/EUR' magic strings to constants

Add SOURCE_BITFINEX and PAIR_BTC_EUR constants in price_fetcher.py and
use them consistently in routes/audit.py, worker.py, and tests.
This commit is contained in:
counterweight 2025-12-22 16:06:56 +01:00
parent dd7bec6091
commit ec835a2935
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
4 changed files with 19 additions and 15 deletions

View file

@ -23,7 +23,7 @@ from pagination import (
calculate_total_pages,
create_paginated_response,
)
from price_fetcher import fetch_btc_eur_price
from price_fetcher import PAIR_BTC_EUR, SOURCE_BITFINEX, fetch_btc_eur_price
from schemas import (
CounterRecordResponse,
PaginatedCounterRecords,
@ -194,8 +194,8 @@ async def fetch_price_now(
price, timestamp = await fetch_btc_eur_price()
record = PriceHistory(
source="bitfinex",
pair="BTC/EUR",
source=SOURCE_BITFINEX,
pair=PAIR_BTC_EUR,
price=price,
timestamp=timestamp,
)