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:
parent
dd7bec6091
commit
ec835a2935
4 changed files with 19 additions and 15 deletions
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue