Logo
AXION

Getting Started

Setting Up Your Environment

1

Create an API key

Create an API key in the dashboard here, which you'll use to authenticate all requests to the API.

Store the key as a managed secret and pass it via an environment variable or your app's config.

.env
AXION_API_KEY=<your_api_key_here>
2

Install the SDK

Install the official SDK for your language. We'll also use it to load your API key from an environment variable.

pip install axionquant-sdk python-dotenv
3

Authenticate fetch requests

All API requests require your API key. Include it in one of the following ways - we recommend using the x-api-key header.

Never expose your API key in client-side code. Always make requests from a backend server or use environment variables.

// HTTP Header (Recommended)
const response = await fetch('https://api.axionquant.com/stocks/AAPL', {
  headers: {
    'x-api-key': process.env.AXION_API_KEY
  }
});

// Authorization Bearer
const response = await fetch('https://api.axionquant.com/stocks/AAPL', {
  headers: {
    'Authorization': `Bearer ${process.env.AXION_API_KEY}`
  }
});
4

Make your first SDK request

Retrieve real-time price data for any stock ticker. This endpoint is available on all plans.

const { Axion } = require('@axionquant/sdk');

const client = new Axion(process.env.AXION_API_KEY);
const ticker = await client.stocks.ticker('AAPL');
console.log(ticker);
5

Run the code

node example.js

You should see a response like this:

{
  "symbol": "AAPL",
  "price": 175.34,
  "change": 1.25,
  "changePercent": 0.72,
  "volume": 45678900,
  "marketCap": 2750000000000,
  "timestamp": "2024-01-15T14:30:00Z"
}

ETFs API

The ETFs API provides comprehensive data on Exchange-Traded Funds including fund information, sector weights, geographic exposure, holdings, and fund-of-funds exposure analysis. This data is essential for ETF research, portfolio construction, and investment analysis.

GET/etfs/:ticker/holdings

Retrieves the current top holdings of an ETF with detailed position information including shares held, market value, and percentage weights. Critical for analyzing concentration risk and understanding the ETF's underlying exposures.

Path Parameters

ParameterTypeRequiredDescription
tickerstringRequiredETF ticker symbol (e.g., "SPY", "QQQ", "VTI")

Examples:

https://api.axionquant.com/etfs/QQQ/holdings
https://api.axionquant.com/etfs/SPY/holdings

Response Fields

ticker string

Holding company ticker

name string

Holding company name

weight string

Formatted weight percentage

shares number

Number of shares held

marketValue number

Total market value in USD

rawWeight number

Raw weight as decimal (0.0-1.0)

|

Top Holdings

Request

Sample code
1from axion import Axion
2client = Axion(api_key='axn_123')
3
4holdings = client.etfs.holdings('SPY')
5print(holdings)

Response

[
  {
    "ticker": "NVDA",
    "name": "NVIDIA Corporation",
    "weight": "7.17%",
    "shares": 305156465,
    "marketValue": 44519276678.85,
    "rawWeight": 0.0716544211188534
  },
  {
    "ticker": "AAPL",
    "name": "Apple Inc.",
    "weight": "6.95%",
    "shares": 188603226,
    "marketValue": 43190138754,
    "rawWeight": 0.0695151543630329
  },
  {
    "ticker": "MSFT",
    "name": "Microsoft Corporation",
    "weight": "6.17%",
    "shares": 92204348,
    "marketValue": 38309984550.52,
    "rawWeight": 0.0616604754349895
  }
]
GET/etfs/:ticker/holdings/all

Retrieves the complete list of all holdings for an ETF with weight percentages and the last updated date. Unlike the top holdings endpoint, this provides the full portfolio composition including smaller positions.

Path Parameters

ParameterTypeRequiredDescription
tickerstringRequiredETF ticker symbol (e.g., "SPY", "QQQ", "VTI")

Examples:

https://api.axionquant.com/etfs/QQQ/holdings/all
https://api.axionquant.com/etfs/SPY/holdings/all

Response Fields

name string

Holding company name

ticker string

Holding company ticker

weight string

Formatted weight percentage

rawWeight number

Raw weight as decimal (0.0-1.0)

since string

Date the holding data was last updated

|

All Holdings

Request

Sample code
1from axion import Axion
2client = Axion(api_key='axn_123')
3
4holdings = client.etfs.holdings_all('SPY')
5print(holdings)

Response

[
  {
    "name": "NVIDIA Corporation",
    "ticker": "NVDA",
    "weight": "7.17%",
    "rawWeight": 0.0716544211188534,
    "since": "2024-03-15"
  },
  {
    "name": "Apple Inc.",
    "ticker": "AAPL",
    "weight": "6.95%",
    "rawWeight": 0.0695151543630329,
    "since": "2024-03-15"
  },
  {
    "name": "Microsoft Corporation",
    "ticker": "MSFT",
    "weight": "6.17%",
    "rawWeight": 0.0616604754349895,
    "since": "2024-03-15"
  }
]
GET/etfs/:ticker/weights

Retrieves the detailed sector breakdown and geographic exposure of an ETF. Provides both formatted percentages and raw decimal weights for precise analysis. Essential for understanding concentration risk and geographic diversification.

Path Parameters

ParameterTypeRequiredDescription
tickerstringRequiredETF ticker symbol (e.g., "SPY", "QQQ", "VTI")

Examples:

https://api.axionquant.com/etfs/VTI/weights
https://api.axionquant.com/etfs/QQQ/weights

Response Fields

sector array

Array of sector allocations

name string

Sector name (e.g., "Technology Services")

weight string

Formatted weight percentage (e.g., "21.08%")

rawWeight number

Raw weight as decimal (0.0-1.0)

regions array

Array of geographic exposures

name string

Country or region name

weight string

Formatted weight percentage or "--" for negligible

benchmarkWeight string

Benchmark weight percentage

rawWeight number|string

Raw weight as decimal or "--"

|

Sector & Region Weights

Request

Sample code
1from axion import Axion
2client = Axion(api_key='axn_123')
3
4weights = client.etfs.weights('SPY')
5print(weights)

Response

{
  "sector": [
    {
      "name": "Technology Services",
      "weight": "21.08%",
      "rawWeight": 0.21079285342758
    },
    {
      "name": "Commercial Services",
      "weight": "2.90%",
      "rawWeight": 0.0289666913939312
    }
  ],
  "regions": [
    {
      "name": "United States",
      "weight": "100.00%",
      "benchmarkWeight": "99.89%",
      "rawWeight": 1
    },
    {
      "name": "Canada",
      "weight": "--",
      "benchmarkWeight": "0.11%",
      "rawWeight": "--"
    }
  ]
}