Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vectrade.io/llms.txt

Use this file to discover all available pages before exploring further.

Developer Portal

The Developer Portal provides programmatic access to VTrade’s market data, trading engine, and portfolio management capabilities via a RESTful API. Build automated trading strategies, custom analytics dashboards, external alert systems, or integrate VTrade functionality into third-party applications. Developer Portal — Dashboard showing API statistics, active keys, and usage overview

Access Requirements

Navigate to VTrade → Developer from the left sidebar.
The Developer Portal requires an active paid subscription plan. Free-tier accounts do not have API access. If you see a “No Active Subscription” screen, navigate to Settings → Subscription to upgrade your plan. Upon activation, the Developer Portal becomes immediately accessible.

Subscription Tiers & API Entitlements

PlanAPI AccessRate LimitDaily QuotaConcurrent Keys
Free❌ No access
Basic✓ Read-only (market data + portfolio)30 req/min1,000 req/day2 keys
Pro✓ Full access (read + write + trade)120 req/min10,000 req/day5 keys
Premium✓ Full access + priority routing600 req/min100,000 req/day10 keys

Overview Dashboard

The Overview tab provides at-a-glance operational intelligence about your API usage, health status, and consumption trends. Developer Overview — Real-time API statistics with 30-day usage chart and health indicators

Summary Metrics

MetricDescription
Total Requests (Lifetime)Cumulative API calls since account API activation
Requests TodayCalls made in the current 24-hour window (resets at 00:00 UTC)
Active KeysNumber of non-revoked API keys currently provisioned
Error Rate (24h)Percentage of requests returning 4xx or 5xx status codes
Avg. Response TimeMean API response latency over the past 24 hours
Rate Limit StatusCurrent utilization as percentage of your plan’s per-minute limit

30-Day Usage Chart

An interactive line/bar chart displaying daily request volumes over the past 30 days:
  • Primary axis: Total requests per day (bar chart)
  • Secondary axis: Error count per day (line overlay, red)
  • Hover tooltip: Date, total requests, success count, error count, avg. latency
  • Trend line: 7-day moving average to identify usage patterns

Health Status Indicators

IndicatorStates
API AvailabilityOperational (green) / Degraded (amber) / Outage (red)
LatencyNormal (< 200ms) / Elevated (200–500ms) / High (> 500ms)
Rate Limit HeadroomComfortable (< 50% used) / Approaching (50–80%) / Critical (> 80%)

API Key Management

API keys authenticate all programmatic requests to VTrade’s API. Each key is a unique credential that should be treated with the same security as a password. API Keys — Key listing with creation, masking, last-used timestamps, and revocation controls

Key Architecture

VTrade API keys follow the format: vtrd_live_ followed by 48 alphanumeric characters.
  • Prefix: vtrd_live_ (identifies the key as a VTrade production credential)
  • Payload: 48-character cryptographically random string
  • Example: vtrd_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4

Creating a New API Key

  1. Navigate to the API Keys tab
  2. Click + Create API Key
  3. Enter a label — a human-readable identifier describing the key’s purpose:
    • Best practice: Name by project/application (e.g., “Trading Bot - Production”, “Dashboard - Staging”, “Alert System”)
  4. Optionally select permissions (if your plan supports scoped keys):
    • Read Only (market data + portfolio queries)
    • Read + Write (includes order placement and modification)
    • Full Access (all endpoints including account management)
  5. Click Generate
  6. The full key is displayed exactly once in a copy dialog
Critical Security Notice: The complete API key is displayed only at the moment of creation. After you close the generation dialog, the key is irreversibly masked and cannot be retrieved. Copy it immediately and store it in a secure location (password manager, encrypted environment variable, or secrets management service). If you lose the key, you must revoke it and generate a new one.

Key Storage Best Practices

✅ Do❌ Do Not
Store in environment variablesHard-code in source files
Use a secrets manager (HashiCorp Vault, AWS Secrets Manager, 1Password)Commit to version control (Git)
Restrict file permissions (0600) for key filesShare via unencrypted channels (email, chat)
Rotate keys periodically (every 90 days recommended)Expose in client-side / browser JavaScript
Use separate keys per application/environmentUse a single key for all purposes

API Keys Table

ColumnDescription
LabelUser-assigned descriptive name
Key (Masked)First 10 + last 4 characters visible (e.g., vtrd_live_a...x4)
PermissionsRead / Read+Write / Full Access
CreatedISO timestamp of key generation
Last UsedTimestamp of most recent successful API call using this key
Requests (24h)Number of requests made with this key in the past 24 hours
StatusActive ✓ / Revoked ✗
ActionsRevoke button

Revoking an API Key

If a key is compromised, no longer needed, or being rotated:
  1. Locate the key in the table
  2. Click Revoke
  3. Confirm the action in the dialog (this is irreversible)
  4. Immediate effect: All subsequent requests using this key receive 401 Unauthorized
  5. The key remains in the table (grayed out, marked “Revoked”) for audit purposes
