Files
OpenClaw Sub-agent b67a834def feat(invest): cost basis & P&L, AUD totals, chart ranges, per-ticker page, manual entry, tx search
P1:
- WAC cost basis per (portfolio, ticker): avg_cost / unrealized P&L / P&L%
  - transaction price when recorded, else trade-date market close (estimated, flagged)
  - dashboard: Unrealized P&L card + Avg Cost & P&L columns on holdings tables
  - fx: frankfurter.dev rates (USD/HKD->AUD, 24h cache, UA header required) -> AUD total on Total Value card
  - chart: 1M/3M/6M/YTD/1Y/ALL period buttons (all periods precomputed server-side, top-level payload stays YTD for compat)
P2:
- /invest/stocks/<ticker>/ per-ticker page: cross-account holdings, WAC, P&L, weight, theme, trade history
- manual transaction + cashflow entry forms (source=MANUAL, confidence=1.0)
- dashboard transaction search (?q= ticker/account) + add-transaction buttons
- tickers link to detail page; tabular-nums on all figures
- 8 new tests (WAC sell, estimated price, incomplete, per-portfolio agg, stock page, forms, search)
2026-08-02 08:09:58 +10:00

27 lines
1.3 KiB
Python

from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import PortfolioViewSet, StockViewSet, TransactionViewSet, AIUpdateView
from . import template_views
router = DefaultRouter()
router.register(r'portfolios', PortfolioViewSet, basename='invest-portfolio')
router.register(r'stocks', StockViewSet, basename='invest-stock')
router.register(r'transactions', TransactionViewSet, basename='invest-transaction')
# API URL patterns (mounted at /api/invest/ in core/urls.py)
api_urlpatterns = [
path('', include(router.urls)),
path('ai-update/', AIUpdateView.as_view(), name='invest-ai-update'),
]
# Template URL patterns (mounted at /invest/ in core/urls.py)
urlpatterns = [
path('', template_views.dashboard, name='invest-dashboard'),
path('portfolios/<int:pk>/', template_views.portfolio_detail, name='invest-portfolio-detail'),
path('portfolios/<int:pk>/transactions/', template_views.portfolio_transactions, name='invest-portfolio-transactions'),
path('stocks/<str:ticker>/', template_views.stock_detail, name='invest-stock-detail'),
path('transactions/new/', template_views.transaction_create, name='invest-transaction-create'),
path('cashflows/new/', template_views.cashflow_create, name='invest-cashflow-create'),
]