Skip to content

Commit f8bc09d

Browse files
committed
docs
1 parent 41d8857 commit f8bc09d

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

docs/src/glossary.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ Commission is specified by the active broker profile and converted from quote to
5151

5252
## Realized P&L
5353

54-
Realized P&L is produced when exposure decreases (`realized_qty`) and is recorded gross of commissions as `fill_pnl_settle`.
54+
`fill_pnl_settle` is gross fill-settled P&L (commissions excluded).
5555

56-
For principal-exchange settlement, `fill_pnl_settle` equals closed-position realized P&L.
57-
For variation-margin settlement, it includes both open mark-to-fill settlement and reduce-basis settlement.
56+
For principal-exchange settlement, `fill_pnl_settle` equals closed-position realized P&L when exposure decreases (`realized_qty`).
57+
For variation-margin settlement, it includes both open mark-to-fill settlement and reduce-basis settlement, and fills reset `avg_settle_price` to the current mark.
5858

5959
Commissions are separate via `commission_settle`. The actual fill cash movement is always `cash_delta_settle`; for variation margin, `cash_delta_settle = fill_pnl_settle - commission_settle`.
6060

docs/src/pitfalls.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- Expiry/liquidation helpers use stored side-aware quotes (`last_bid`/`last_ask`); keep marks updated with `update_marks!`.
77
- Multi-currency equity depends on `ExchangeRates` being updated.
88
- Register non-base currencies via `register_cash_asset!(acc, CashSpec(:EUR))`.
9-
- For variation-margin instruments, trade-level additive fill P&L is `fill_pnl_settle` (gross) and `cash_delta_settle` (net of commission).
9+
- For variation-margin instruments, fills immediately settle to the current mark basis: execution-to-mark (`mark - fill`) hits cash on the fill, and post-fill `avg_settle_price` is the mark. Trade-level additive fill amounts are `fill_pnl_settle` (gross) and `cash_delta_settle` (net of commission).
1010
- `OrderRejectError` rejection semantics are mainly for `fill_order!`; expiry/liquidation helpers send close-only synthetic fills (`fill_qty = -position_qty`) with `allow_inactive=true`, so they do not hit incremental-margin rejection (`inc_qty == 0`).
1111
- Fastback currently has no separate bankruptcy state; forced closes can still leave negative balances/equity in stressed scenarios.
1212
- The package contains optionally loaded `Plots.jl` extension functions (some functions additionally require `StatsPlots.jl`).

src/logic.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ restarts the borrow-fee clock based on the post-fill position.
200200
Throws `OrderRejectError` when the fill is rejected (inactive instrument or risk checks).
201201
Requires bid/ask/last to deterministically value positions and compute margin during fills.
202202
Risk checks only reject exposure-increasing fills (`inc_qty != 0`).
203+
For variation-margin instruments, fills immediately settle execution-to-mark into cash and reset
204+
the settlement basis (`avg_settle_price`) to the current mark.
203205
204206
Commission is broker-driven by default via `acc.broker`.
205207
"""

0 commit comments

Comments
 (0)