BioTradingArena

Getting Started

Set up your environment and run your first benchmark evaluation.

Prerequisites

  • A BioTradingArena account — sign up here
  • An API key — create one from your dashboard
  • Python 3.8+ (recommended) or any HTTP client

Install Dependencies

pip install requests

Full Benchmark Runner (Python)

This script pulls all oncology cases, runs a placeholder strategy, verifies scores, and submits to the leaderboard:

import requests

BASE_URL = "https://biotradingarena.com"
API_KEY = "YOUR_API_KEY"
headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
}

# Step 1: Pull all oncology benchmark cases
print("Fetching benchmark cases...")
resp = requests.get(f"{BASE_URL}/api/benchmark/cases?subset=oncology", headers=headers)
resp.raise_for_status()
data = resp.json()
cases = data["cases"]
print(f"Got {len(cases)} cases")

# Step 2: Run your strategy on each case
predictions = []
for case in cases:
    # ---------------------------------------------------
    # REPLACE THIS with your actual prediction logic
    # Available fields:
    #   case["press_release"]       - de-identified PR text
    #   case["clinical_trial"]      - trial details (phase, endpoints, results)
    #   case["company"]             - market cap, sector, float, etc.
    #   case["price_action"]        - OHLCV for day before/of/after
    #   case["pubmed_articles"]     - related PubMed papers
    #   case["indication"]          - therapeutic area
    #   case["phase"]               - clinical phase
    # ---------------------------------------------------
    predicted_impact = "neutral"  # Replace with your model output

    predictions.append({
        "case_id": case["id"],
        "predicted_impact": predicted_impact,
        "confidence": 0.5,  # optional
    })

# Step 3: Verify your predictions
print("Verifying predictions...")
verify_resp = requests.post(
    f"{BASE_URL}/api/benchmark/verify",
    headers=headers,
    json={"predictions": predictions},
)
verify_resp.raise_for_status()
results = verify_resp.json()

print(f"Exact match:  {results['metrics']['exact_match_accuracy']}%")
print(f"Directional:  {results['metrics']['directional_accuracy']}%")
print(f"Close match:  {results['metrics']['close_accuracy']}%")

# Step 4: Submit to leaderboard
print("Submitting to leaderboard...")
submit_resp = requests.post(
    f"{BASE_URL}/api/benchmark/submit",
    headers=headers,
    json={
        "strategy_name": "My Strategy v1",
        "description": "Brief description of your approach",
        "model": "gpt-4o",  # optional - which model you used
        "predictions": predictions,
    },
)
submit_resp.raise_for_status()
result = submit_resp.json()
print(f"Submitted! ID: {result['submission_id']}")
if result.get("leaderboard_rank"):
    print(f"Rank: #{result['leaderboard_rank']} of {result['total_submissions']}")

Using cURL

If you prefer to test endpoints manually:

# Fetch cases
curl -s -H "Authorization: Bearer YOUR_API_KEY" \
  "https://biotradingarena.com/api/benchmark/cases?subset=oncology&limit=5" | jq .

# Verify a single prediction
curl -s -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"predictions": [{"case_id": "onc_0001", "predicted_impact": "positive"}]}' \
  "https://biotradingarena.com/api/benchmark/verify" | jq .