Explore more topics
Market-data lake

lake.backtest_strategies dataset schema

Column types and research semantics for NexusTrade’s lake.backtest_strategies dataset. Read the supported schema before submitting a bounded SQL query.

Query name
lake.backtest_strategies
Storage partition
snapshot
Columns
9
Jump to a section

Columns and types

VARCHAR

  • backtest_uuid
  • strategy_uuid
  • action_type
  • action_target_symbol

INTEGER

  • strategy_idx
  • n_comparisons

JSON

  • action_payload
  • condition_tree

VARCHAR[]

  • indicator_types

Current logical schema for lake.backtest_strategies

Inspect the complete lake.backtest_strategies schema

Scroll sideways to compare all columns. Select a heading to sort.

backtest_uuidVARCHAR
strategy_idxINTEGER
strategy_uuidVARCHAR
action_typeVARCHAR
action_target_symbolVARCHAR
action_payloadJSON
condition_treeJSON
n_comparisonsINTEGER
indicator_typesVARCHAR[]

Current logical schema for lake.backtest_strategies

Query lake.backtest_strategies using the column names and types below. The query validator and engine use this logical catalog; a field absent from an older shard returns typed NULL.

What this table contains

Backtest corpus: each run's strategy rules, one row per strategy. Join to `lake.backtest_runs` on `backtest_uuid`; `strategy_idx` orders a run's strategies.

Inspect rules beside their recorded run

Query example, not executed here. The dates and filters define the proposed research scope; returned rows and current coverage must be checked in your workspace.

Read condition_tree and action_payload together, ordered by strategy_idx within the run. percent_change is the recorded run result, not attribution to one rule. The two JSON fields preserve the actual configuration for further inspection.

SQL
WITH eligible_runs AS (
  SELECT *
  FROM lake.backtest_runs
  WHERE author_type <> 'optimizer'
  QUALIFY ROW_NUMBER() OVER (
    PARTITION BY experiment_id
    ORDER BY created_at DESC, backtest_uuid
  ) = 1
)
SELECT r.backtest_uuid, r.start_date, r.end_date, r.percent_change,
       s.strategy_idx, s.action_type, s.action_target_symbol,
       s.condition_tree, s.action_payload
FROM eligible_runs r
JOIN lake.backtest_strategies s ON s.backtest_uuid = r.backtest_uuid
ORDER BY r.created_at DESC, r.backtest_uuid, s.strategy_idx
LIMIT 20;

Submit the backtest_strategies example and read back its parts

Run the exact SQL through the Python SDK

Save this page's SQL as query.sql and the runner below as query.py. Use a registered key with lake scope from Developers. The runner submits the displayed backtest_strategies query once, saves its operation, waits on that same ID, saves the returned manifest and downloads its Parquet parts.

This submission has not been executed for the reference page. Inspect the SQL, dates and resource limits before running it. Reuse the request key only for this identical SQL and limits; use a new key when changing them.

Shell
python3 -m pip install nexustrade==1.42.0
export NEXUSTRADE_API_KEY="YOUR_LAKE_SCOPED_KEY"
python3 query.py

Python
import json
from pathlib import Path
from nexustrade import NexusTradeClient

# Save the SQL displayed on this page as query.sql.
sql = Path("query.sql").read_text()
client = NexusTradeClient.from_environment()
operation = client.create_lake_query(
    {"query": sql, "limits": {"timeoutSeconds": 30, "maxRows": 50,
                              "maxResultBytes": 1048576}},
    idempotency_key="reference-backtest_strategies-20261012-v1",
)
Path("query-operation.json").write_text(json.dumps(operation, indent=2))
finished = client.wait_for_lake_query(operation["id"])
if finished["status"] != "completed":
    raise RuntimeError(finished)
manifest = client.get_lake_query_manifest(operation["id"])["result"]
Path("query-manifest.json").write_text(json.dumps(manifest, indent=2))
print(json.dumps(manifest, indent=2))
for part in manifest["parts"]:
    Path(f"query-{part['part']}.parquet").write_bytes(
        client.download_lake_query_part(operation["id"], part["part"], max_bytes=1048576)
    )

Coverage and timing

Inspect source coverage and timing before using the rows

The logical view is backed by canonical manifest-resolved data. Query this name rather than guessing a physical database collection or object-storage path.

Backtest corpus: each run's strategy rules, one row per strategy. Join to `lake.backtest_runs` on `backtest_uuid`; `strategy_idx` orders a run's strategies.

`condition_tree` and `action_payload` are JSON. Read fields with `json_extract_string(condition_tree, '$.type')`. `indicator_types` is VARCHAR[].

Discussion

Sign in or create a free account to join the discussion.

No comments yet.