{# Inputs: open_options: list[OpenOptionRow] — both long and short, sorted by expiry cash_secured_total: Decimal premium_received_total: Decimal long_cost_total: Decimal today: date #} {% set _expanded = open_options|length > 0 or (option_counts is defined and (option_counts.long > 0 or option_counts.short > 0)) %} {# Use option_counts from the route (computed pre-slice) for accurate totals when paginated. Fall back to counting from open_options (the page slice) when option_counts is absent. #} {% set _long_count = option_counts.long|default(open_options | selectattr('side', 'equalto', 'long') | list | length) %} {% set _short_count = option_counts.short|default(open_options | selectattr('side', 'equalto', 'short') | list | length) %}

Open options

{% if _long_count %}{{ _long_count }} long{% endif %} {% if _long_count and _short_count %} · {% endif %} {% if _short_count %}{{ _short_count }} short{% endif %} {% if cash_secured_total %} · ${{ "{:,.0f}".format(cash_secured_total) }} secured{% endif %} {% if premium_received_total %} · premium +${{ "%.2f"|format(premium_received_total) }}{% endif %} {% if long_cost_total %} · long cost ${{ "%.2f"|format(long_cost_total) }}{% endif %}
{% if not open_options %}
No open option positions.
{% else %} {% if options_summary is defined and options_summary %}
Open contracts
{{ fmt_quantity(options_summary.open_contracts) }}
Net premium
{{ fmt_currency(options_summary.net_premium) }}
Avg DTE
{{ options_summary.avg_dte|round(0)|int }}d
{% endif %}
{% for s in open_options %} {% set dte = (s.expiry - today).days %} {% if dte <= 7 %}{% set dte_class = 'text-warn' %} {% elif dte <= 21 %}{% set dte_class = 'text-label-1' %} {% else %}{% set dte_class = 'text-label-2' %}{% endif %} {% if s.opened_at %} {% set total_days = (s.expiry - s.opened_at).days %} {% set elapsed = (today - s.opened_at).days %} {% if total_days > 0 %}{% set fill_pct = (elapsed / total_days * 100)|round(0, 'common') %}{% else %}{% set fill_pct = 100 %}{% endif %} {% else %} {% set fill_pct = 50 %} {% endif %} {% set is_long = s.side == 'long' %}
{{ 'LONG' if is_long else 'SHORT' }}
{% if s.call_put == 'C' %}CALL{% else %}PUT{% endif %} ${{ "%g"|format(s.strike) }}
{{ s.expiry.strftime('%m/%d/%y') }}
{% if s.opened_at %}opened {{ (today - s.opened_at).days }}d ago{% else %}— {% endif %}
{% if is_long %}-${{ "%.2f"|format(s.cash_basis) }}{% else %}+${{ "%.2f"|format(s.cash_basis) }}{% endif %}
{% if is_long %}cost paid{% elif s.call_put == 'P' %}${{ "{:,.0f}".format(s.cash_secured) }} secured{% else %}premium{% endif %}
{{ dte }}d
{% endfor %}
{% set _qs = '' %} {% if selected_account %}{% set _qs = _qs + '&account=' + selected_account %}{% endif %} {% set page_base_url = '/holdings/options' %} {% set page_extra_qs = _qs %} {% set page_target = '#holdings-options' %} {% set page_swap = 'innerHTML' %} {% include "_pagination_footer.html" %} {% endif %}