# Trade Setup & R:R Planner API
> Live trade-planning analytics built on the geometry of a setup, the numbers a trader checks before pulling the trigger, computed on demand from the entry, stop and target you pass in — no key, no cache, nothing stored. The plan endpoint turns an entry, stop-loss and target into the risk and reward per unit, the reward-to-risk ratio and the break-even win rate — the minimum win rate that makes the trade profitable — and, if you supply an account size and a risk percent, the position size, risk amount and reward amount. The targets endpoint projects target prices at chosen R-multiples of the stop distance, so you can ladder out at 1R, 2R and 3R. The expectancy endpoint turns a reward-to-risk ratio and a win rate into the expected value per trade in R and the profit factor, telling you whether an edge is positive. This is a trade-geometry planner, fundamentally different from account-based position sizers, forward Monte-Carlo simulators and backward trade-journal analyzers: it reasons from the entry, stop and target. Works for any market — forex, stocks, crypto or futures — and for long or short. Computed locally and deterministically, so it is instant and private. Ideal for trade journals, risk checklists, broker tools and trading dashboards. Live, nothing stored. 3 compute endpoints. For Kelly position sizing use a trading-risk API; for a full outcome distribution use a strategy simulator.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/tradesetup-api/..."
```

## Pricing
- **Free** (Free) — 4,450 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 89,500 calls/Mo, 6 req/s
- **Pro** ($21/Mo) — 462,000 calls/Mo, 18 req/s
- **Business** ($48/Mo) — 2,860,000 calls/Mo, 45 req/s

## Endpoints

### Setup

#### `GET /v1/expectancy` — Expected value & profit factor

**Parameters:**
- `reward_risk_ratio` (query, optional, string) — Reward-to-risk ratio Example: `3`
- `win_rate` (query, required, string) — Win rate (fraction or percent) Example: `40`
- `entry` (query, optional, string) — Entry (alternative to RR) Example: `100`
- `stop` (query, optional, string) — Stop (alternative to RR) Example: `98`
- `target` (query, optional, string) — Target (alternative to RR) Example: `106`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tradesetup-api/v1/expectancy?reward_risk_ratio=3&win_rate=40&entry=100&stop=98&target=106"
```

#### `GET /v1/plan` — Risk/reward, RR ratio, break-even + position size

**Parameters:**
- `entry` (query, required, string) — Entry price Example: `100`
- `stop` (query, required, string) — Stop-loss price Example: `98`
- `target` (query, required, string) — Target price Example: `106`
- `side` (query, optional, string) — long or short (default long) Example: `long`
- `account` (query, optional, string) — Account size for position sizing Example: `10000`
- `risk_pct` (query, optional, string) — Risk percent of account (e.g. 1 = 1%) Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tradesetup-api/v1/plan?entry=100&stop=98&target=106&side=long&account=10000&risk_pct=1"
```

#### `GET /v1/targets` — Target prices at R-multiples of the stop

**Parameters:**
- `entry` (query, required, string) — Entry price Example: `100`
- `stop` (query, required, string) — Stop-loss price Example: `98`
- `side` (query, optional, string) — long or short (default long) Example: `long`
- `r_multiples` (query, optional, string) — R-multiples, comma-separated Example: `1,2,3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tradesetup-api/v1/targets?entry=100&stop=98&side=long&r_multiples=1%2C2%2C3"
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/tradesetup-api/v1/meta"
```


---
Marketplace page: https://www.oanor.com/api/tradesetup-api
OpenAPI spec: https://www.oanor.com/api/tradesetup-api/openapi.json
