Read Workflow

This workflow retrieves backtest results from the platform. You'll learn how to list strategies, view scenarios, and download results in various formats.

Overview

The read workflow follows these steps:

  1. List strategies - See all your trading strategies
  2. List scenarios - See backtests for a specific strategy
  3. Download results - Get metadata, timeseries, or trade data

Prerequisites

Before starting, ensure you have:

Step 1: List Your Strategies

First, view all your strategies to find the one you want to analyze:

tektii strategy list

This displays a table with your strategies:

┌──────────────────────────────────────┬──────────────┬─────────────────────┐
│ ID                                   │ Name         │ Created             │
├──────────────────────────────────────┼──────────────┼─────────────────────┤
│ strat_abc123...                      │ momentum-v1  │ 2024-01-15 10:30    │
│ strat_def456...                      │ mean-revert  │ 2024-01-10 14:22    │
└──────────────────────────────────────┴──────────────┴─────────────────────┘

Pagination

For large lists, use pagination:

# Limit to 10 results
tektii strategy list --limit 10

# Get next page using cursor from previous response
tektii strategy list --cursor "eyJsYXN0X2lkIjoi..."

JSON Output

For scripting or piping to other tools, use JSON output:

tektii --output json strategy list | jq '.strategies[0].id'

Step 2: List Scenarios for a Strategy

Once you have a strategy ID, list its backtest scenarios:

tektii scenario list strat_abc123

This shows all backtests run against that strategy:

┌──────────────────────────────────────┬─────────────────────┬──────────┐
│ ID                                   │ Created             │ Status   │
├──────────────────────────────────────┼─────────────────────┼──────────┤
│ scen_xyz789...                       │ 2024-01-20 09:15    │ complete │
│ scen_uvw012...                       │ 2024-01-18 16:30    │ complete │
└──────────────────────────────────────┴─────────────────────┴──────────┘

Pagination works the same way:

tektii scenario list strat_abc123 --limit 5 --cursor "..."

Step 3: Download Results

With both strategy and scenario IDs, download the backtest results.

View Metadata

By default, scenario download displays metadata in your terminal:

tektii scenario download strat_abc123 scen_xyz789

Output:

┌─────────────────────┬──────────────────────┐
│ Metric              │ Value                │
├─────────────────────┼──────────────────────┤
│ ID                  │ scen_xyz789          │
│ Starting Capital    │ $100,000             │
│ Final Capital       │ $112,450             │
│ Total Return %      │ 12.45%               │
│ Duration            │ 365 days             │
│ Trades              │ 142 (0 open)         │
│ Trades per Day      │ 0.39                 │
│ Data Points         │ 525,600              │
└─────────────────────┴──────────────────────┘

Download Metadata as JSON

Save metadata to a file:

tektii scenario download strat_abc123 scen_xyz789 \
  --output json \
  --file metadata.json

Download Timeseries Data

Get the full equity curve and performance timeseries:

tektii scenario download strat_abc123 scen_xyz789 \
  --result-type timeseries \
  --file timeseries.json

Download Trade Log

Get detailed information about every trade:

tektii scenario download strat_abc123 scen_xyz789 \
  --result-type trades \
  --file trades.json

Download Raw Compressed Data

For maximum efficiency, download the original Zstandard-compressed data:

tektii scenario download strat_abc123 scen_xyz789 \
  --result-type timeseries \
  --raw \
  --file timeseries.json.zst

Complete Example

Here's the full workflow from start to finish:

# Step 1: List your strategies
tektii strategy list

# Step 2: List scenarios for a strategy
tektii scenario list strat_abc123

# Step 3: View backtest metadata
tektii scenario download strat_abc123 scen_xyz789

# Step 4: Download full timeseries data
tektii scenario download strat_abc123 scen_xyz789 \
  --result-type timeseries \
  --file results.json

# Step 5: Download trade log
tektii scenario download strat_abc123 scen_xyz789 \
  --result-type trades \
  --file trades.json

Command Reference

Result Types

TypeDescription
metadataSummary metrics (default)
timeseriesEquity curve and performance data
tradesIndividual trade log

Output Flags

FlagDescription
--output {table|json}Display format (default: table)
--file <PATH>Save to file instead of terminal
--rawDownload compressed without decompression
--limit <N>Number of items per page (default: 20)
--cursor <CURSOR>Pagination cursor for next page

Next Steps