PY := .venv/bin/python

.PHONY: help run signals buy fetch rss analyze force dry company saxo saxo-buy saxo-sell saxo-login saxo-status dashboard

help:
	@echo ""
	@echo "  make          → fetch + analyze new articles + vis board"
	@echo "  make run      → samme som make"
	@echo "  make force    → gen-analyser ALLE artikler (med Claude)"
	@echo "  make dry      → dry-run uden at gemme noget"
	@echo "  make signals  → vis signal board"
	@echo "  make buy      → vis kun køb-kandidater"
	@echo "  make fetch    → hent nye artikler fra Ground News"
	@echo "  make rss      → hent danske RSS feeds (Børsen, Finans, Politiken)"
	@echo "  make dashboard → start dashboard på http://localhost:5001"
	@echo "  make portfolio → vis åbne positioner + P&L"
	@echo "  make company  → TICKER=NOVO-B make company"
	@echo "  make saxo     → vis Saxo SIM konto status + positioner"
	@echo "  make saxo-buy → TICKER=NOVO-B N=5 make saxo-buy"
	@echo "  make saxo-sell → TICKER=NOVO-B N=5 make saxo-sell"
	@echo ""

run: analyze signals

analyze:
	$(PY) analyze.py

force:
	$(PY) analyze.py --force

dry:
	$(PY) analyze.py --dry-run --force

signals:
	$(PY) signals.py board

buy:
	$(PY) signals.py buy

fetch:
	$(PY) -c "from ground_news import fetch_all, get_db; db=get_db(); fetch_all(db, force=True); print('Done')"

rss:
	$(PY) rss_feeds.py

dashboard:
	$(PY) dashboard.py

orders:
	$(PY) portfolio.py orders

portfolio:
	$(PY) portfolio.py status

company:
	$(PY) signals.py company $(TICKER)

saxo-login:
	$(PY) saxo_auth.py login

saxo-status:
	$(PY) saxo_auth.py status

saxo:
	$(PY) saxo_broker.py status

saxo-buy:
	$(PY) saxo_broker.py buy $(TICKER) $(N)

saxo-sell:
	$(PY) saxo_broker.py sell $(TICKER) $(N)
