> ## Documentation Index
> Fetch the complete documentation index at: https://scalarfield.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Trading Fees

> Platform trading fee schedule by venue, how fees are calculated and deducted from your balance, and what external venue fees to expect.

# Overview

Scalar Field may charge a platform fee on trades executed through certain venues. This fee is calculated as a percentage of the trade's notional value (filled quantity multiplied by fill price), expressed in **basis points** (bps). 1 basis point = 0.01%.

Platform fees are separate from any commissions, spreads, or network fees charged by the venue itself.

# Fee Schedule

| Venue                 | Platform Fee                 | Notes                                             |
| --------------------- | ---------------------------- | ------------------------------------------------- |
| Alpaca Paper          | **None**                     | No platform fee on paper trades                   |
| Alpaca Live           | **None**                     | Coming soon                                       |
| Public.com            | TBD                          | Coming soon                                       |
| Webull                | TBD                          | Coming soon                                       |
| Polymarket            | **0 bps** (currently waived) | Calculated on filled notional value               |
| Jupiter DEX           | **0 bps** (currently waived) | On-chain referral fee may apply separately        |
| Polymarket Redemption | **None**                     | No fee when redeeming resolved prediction markets |

<Info>Polymarket and Jupiter DEX platform fees are currently waived (0 bps). When fees are active, they will appear as `fee_bps` and `fee_amount` in trade responses and history. Note that the fee schedule may vary by subscription tier in the future.</Info>

# How Fees Are Calculated

When a platform fee is active, it is computed at the time of the fill:

```
fee = filled_quantity × fill_price × (fee_bps / 10,000)
```

**Example:** If you buy 100 shares at \$2.50 with a 50 bps platform fee:

```
fee = 100 × $2.50 × (50 / 10,000) = $1.25
```

# How Fees Are Deducted

* **Strategy trades** (`strategy.execute()`): The fee is deducted from the strategy's cash balance at the time of the fill. Your strategy's NAV already reflects any fees paid.
* **Chat trades** (`venue.trade()`): The fee is deducted from the venue balance.
* **On-chain venues** (Polymarket): If a platform fee wallet is configured, the fee is transferred on-chain as a USDC transaction at the time of the trade.
* **Jupiter DEX**: When active, the referral fee is collected on-chain during the swap transaction itself.

You receive exactly the quantity you requested — the fee is a **separate cash deduction**, not a reduction of your fill.

# Fee Visibility

* **Trade responses**: When fees are charged, the `fee_bps` and `fee_amount` fields are included in the response from `venue.trade()` and `strategy.execute()`. When the fee is 0, these fields are `null`.
* **Trade history**: Fees are shown alongside each trade in `venue.history()` via the `fees` field.
* **Strategy NAV**: Already accounts for all fees deducted, so your NAV is always net of trading costs.

# External Venue Fees

Brokerages and exchanges may charge their own fees independently of Scalar Field's platform fee. These are set by the venue and are not controlled by Scalar Field.

| Venue        | External Fees                                                                        |
| ------------ | ------------------------------------------------------------------------------------ |
| Alpaca Paper | None (paper trading)                                                                 |
| Alpaca Live  | Commission-free for US equities; standard regulatory fees may apply                  |
| Polymarket   | Polymarket's own maker/taker fees on the CLOB order book                             |
| Jupiter DEX  | Solana network transaction fees (typically \< \$0.01 per transaction); DEX pool fees |

# Sizing for Fees

When computing order sizes in strategy code, always reserve a buffer for fees and slippage:

```python theme={null}
cash = state["capital"]["cash"]
price = get_latest_price()

# Reserve 5% for fees and slippage
max_qty = round(cash / price * 0.95, 2)
```

The total cost of a buy is slightly higher than `qty × price` due to the platform fee. Budget accordingly.
