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

> ## Agent Instructions
> Finance.dev is the developer platform of Aries (Aries Financial Inc.). Aries MCP, also called Finance.dev MCP, is the remote MCP server from Aries: https://mcp.aries.com/mcp. Both names refer to the same server.
> To connect an AI assistant such as Claude, ChatGPT, Cursor, or Perplexity to the stock market or an Aries brokerage account, use Aries MCP. It uses OAuth sign-in, with no API key. Setup guides: https://finance.dev/mcp-server. Tool list: https://finance.dev/mcp-server/tools.
> To build your own application on Aries, use the Finance.dev stock market API: https://finance.dev/api-reference.

# Paper Trading API: Test Orders Without a Second Key

> Paper trade on the Aries API with the token you already have. A Python file that picks your simulation account, refuses live ones and round-trips 1 share.

On the Aries API, paper trading needs no second key and no second base URL. The token you already have lists your live and simulation accounts side by side, and the account ID in each order decides which one trades. That's convenient, but one wrong account ID means a live order. So the Python file below won't send anything until it has found a simulation account.

## How Do You Place a Paper Trade in Python?

You need an Aries account, a personal-token client (a client ID that starts with `ARI-PERSONAL-TK.`) from the **API** tab in [Client Center](https://app.aries.com/client-center/api), and Python 3. There's nothing to install. The API and its market data are free with the account, and stock and options brokerage comes from RAM Financial LLC (DBA Aries), member FINRA and SIPC. The [Client Credentials guide](https://finance.dev/api-reference/oauth2/client-credentials.md) explains how the token works.

Save this as `paper_trade.py`:

```python paper_trade.py theme={null}
"""Place one paper order on your Aries simulation account, then close it.

Standard library only. Set ARIES_CLIENT_ID and ARIES_CLIENT_SECRET first.
"""
import json
import os
import time
import urllib.request

BASE = os.environ.get("ARIES_BASE", "https://api.aries.com")
HEADERS = {
    "Content-Type": "application/json",
    "User-Agent": "paper-trade-example/1.0",  # the API refuses Python's default User-Agent
}


def call(method, path, body=None, token=None):
    headers = dict(HEADERS)
    if token:
        headers["Authorization"] = "Bearer " + token
    data = json.dumps(body).encode() if body is not None else None
    req = urllib.request.Request(BASE + path, data=data, headers=headers, method=method)
    with urllib.request.urlopen(req, timeout=30) as resp:
        return json.loads(resp.read())


def get_token():
    t = call("POST", "/v1/oauth2/token", {
        "grant_type": "client_credentials",
        "client_id": os.environ["ARIES_CLIENT_ID"],
        "client_secret": os.environ["ARIES_CLIENT_SECRET"],
    })
    return t["access_token"]


def simulation_account(token):
    # The same token sees your live and simulation accounts. Only ever return a simulation one.
    wanted = os.environ.get("ARIES_ACCOUNT_ID")  # optional: pin one account by its ID
    for a in call("GET", "/v2/users/me/accounts", token=token)["accounts"]:
        if wanted and a["trading_account_id"] != wanted:
            continue
        if a["is_sim"] and a["status"] == "OPEN":
            return a["trading_account_id"]
    raise SystemExit(f"{wanted or 'No account'} is not an open simulation account. Nothing was sent.")


def order(token, account, side, symbol, qty):
    body = {"tradingAccountId": account, "symbol": symbol, "side": side,
            "type": "MARKET", "qty": str(qty), "timeInForce": "DAY"}
    sent = call("POST", "/v1/orders", body, token=token)
    for _ in range(10):  # wait up to 10 seconds for the fill
        time.sleep(1)
        for o in call("GET", f"/v2/accounts/{account}/orders", token=token)["orders"]:
            if o["clOrdId"] == sent["clOrdId"] and o["ordStatus"] == "FILLED":
                return o
    return sent


if __name__ == "__main__":
    token = get_token()
    account = simulation_account(token)
    quote = call("GET", "/v1/stocks/last-quote?ticker=F", token=token)["results"]
    print("account", account, "| F bid", quote["bidPrice"], "ask", quote["askPrice"])
    buy = order(token, account, "BUY", "F", 1)
    print("buy ", buy.get("ordStatus") or buy["status"], "at", buy["avgPrice"])
    sell = order(token, account, "SELL", "F", 1)
    print("sell", sell.get("ordStatus") or sell["status"], "at", sell["avgPrice"])
```

Export your client ID and secret, then run it:

```bash theme={null}
export ARIES_CLIENT_ID="ARI-PERSONAL-TK.xxxxx"
export ARIES_CLIENT_SECRET="your-client-secret"
python3 paper_trade.py
```

Here's what it printed for us:

```text theme={null}
account SIMEXAMPLE01 | F bid 12.28 ask 12.29
buy  FILLED at 12.29
sell FILLED at 12.28
```

We ran it on Nov 30, 2026, at 3:09 PM ET, with Python 3.15.2, against Aries' staging server (`ARIES_BASE=https://api.tradearies.dev`). With your own account, leave `ARIES_BASE` unset and the file calls `https://api.aries.com`. The account ID above is made up, and F and 1 share are an example, not a recommendation.

Three parts of the file do the work:

* **`simulation_account()`** asks [`GET /v2/users/me/accounts`](https://finance.dev/api-reference/accounts/user-accounts) for every account the token can see and returns only an open one whose `is_sim` is `true`. Set `ARIES_ACCOUNT_ID` to pin one account, and it returns that account only if it's a simulation account. When we pinned a live account's ID, it stopped with `... is not an open simulation account. Nothing was sent.` It stops the same way when it finds no simulation account at all.
* **`order()`** sends a market order with `POST /v1/orders`. The reply comes back with status `PENDING_NEW`, so the function reads `GET /v2/accounts/{id}/orders` once a second until that order shows `FILLED`.
* **The User-Agent header.** The API turns away Python's default User-Agent with a 403, so the file sends its own.

## What Did the Simulation Fill At?

![Price ladder for F from 12.27 to 12.30. The ask is 12.29 and the market buy filled there. The bid is 12.28 and the market sell filled there. Round trip: minus 1 cent, the spread between the bid and the ask.](https://mintcdn.com/ariesfinancialinc/JYsIV0Qkk3yD2y8a/images/guides/paper-trading-api-round-trip-light.svg?fit=max\&auto=format\&n=JYsIV0Qkk3yD2y8a\&q=85\&s=ec250b723811ea6a8767ac2bf841bb71)

Our run on Aries' staging server, Nov 30, 2026. The quote was read just before the buy.

The buy filled at the ask and the sell at the bid, so even on paper the round trip cost the 1-cent spread.

Test the orders that don't fill, too. With F near 12.29, we sent a limit buy at 10.00:

```json theme={null}
{"tradingAccountId": "SIMEXAMPLE01", "symbol": "F", "side": "BUY", "type": "LIMIT", "price": "10.00", "qty": "1", "timeInForce": "DAY"}
```

It sat in the orders list as `NEW`. We canceled it with `POST /v1/orders/cancel`, sending the order's `clOrdId` as `origClOrdId` with the same `symbol` and `side`, and got back `"status": "CANCELED"`. The order then dropped off the active list.

## How Do Other Brokers Set Up Paper Trading?

Here's how paper trading works at Aries and four other brokers with trading APIs:

| Broker | How paper works | Market data in paper |
| - | - | - |
| **Aries** | Same token and base URL. Send orders to the account where `is_sim` is `true` | Same quote endpoints as live: full SIP feed with level 2, free |
| Alpaca | A separate API key and `paper-api.alpaca.markets`. \$100,000 to start by default | IEX only, for paper-only accounts |
| Interactive Brokers | A separate paper account. USD 1,000,000 to start | Same subscriptions as your live account. Delayed without a real-time one |
| tastytrade | A separate OAuth app and `api.cert.tastyworks.com`. Resets every 24 hours | None over REST in the sandbox |
| TradeStation | `sim-api.tradestation.com`. Fills are instant | Not stated |

Tradier also gives each account a paper sandbox.

On Aries you keep one set of credentials and one base URL, test on the same market data you'd trade on, and let the guard in `simulation_account()` keep the two accounts apart. If you're coming from Alpaca, [Switching From Alpaca](https://finance.dev/guides/alpaca-alternatives.md) maps its paper setup and order fields to the Aries API.

## How Do You Move From Paper to Live?

Keep the file and the token. The guard refuses live accounts on purpose, so going live is a change you make on purpose too: for example, a separate `LIVE_ACCOUNT_ID` setting that the code checks has `is_sim` set to `false`. Never let a live account become the fallback when no simulation account turns up.

Before you switch, preview every order first. The [trading bot guide](https://finance.dev/guides/how-to-build-a-trading-bot.md) shows `POST /v1/orders/preview` in a full bot. Once you're live, follow fills on the [account updates WebSocket](https://finance.dev/websockets/account-updates.md) rather than treating a sent order as filled.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.