Create separate API keys for each application, environment (dev/staging/prod), and team member. This practice ensures that revoking a compromised key affects only one integration point, minimizing disruption to your other systems.

Key Rotation Workflow

Recommended procedure for rotating API keys without downtime:
  1. Create a new key with the same label + “(v2)” suffix
  2. Update your application configuration to use the new key
  3. Verify the new key works correctly (make a test API call)
  4. Revoke the old key
  5. Monitor for any 401 errors that indicate missed configuration points

Usage Analytics

The Usage tab provides comprehensive API consumption analytics, helping you monitor request patterns, identify errors, and optimize your integration. API Usage — Detailed consumption analytics with endpoint breakdown and error analysis

Usage Chart (Interactive)

A configurable chart displaying request metrics over time: View Options:
DimensionBreakdown
By Endpoint CategoryMarket Data / Trading / Portfolio / Copilot / Alerts
By Response Status2xx (Success) / 4xx (Client Error) / 5xx (Server Error)
By API KeyPer-key usage (if multiple keys active)
By HourHourly distribution within a day (identifies peak usage times)
Time Range: Last 24 hours, Last 7 days, Last 30 days, Custom range

Daily Breakdown Table

ColumnDescription
DateCalendar date
Total RequestsSum of all API calls
Successful (2xx)Requests returning success status
Client Errors (4xx)Authentication failures, validation errors, not found
Server Errors (5xx)Internal server errors (should be near-zero)
Success RateSuccessful ÷ Total (as percentage)
Avg. LatencyMean response time in milliseconds
P95 Latency95th percentile response time
Top EndpointMost-called endpoint path
Peak MinuteHighest requests-per-minute value observed

Error Analysis

A dedicated error breakdown panel showing:
  • Error code distribution — Pie chart of 400, 401, 403, 404, 429, 500 responses
  • Recent errors — Table of last 50 error responses with timestamp, endpoint, status code, and error message
  • Error trend — Is your error rate increasing, stable, or decreasing?

Rate Limit Monitoring

Real-time rate limit telemetry:
MetricDescription
Current RateRequests in the current sliding 60-second window
Plan LimitMaximum requests per minute for your subscription
Utilization %Current / Limit as percentage
Throttled Requests (24h)Number of requests that received 429 status
Daily Quota UsedRequests today / Daily limit
Daily Quota RemainingRequests available before daily limit
Rate Limit Response: When you exceed your per-minute rate limit, the API returns:
HTTP/1.1 429 Too Many Requests
Retry-After: 12
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1716220800
Headers included in every response:
HeaderDescription
X-RateLimit-LimitYour plan’s per-minute limit
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets

Authentication

All API requests must include your API key in the Authorization header using the Bearer token scheme:
Authorization: Bearer vtrd_live_your_api_key_here
Authentication Errors:
Status CodeMeaningResolution
401 UnauthorizedMissing or invalid API keyVerify key is correct and not revoked
403 ForbiddenKey lacks required permissionsUse a key with appropriate scope
429 Too Many RequestsRate limit exceededWait for Retry-After seconds, then retry

Quick Start Examples

cURL — Get a Stock Quote

curl -X GET "https://api.vectrade.com/v1/market/quote?symbol=AAPL" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response:
{
  "symbol": "AAPL",
  "exchange": "NASDAQ",
  "price": 189.45,
  "bid": 189.43,
  "ask": 189.47,
  "change": 2.31,
  "changePercent": 1.24,
  "volume": 52341000,
  "avgVolume": 48200000,
  "marketCap": 2940000000000,
  "dayHigh": 190.12,
  "dayLow": 186.80,
  "previousClose": 187.14,
  "timestamp": "2024-01-15T16:00:00Z"
}

cURL — Place a Limit Order

curl -X POST "https://api.vectrade.com/v1/trading/orders" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "AAPL",
    "exchange": "NASDAQ",
    "side": "BUY",
    "orderType": "LIMIT",
    "quantity": 10,
    "limitPrice": 185.00,
    "timeInForce": "GTC"
  }'
Response:
{
  "orderId": "ord_8f3a2b1c4d5e6f7a",
  "symbol": "AAPL",
  "side": "BUY",
  "orderType": "LIMIT",
  "quantity": 10,
  "limitPrice": 185.00,
  "timeInForce": "GTC",
  "status": "WORKING",
  "createdAt": "2024-01-15T14:23:45Z"
}

cURL — Get Portfolio Positions

curl -X GET "https://api.vectrade.com/v1/portfolio/positions" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "positions": [
    {
      "symbol": "AAPL",
      "exchange": "NASDAQ",
      "side": "LONG",
      "quantity": 50,
      "averageCost": 178.32,
      "currentPrice": 189.45,
      "marketValue": 9472.50,
      "unrealizedPnl": 556.50,
      "unrealizedPnlPercent": 6.24,
      "weight": 12.3
    }
  ],
  "totalEquity": 1052340.00,
  "cashBalance": 876200.00
}

Python SDK

from vectrade import VecTrade

# Initialize client with API key
client = VecTrade(api_key="vtrd_live_your_api_key_here")

# --- Market Data ---
quote = client.market.get_quote(symbol="AAPL")
print(f"{quote.symbol}: ${quote.price} ({quote.change_percent:+.2f}%)")

# Get historical data
history = client.market.get_history(
    symbol="NVDA",
    interval="1d",
    period="6mo"
)
for candle in history[-5:]:
    print(f"  {candle.date}: O={candle.open} H={candle.high} L={candle.low} C={candle.close}")

# --- Trading ---
# Place a market order
order = client.trading.place_order(
    symbol="AAPL",
    exchange="NASDAQ",
    side="BUY",
    order_type="MARKET",
    quantity=10
)
print(f"Order {order.id}: {order.status} — filled at ${order.fill_price}")

# Place a limit order with GTC
limit_order = client.trading.place_order(
    symbol="NVDA",
    exchange="NASDAQ",
    side="BUY",
    order_type="LIMIT",
    quantity=5,
    limit_price=800.00,
    time_in_force="GTC"
)

# Cancel an order
client.trading.cancel_order(order_id=limit_order.id)

# --- Portfolio ---
positions = client.portfolio.get_positions()
for pos in positions:
    pnl_emoji = "📈" if pos.unrealized_pnl > 0 else "📉"
    print(f"  {pnl_emoji} {pos.symbol}: {pos.quantity} shares, P&L: ${pos.unrealized_pnl:.2f}")

# Get account summary
account = client.portfolio.get_summary()
print(f"Total Equity: ${account.total_equity:,.2f}")
print(f"Cash: ${account.cash_balance:,.2f}")
print(f"Day P&L: ${account.day_pnl:,.2f}")

TypeScript / Node.js SDK

import { VecTrade } from '@vectrade/sdk';

// Initialize client
const client = new VecTrade({ apiKey: 'vtrd_live_your_api_key_here' });

// --- Market Data ---
const quote = await client.market.getQuote({ symbol: 'AAPL' });
console.log(`${quote.symbol}: $${quote.price} (${quote.changePercent}%)`);

// Get key statistics
const stats = await client.market.getStats({ symbol: 'NVDA' });
console.log(`NVDA P/E: ${stats.peRatio}, Market Cap: $${stats.marketCap}`);

// --- Trading ---
// Place a bracket order
const order = await client.trading.placeOrder({
  symbol: 'AAPL',
  exchange: 'NASDAQ',
  side: 'BUY',
  orderType: 'BRACKET',
  quantity: 20,
  takeProfitPrice: 200.00,
  stopLossPrice: 175.00,
  timeInForce: 'GTC',
});
console.log(`Bracket order ${order.orderId}: ${order.status}`);

// --- Portfolio ---
const positions = await client.portfolio.getPositions();
positions.forEach((pos) => {
  console.log(`${pos.symbol}: ${pos.quantity} @ $${pos.averageCost} → $${pos.currentPrice}`);
});

// Get performance metrics
const metrics = await client.portfolio.getMetrics({ period: '1M' });
console.log(`Monthly Return: ${metrics.totalReturn}%`);
console.log(`Sharpe Ratio: ${metrics.sharpeRatio}`);

API Endpoint Reference (Summary)

CategoryEndpointMethodDescription
Market/v1/market/quoteGETReal-time quote for a symbol
Market/v1/market/historyGETHistorical OHLCV data
Market/v1/market/statsGETKey statistics and ratios
Market/v1/market/moversGETTop gainers, losers, most active
Market/v1/market/newsGETNews articles with sentiment
Trading/v1/trading/ordersPOSTPlace a new order
Trading/v1/trading/orders/{id}DELETECancel a pending order
Trading/v1/trading/ordersGETList all open orders
Trading/v1/trading/orders/{id}GETGet order status
Portfolio/v1/portfolio/positionsGETAll current positions
Portfolio/v1/portfolio/historyGETTrade history with filters
Portfolio/v1/portfolio/summaryGETAccount summary metrics
Portfolio/v1/portfolio/equity-curveGETHistorical portfolio values
Alerts/v1/alertsPOSTCreate a price alert
Alerts/v1/alertsGETList active alerts
Alerts/v1/alerts/{id}DELETECancel an alert
Complete API documentation with request/response schemas, error codes, WebSocket streaming endpoints, and pagination details is available at api.vectrade.com/docs. The interactive API explorer allows you to test endpoints directly from the browser with your API key.

Webhook Integration (Coming Soon)

VTrade will support outbound webhook notifications for real-time event delivery:
  • Order status changes (filled, cancelled, rejected)
  • Price alert triggers
  • Portfolio threshold alerts (drawdown, target return)
  • Competition status updates
Webhooks will deliver JSON payloads to your configured HTTPS endpoint with HMAC signature verification for security.