- PR1: Project scaffold, DB models, price loader - PR2: Congressional trade ingestion (House Stock Watcher) - PR3: Security enrichment + deployment infrastructure - 37 passing tests, 87%+ coverage - Docker + Proxmox deployment ready - Complete documentation - Works 100% offline with fixtures
37 lines
975 B
Python
37 lines
975 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Quick smoke-test: fetch price data for a few tickers.
|
|
Usage: python scripts/fetch_sample_prices.py
|
|
"""
|
|
|
|
import logging
|
|
from datetime import date, timedelta
|
|
|
|
from pote.db import SessionLocal
|
|
from pote.ingestion.prices import PriceLoader
|
|
|
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def main():
|
|
"""Fetch sample price data."""
|
|
tickers = ["AAPL", "MSFT", "TSLA"]
|
|
end_date = date.today()
|
|
start_date = end_date - timedelta(days=30) # Last 30 days
|
|
|
|
with SessionLocal() as session:
|
|
loader = PriceLoader(session)
|
|
logger.info(f"Fetching prices for {tickers} from {start_date} to {end_date}")
|
|
|
|
results = loader.bulk_fetch_prices(tickers, start_date, end_date)
|
|
|
|
for ticker, count in results.items():
|
|
logger.info(f" {ticker}: {count} records")
|
|
|
|
logger.info("Done!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|