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
|
|
@ -14,7 +14,7 @@ from pgqueuer.queries import Queries
|
|||
|
||||
from database import ASYNCPG_DATABASE_URL
|
||||
from jobs import JOB_FETCH_BITCOIN_PRICE, JOB_RANDOM_NUMBER
|
||||
from price_fetcher import fetch_btc_eur_price
|
||||
from price_fetcher import PAIR_BTC_EUR, SOURCE_BITFINEX, fetch_btc_eur_price
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
|
|
@ -116,8 +116,8 @@ async def process_bitcoin_price_job(db_pool: asyncpg.Pool) -> None:
|
|||
VALUES ($1, $2, $3, $4, NOW())
|
||||
ON CONFLICT (source, pair, timestamp) DO NOTHING
|
||||
""",
|
||||
"bitfinex",
|
||||
"BTC/EUR",
|
||||
SOURCE_BITFINEX,
|
||||
PAIR_BTC_EUR,
|
||||
price,
|
||||
timestamp,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue