QuantJourney
Quant Journey Documentation
Main Site

Getting Started

Quick start guide to using the QuantJourney API for quantitative trading

Getting Started with QuantJourney API

Welcome to QuantJourney! This guide will help you get up and running with our quantitative trading API in just a few minutes.

What is QuantJourney?

QuantJourney is a comprehensive quantitative trading platform that provides:

  • Real-time market data for stocks, forex, crypto, and commodities
  • Advanced analytics and technical indicators
  • Portfolio management tools with risk assessment
  • Backtesting capabilities for strategy validation
  • Automated trading execution

Prerequisites

Before you begin, make sure you have:

  • A QuantJourney account (sign up at quantjourney.com)
  • API credentials (available in your dashboard)
  • Basic knowledge of REST APIs and JSON
  • Your preferred programming language setup (Python, JavaScript, etc.)

API Overview

The QuantJourney API is organized around REST principles and uses JSON for data exchange. Here are the key concepts:

Base URL

https://api.quantjourney.com/v2

Authentication

All API requests require authentication using your API key. Include it in the Authorization header:

curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://api.quantjourney.com/v2/market-data/stocks/AAPL

Rate Limits

  • Free tier: 1,000 requests per hour
  • Pro tier: 10,000 requests per hour
  • Enterprise: Custom limits

Rate limit information is included in response headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

Quick Start Tutorial

Let’s walk through a complete example of fetching market data and placing a trade.

Step 1: Get Your API Key

  1. Log into your QuantJourney Dashboard
  2. Navigate to Settings > API Keys
  3. Click Generate New Key
  4. Copy your API key and store it securely

{% callout type=“warning” %} Keep your API key secure! Never commit API keys to version control or share them publicly. {% /callout %}

Step 2: Make Your First Request

Let’s fetch current market data for Apple (AAPL):

import requests

# Your API credentials
API_KEY = "your_api_key_here"
BASE_URL = "https://api.quantjourney.com/v2"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Get current stock price
response = requests.get(
    f"{BASE_URL}/market-data/stocks/AAPL/quote",
    headers=headers
)

if response.status_code == 200:
    data = response.json()
    print(f"AAPL Current Price: ${data['price']}")
    print(f"Change: {data['change']} ({data['change_percent']}%)")
else:
    print(f"Error: {response.status_code} - {response.text}")

Step 3: Analyze Historical Data

# Get 30 days of historical data
response = requests.get(
    f"{BASE_URL}/market-data/stocks/AAPL/history",
    headers=headers,
    params={
        "period": "30d",
        "interval": "1d"
    }
)

historical_data = response.json()

# Calculate simple moving average
prices = [day['close'] for day in historical_data['data']]
sma_20 = sum(prices[-20:]) / 20

print(f"20-day SMA: ${sma_20:.2f}")

Step 4: Place a Trade (Paper Trading)

{% callout type=“info” %} Paper Trading: Start with paper trading to test your strategies without risking real money. {% /callout %}

# Place a market buy order (paper trading)
order_data = {
    "symbol": "AAPL",
    "side": "buy",
    "type": "market",
    "quantity": 10,
    "paper_trading": True  # Enable paper trading
}

response = requests.post(
    f"{BASE_URL}/trading/orders",
    headers=headers,
    json=order_data
)

if response.status_code == 201:
    order = response.json()
    print(f"Order placed successfully!")
    print(f"Order ID: {order['id']}")
    print(f"Status: {order['status']}")
else:
    print(f"Order failed: {response.text}")

Error Handling

The API uses standard HTTP status codes and returns detailed error messages:

def handle_api_response(response):
    if response.status_code == 200:
        return response.json()
    elif response.status_code == 401:
        raise Exception("Invalid API key")
    elif response.status_code == 429:
        raise Exception("Rate limit exceeded")
    elif response.status_code >= 500:
        raise Exception("Server error - please try again later")
    else:
        error_data = response.json()
        raise Exception(f"API Error: {error_data.get('message', 'Unknown error')}")

# Usage
try:
    response = requests.get(f"{BASE_URL}/market-data/stocks/AAPL/quote", headers=headers)
    data = handle_api_response(response)
    print(f"Price: ${data['price']}")
except Exception as e:
    print(f"Error: {e}")

SDK Libraries

We provide official SDKs to make integration even easier:

Python

pip install quantjourney-python
from quantjourney import QuantJourney

client = QuantJourney(api_key="your_api_key")
quote = client.get_stock_quote("AAPL")
print(f"AAPL: ${quote.price}")

JavaScript/Node.js

npm install @quantjourney/sdk
const { QuantJourney } = require('@quantjourney/sdk');

const client = new QuantJourney({ apiKey: 'your_api_key' });

async function getQuote() {
  const quote = await client.getStockQuote('AAPL');
  console.log(`AAPL: $${quote.price}`);
}

More Languages

We’re working on SDKs for:

  • Go
  • C#/.NET
  • Java
  • PHP
  • Ruby

Next Steps

Now that you’ve made your first API calls, here’s what to explore next:

  1. Authentication Guide - Learn about API keys, tokens, and security
  2. Market Data - Explore all available market data endpoints
  3. Trading - Learn about order management and execution
  4. WebSocket Streams - Set up real-time data feeds
  5. Portfolio Management - Build and track portfolios

Support

Need help? We’re here for you:

Happy trading! 🚀