{% extends "base.html" %}{% from "_macros.html" import chart as svg_chart, empty, flash, kpi, pnl, page_head, source_note %} {% block title %}History{% endblock %} {% block content %} {# web/fantasy_routes.py history_page: the alpha's History tab (web/layout.py). Your F$, every trade by hand and by the strategy you follow, F$ through the run, and the leaderboard (fantasy/ledger.ranked: ROI x sqrt(trades)). #} {% call page_head("History", "Every trade you have made, your fantasy bucks through the run, and the leaderboard. F$ only: nothing here is real money, and no order ever reaches an exchange.") %} Trade → · Leaderboard ↓{% endcall %} {{ flash(msg) }} {% if not ready %}

Not open yet

Fantasy trading hasn't been set up on this site yet.

{% else %}
{{ kpi("Total F$", "F${:,.2f}".format(s.total), "your 1,000 plus both P&Ls" ~ (" · rank " ~ mine.rank ~ " of " ~ rows|selectattr("rank")|list|length if mine and mine.rank else "")) }} {{ kpi("Cash", "F${:,.2f}".format(s.cash), "what you can trade with now") }} {{ kpi("By hand", s.manual_pnl, s.open ~ " open, worth " ~ "F$%.2f"|format(s.held) ~ " now" ~ (" (" ~ s.unpriced ~ " unpriced)" if s.unpriced else ""), "money") }} {{ kpi("Strategy", s.strategy_pnl, (profile.name if profile else "none picked") ~ " · " ~ s.strategy_positions ~ " positions", "money") }}
{{ source_note(note_sport, note_venues, model=(profile is not none)) }}

F$ by hand through the run

{% if chart %}{{ svg_chart(chart) }}

Each point is after an order, with open trades at what they cost (so a trade moves it only by its fee); the last point, marked "now", values open trades at what they would sell for now.

{% else %}{{ empty("Your F$ through the run shows here once you have traded by hand.") }}{% endif %}

Open trades

{% if positions %}
{% for p in positions %}{% endfor %}
MarketSideSharesCostWorth nowP&L
{{ p.group_title or p.question }}
{{ p.event_title or "" }} · {{ p.exchange|capitalize }}
{{ p.side|upper }} {{ "%g"|format(p.shares) }}{{ "%.2f"|format(p.cost) }} {{ "%.2f"|format(p.value) if p.value is not none else "–" }}{{ pnl(p.pnl) }} Sell
{% else %}{{ empty("No open trades. Trades you make by hand show here.") }}{% endif %}

Settled trades {{ settled|length }}

{% if settled %}
{% for p in settled %}{% endfor %}
MarketSideSharesCostOutcomePayoutP&LSettled
{{ p.group_title or p.question }}
{{ p.event_title or "" }} · {{ p.exchange|capitalize }}
{% if p.side %}{{ p.side|upper }}{% else %}–{% endif %} {{ "%g"|format(p.shares) }}{{ "%.2f"|format(p.cost) }} {% if p.outcome is none %}{{ p.status }}{% else %}{{ "YES" if p.outcome else "NO" }}{% endif %} {{ "%.2f"|format(p.payout) if p.payout is not none else "–" }}{{ pnl(p.pnl) if p.pnl is not none else "–" }} {{ p.settled_at|fmt }}

Each share of the winning side paid F$1 when the market resolved; P&L is the payout less what the shares cost (fees are in your orders).

{% else %}{{ empty("No settled trades yet. A trade by hand shows here once its market resolves and pays out.") }}{% endif %}

Orders by hand {{ orders|length }}

{% if orders %}
{% for o in orders %}{% endfor %}
WhenMarketOrderFilledAvg priceFeeResult
{{ o.created_at|fmt }}{{ o.group_title or o.question or "–" }} {{ (o.action or "")|capitalize }} {{ "%g"|format(o.shares_req) if o.shares_req is not none }} {{ (o.side or "")|upper }}{% if o.limit_price is not none %} at {{ "%.2f"|format(o.limit_price) }}{% endif %} {{ "%g"|format(o.shares_filled) }}{{ "%.3f"|format(o.avg_price) if o.avg_price is not none else "–" }} {{ "%.2f"|format(o.fee) }} {% if o.status == 'rejected' %}refused: {{ reasons.get(o.reject_reason, o.reject_reason) }}{% else %}{{ o.status }}{% endif %}
{% else %}{{ empty("No orders yet. Orders you place on Trade show here, refused ones too.") }}{% endif %}

Your strategy's trades{% if profile %} {{ profile.name }}{% endif %}

{% if strat %}
{% for r in strat %}{% endfor %}
EventKindSubjectSideStateP&L
{{ r.event_name or r.event_key }}{{ r.kind|kind }}{{ r.subject }} {% if r.side %}{{ r.side|upper }}{% else %}–{% endif %} {{ r.state }}{{ pnl(r.pnl) if r.pnl is not none else "–" }}

Paper trades the strategy made for you at the exchanges' recorded prices. Its positions, stage by stage →

{% elif profile %}{{ empty("The strategy you follow hasn't traded yet. It trades on race weekends.") }} {% else %}

You don't follow a strategy. Pick one and it paper-trades for you on race weekends.

{% endif %}
{% endif %}

Leaderboard

{% if rows %}
{% for r in rows %} {% endfor %}
#PlayerScoreROITradesP&LBy handStrategy
{{ r.rank if r.rank else "–" }}{{ r.username }}{% if user and r.username == user.username %} you{% endif %} {% if r.score is not none %}{{ "%.2f"|format(r.score) }}{% else %}–{% endif %} {{ "%.1f%%"|format(r.roi * 100) if r.roi is not none else "–" }}{{ r.trades }} {{ pnl(r.pnl) }}{{ pnl(r.manual_pnl) }}{{ pnl(r.strategy_pnl) }}

Score = ROI × √trades, where ROI is P&L (by hand plus strategy) over the F$ staked, and trades counts your filled orders plus the markets your strategy traded. A player needs {{ min_trades }} trades to be ranked; those with fewer are listed after, with "–" for rank. Open trades count at what they would sell for now (the best recorded bid). The demo accounts aren't listed.

{% else %}{{ empty("No players yet.") }}{% endif %}
{% endblock %}