Tasks
Periodic tasks defined by the etfs app. The full schedule,
queue routing, and worker invocation flags are in
Tasks. Most tasks sleep 5s between items
when iterating over the full ETF list to avoid hammering
upstream APIs.
Price history
-
richy.etfs.tasks.fetch_historical_data.__wrapped__(etf=None)
Fetches new historical data (prices) for the given ETF.
Already existing price records gets updated if price differs (solves splits).
If no ETF was given then fetches data for all ETFs.
If new data has been found we update caches and
regenerate performance chart.
- Parameters:
etfs (int) – ETF PK.
-
richy.etfs.tasks.fetch_current_price.__wrapped__(etf=None)
Fetches current market price and caches
it under “item-{}-current-price” key for ITEM_CURRENT_PRICE_TIMEOUT.
If no ETF PK instance is given fetches all etfs in database.
Sleeps 5 seconds between each fetch.
- Parameters:
etf (int) – Etf PK.
Reference data
-
richy.etfs.tasks.fetch_basic_info.__wrapped__(etf=None)
Downloads share basic info and saves it to ItemData model.
- Parameters:
etf (int) – Etf PK.
Holdings
-
richy.etfs.tasks.fetch_holdings.__wrapped__(etf=None)
Downloads ETF holdings and saves it to ItemData model.
- Parameters:
etf (int) – ETF PK.
Dividends
-
richy.etfs.tasks.fetch_dividends.__wrapped__(etf=None)
Downloads dividends and saves it to Dividend models.
Sleeps 5 seconds between each fetch.
- Parameters:
etf (int) – ETF PK.