// First, get JWT token from API key
const tokenResponse = await fetch('https://api.paperinvest.io/v1/auth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ apiKey: 'your_api_key' })
});
const { access_token } = await tokenResponse.json();
// Place a market order
const response = await fetch('https://api.paperinvest.io/v1/orders', {
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
accountId: 'your-account-id',
portfolioId: 'your-portfolio-id',
assetClass: 'EQUITY',
symbol: 'AAPL',
side: 'BUY_TO_OPEN',
quantity: 100,
type: 'MARKET',
timeInForce: 'DAY'
})
});
const order = await response.json();
console.log(`Order status: ${order.status}`);
console.log(`Filled at: $${order.avgFillPrice}`);
// Get real-time quote for a symbol
const quoteResponse = await fetch(
'https://api.paperinvest.io/v1/market-data/quote/AAPL',
{
headers: {
'Authorization': `Bearer ${access_token}`
}
}
);
const quote = await quoteResponse.json();
console.log(`Current price: $${quote.last}`);
console.log(`Bid: $${quote.bid} x ${quote.bidSize}`);
console.log(`Ask: $${quote.ask} x ${quote.askSize}`);
// Get batch quotes for multiple symbols
const batchResponse = await fetch(
'https://api.paperinvest.io/v1/market-data/quotes/batch',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${access_token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
symbols: ['AAPL', 'GOOGL', 'MSFT']
})
}
);
Every API endpoint designed to mirror real trading conditions and help you build better trading systems
NBBO matching, queue position simulation, partial fills, and slippage modeling. Test your algorithms with real market conditions.
Enterprise-grade security with API key authentication, JWT tokens, and comprehensive audit logging.
Smart rate limiting, comprehensive error handling, and detailed documentation. Built for serious trading applications.
Everything you need to build sophisticated trading systems
POST /v1/orders
Create OrderSubmit market, limit, stop, and bracket orders
GET /v1/orders/{orderId}
Get OrderRetrieve order details with fill information
PUT /v1/orders/{orderId}/cancel
Cancel OrderCancel pending orders with realistic latency
POST /v1/orders/batch
Batch OrdersSubmit multiple orders in a single request
GET /v1/accounts/portfolios/{id}
PortfolioReal-time portfolio value, positions, and P&L
GET /v1/market-data/quote/{symbol}
QuoteReal-time NBBO quotes with bid/ask sizes
POST /v1/market-data/quotes/batch
Batch QuotesGet quotes for multiple symbols efficiently
GET /v1/activity-log/portfolio/{id}
Activity LogTrack all trading activity and events
Key similarities and differences to set expectations while you validate strategies.
Aspect | Paper Trading | Live Markets |
---|---|---|
Execution | NBBO-based matching; marketable orders execute; partial fills possible | Exchange microstructure, venue routing, queue position matter |
Slippage | Modeled slippage under typical conditions | Can vary widely with liquidity and volatility |
Latency | Retail → colocated-like profiles | Depends on venue, network, and colocations |
Fees & Actions | May omit some regulatory fees and corporate actions | Real regulatory fees, dividends, adjustments apply |
How the simulator behaves so you can interpret results correctly.
Topic | Behavior |
---|---|
Matching | Orders matched against current NBBO; non-marketable limits fill on cross |
Fills | Partial fills occur with realistic probabilities based on liquidity |
Cancel/Replace | Respects matching engine timing semantics |
PDT/Margin | Buying power and PDT checks emulate retail profiles (varies by broker emulation) |
Hours | Extended hours behavior depends on selected broker profile |
Corporate Actions | Dividends and some actions may be simplified or omitted |
Why results differ across platforms and what Paper emulates.
Common Difference | Typical Simulator | Paper |
---|---|---|
Fills | Often instantaneous and full | Partial fills and queue-like behavior possible |
NBBO/Spread | Simplified best-price matching | NBBO-based, considers bid/ask and spread |
Latency | Uniform/ignored | Profiles from retail → colocated-like |
Fees/Margin | Often omitted | Modeled broker rules and buying power assumptions |
Test your trading bots with realistic market conditions before deploying real capital. Perfect for momentum, mean reversion, and arbitrage strategies.
Forward-test your strategies with live market data. See how your algorithms perform with real slippage and market impact.
Integrate paper trading into your educational platform. Give students realistic trading experience without financial risk.
Get your free API key and start building in minutes. No credit card required.
Free tier includes 5 trades per day. View pricing for unlimited access.
Yes. The free tier includes quote streaming and a limited number of simulated orders per day. Upgrade for higher limits.
Yes. Use WebSockets for quotes and SSE for portfolio streams. See the WebSocket guide.
Any language that can call HTTP and WS. See Python and Node.js quickstarts.
Fills simulate NBBO, queue position, partials, and slippage. Latency profiles emulate retail to colocated environments.