A newer version of the Gradio SDK is available: 6.10.0
metadata
title: Quant Connect JSON Analysis
emoji: π
colorFrom: red
colorTo: pink
sdk: gradio
sdk_version: 5.27.0
app_file: app.py
pinned: false
Trading Platform Report Enhancer
Description
This application provides an enhanced interface for analyzing backtest results exported from trading platforms like QuantConnect. Upload one or more backtest JSON files to visualize key performance metrics, compare strategies, analyze trades, and assess risk through various charts and tables.
Features
- Multi-File Upload: Analyze multiple backtest reports simultaneously.
- Strategy Comparison: Easily switch between different strategy reports using a dropdown menu.
- Comprehensive Overview: View key performance statistics extracted directly from the report.
- Performance Visualization:
- Equity Curve
- Drawdown Curve
- Normalized Equity vs. Benchmark Comparison
- Trade Analysis:
- Profit/Loss Distribution Histogram
- Trade Duration Distribution Histogram (in days)
- Table of Closed Trades (sample)
- Additional Charts:
- Asset Exposure Over Time
- Portfolio Turnover Over Time
- In-Depth Risk Analysis:
- Monthly Returns Heatmap
- Monthly Performance Statistics (Min, Max, Mean, Positive/Negative Months)
- Annualized Rolling Volatility Plot (3M, 6M, 12M windows)
- Rolling Volatility Statistics Table
- Top Drawdown Periods Table
- Correlation Analysis:
- Correlation Heatmap of daily returns between strategies (and benchmark, if available).
- Correlation Matrix Table.
How to Use
- Upload Files: Click the "Upload QuantConnect JSON File(s)" button or drag and drop your
.jsonbacktest report files onto the area. - Processing: The application will process the files. The status will be updated in the "Processing Status" box.
- Select Strategy: Once processing is complete, a dropdown menu labeled "Select Strategy to View" will appear. Choose the strategy report you want to inspect.
- Navigate Tabs: Explore the different aspects of the selected strategy's performance and risk using the tabs:
- π Overview: Key summary statistics.
- π Performance Charts: Equity, Drawdown, and Benchmark plots.
- πΉ Trade Analysis: P/L, Duration histograms, and sample trades table.
- βοΈ Other Charts: Exposure and Turnover plots.
- π Risk Analysis: Detailed monthly performance, rolling volatility, and drawdown analysis.
- π€ Correlation: Heatmap and matrix comparing all uploaded strategies (and benchmark).
Deployment (Hugging Face Spaces)
This application is structured for easy deployment on Hugging Face Spaces:
- Create a Space: Go to Hugging Face Spaces and create a new Space.
- Select SDK: Choose "Gradio" as the Space SDK.
- Upload Files: Upload the following files to the root of your Space repository:
app.py(Main application script)utils.py(Helper functions)processing.py(File processing logic)risk_analysis.py(Risk calculation logic)plotting.py(Plot generation logic)requirements.txt(Python dependencies)README.md(This file)
- Launch: Hugging Face will automatically install the dependencies from
requirements.txtand runapp.py. Your application should become available shortly.
Dependencies
The required Python packages are listed in requirements.txt:
gradio
pandas
plotly
numpy
Install them using pip:pip install -r requirements.txtPotential ImprovementsAdd more sophisticated risk metrics (e.g., Sharpe Ratio, Sortino Ratio, VaR, CVaR).Implement interactive elements on charts (e.g., zooming, selecting time ranges).Allow customization of rolling window periods.Add support for other backtesting platform report formats.Improve handling of different 'symbol' formats in trade data.Add