Skip to main content

Quickstart

This guide walks you through creating your first subscription and exporting data from Ticksupply. By the end, you’ll have downloaded historical trade data for analysis.

Prerequisites

Before you begin, you need:
Keep your API key secure. Never commit it to version control or share it publicly. All requests made with your key are associated with your account.

Step 1: Verify your API key

Test that your API key works by listing available exchanges:
curl -H "X-Api-Key: YOUR_API_KEY" \
  https://api.ticksupply.com/v1/exchanges
You should see a list of available exchanges:
[
  {
    "code": "binance",
    "display_name": "Binance"
  }
]
If you see the exchange list, your API key is working correctly.

Step 2: Find the data stream you want

Browse available data streams for a specific exchange and trading pair. Let’s find Binance BTCUSDT trades:
curl -H "X-Api-Key: YOUR_API_KEY" \
  "https://api.ticksupply.com/v1/datastreams?exchange=binance&instrument=BTCUSDT&stream_type=trade"
The response is a paginated list of available datastreams:
{
  "items": [
    {
      "datastream_id": 123,
      "exchange": "binance",
      "instrument": "BTCUSDT",
      "stream_type": "trade",
      "wire_format": "json"
    }
  ],
  "total": 1,
  "limit": 100,
  "next_page_token": null
}
Note the datastream_id value—you’ll need it to create a subscription.

Step 3: Create a subscription

Start collecting data by creating a subscription. Replace 123 with your actual datastream ID:
curl -X POST -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"datastream_id": 123}' \
  https://api.ticksupply.com/v1/subscriptions
{
  "id": "sub_550e8400e29b41d4a716446655440000",
  "status": "active",
  "datastream": {
    "datastream_id": 123,
    "exchange": "binance",
    "instrument": "BTCUSDT",
    "stream_type": "trade",
    "wire_format": "json"
  },
  "created_at": "2024-12-21T12:00:00Z",
  "spans": []
}
Data collection has started! The system is now recording trades as they happen.

Step 4: Create an export

After your subscription has been collecting data (even for just a few minutes), you can export it.
Timestamps are in nanoseconds since Unix epoch. You can use integers or strings for large numbers.
Create an export for a specific time range:
# Export last hour of data
# Calculate timestamps: now - 1 hour to now, in nanoseconds
curl -X POST -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "datastream_id": 123,
    "start_time": "1703116800000000000",
    "end_time": "1703120400000000000"
  }' \
  https://api.ticksupply.com/v1/exports
{
  "id": "exp_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4",
  "datastream_id": 123,
  "status": "queued",
  "created_at": "2024-12-21T13:00:00Z",
  "finished_at": null
}

Step 5: Check export status and download

Poll the export status until it completes:
# Check status
curl -H "X-Api-Key: YOUR_API_KEY" \
  https://api.ticksupply.com/v1/exports/exp_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4

# When status is "succeeded", get download URLs
curl -H "X-Api-Key: YOUR_API_KEY" \
  https://api.ticksupply.com/v1/exports/exp_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4/download
The download endpoint returns presigned URLs (valid for 5 minutes) for all export artifacts:
{
  "artifacts": [
    {
      "id": "art_0194a1b2c3d4e5f6a7b8c9d0e1f2a3b4",
      "url": "https://tickstore-exports.s3.amazonaws.com/exports/...",
      "bytes": 524288000,
      "filename": "binance_BTCUSDT_trades_part_001.csv.gz"
    }
  ],
  "count": 1,
  "total_bytes": 524288000
}
Download each artifact using its URL. Files are gzipped CSVs with your tick data.

Next steps

Now that you’ve completed your first export, explore these resources: