Skip to main content

Overview

run_trading_job is the final step of the core pipeline. It triggers the trading-worker pipeline job, which runs a VectorBT backtesting simulation using the optimized portfolio weights and returns performance metrics. The tool blocks until the job completes and returns the output blob URL.

Parameters

input_url
string
required
Blob storage URL pointing to a portfolio_optimization_*.json file.This is the output_url returned by run_po_job.
config
object
required
Trading and backtesting configuration.

Returns

{
  "status": "Succeeded",
  "output_url": "https://stmcpfabricdev.blob.core.windows.net/data/trading_report_20260307_130504.json",
  "output_name": "trading_report_20260307_130504.json",
  "execution_name": "trading-worker-abc123xyz"
}
FieldDescription
statusJob terminal status (Succeeded)
output_urlFull HTTPS URL to the backtest results blob
output_nameBlob filename
execution_nameJob execution ID for audit/debugging
The trading_report_*.json blob contains VectorBT performance metrics: total return, Sharpe ratio, max drawdown, win rate, and per-ticker statistics.

Example — Standard VectorBT

{
  "input_url": "https://stmcpfabricdev.blob.core.windows.net/data/portfolio_optimization_20260307_130215.json",
  "config": {
    "Trading params": {
      "Backtest method": "VectorBT",
      "initial_capital$": 1000000,
      "frequency": "D",
      "trade_comission": 0.0003,
      "slippage_bps": 3,
      "risk_free_rate": 0.02
    },
    "Backtest params": {
      "Learning_start": "2020-01-01",
      "Learning_end": "2024-01-01",
      "Testing_end": "2026-03-01"
    }
  }
}

Example — VectorBT Advanced

{
  "input_url": "...",
  "config": {
    "Trading params": {
      "Backtest method": "VectorBT_Advanced",
      "initial_capital$": 500000,
      "frequency": "D",
      "trade_comission": 0.001,
      "slippage_bps": 5,
      "risk_free_rate": 0.04,
      "VectorBT params": {
        "size_type": "TargetPercent",
        "cash_sharing": true,
        "group_by": true,
        "benchmark_ticker": "SPY"
      }
    },
    "Backtest params": {
      "Learning_end": "2024-01-01",
      "Testing_end": "2026-03-01"
    }
  }
}

Resources

ResourceValue
Container Apps Jobtrading-worker
Container nametrading-worker
Env vars injectedINPUT_URL, CONFIG
Output blob prefixtrading_report_
Timeout600 seconds

Next Steps

This is the last step of the core pipeline. Download the blob from output_url to inspect the results. The trading_report_*.json file contains VectorBT performance metrics: total return, Sharpe ratio, max drawdown, win rate, and per-ticker statistics. You can also run optional post-processing tools from portfolio_optimization_*.json: