stellar-stats 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stellar_stats-0.8.0/.gitignore +25 -0
- stellar_stats-0.8.0/CLAUDE.md +54 -0
- stellar_stats-0.8.0/PKG-INFO +76 -0
- stellar_stats-0.8.0/README.md +54 -0
- stellar_stats-0.8.0/pyproject.toml +45 -0
- stellar_stats-0.8.0/setup.cfg +4 -0
- stellar_stats-0.8.0/src/stellar_stats/__init__.py +0 -0
- stellar_stats-0.8.0/src/stellar_stats/app.py +646 -0
- stellar_stats-0.8.0/src/stellar_stats/auth.py +35 -0
- stellar_stats-0.8.0/src/stellar_stats/cli.py +94 -0
- stellar_stats-0.8.0/src/stellar_stats/config.py +62 -0
- stellar_stats-0.8.0/src/stellar_stats/data.py +298 -0
- stellar_stats-0.8.0/src/stellar_stats/roundtrip.py +238 -0
- stellar_stats-0.8.0/src/stellar_stats/stats.py +208 -0
- stellar_stats-0.8.0/src/stellar_stats/ui.py +500 -0
- stellar_stats-0.8.0/src/stellar_stats/utils.py +111 -0
- stellar_stats-0.8.0/stellar_stats.egg-info/PKG-INFO +76 -0
- stellar_stats-0.8.0/stellar_stats.egg-info/SOURCES.txt +20 -0
- stellar_stats-0.8.0/stellar_stats.egg-info/dependency_links.txt +1 -0
- stellar_stats-0.8.0/stellar_stats.egg-info/entry_points.txt +2 -0
- stellar_stats-0.8.0/stellar_stats.egg-info/requires.txt +11 -0
- stellar_stats-0.8.0/stellar_stats.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
build/
|
|
2
|
+
dist/
|
|
3
|
+
result.*/
|
|
4
|
+
*.pyc
|
|
5
|
+
*.DS_Store
|
|
6
|
+
.idea/
|
|
7
|
+
.vscode/
|
|
8
|
+
*.bak
|
|
9
|
+
*.orig
|
|
10
|
+
*.egg-info/
|
|
11
|
+
*.ipynb
|
|
12
|
+
.ipynb_checkpoints/
|
|
13
|
+
.cache/
|
|
14
|
+
*.log
|
|
15
|
+
*.csv
|
|
16
|
+
*.html
|
|
17
|
+
*.png
|
|
18
|
+
*.old
|
|
19
|
+
*.json
|
|
20
|
+
*.xlsx
|
|
21
|
+
*.prof
|
|
22
|
+
*.tmp
|
|
23
|
+
*.pickle
|
|
24
|
+
.pdm-python
|
|
25
|
+
.python-version
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### Development
|
|
8
|
+
- `stellar-stats run` - Run the Streamlit dashboard application
|
|
9
|
+
- `stellar-stats gen-investors <account_name> --investor-name <name>` - Generate investors.csv from cashflow data
|
|
10
|
+
- `pip install -e .` - Install package in development mode
|
|
11
|
+
- `pip install -e .[dev]` - Install with development dependencies
|
|
12
|
+
- `pip install -e .[test]` - Install with test dependencies
|
|
13
|
+
|
|
14
|
+
### Package Management
|
|
15
|
+
This project uses pip with pyproject.toml configuration. No package.json or specific test commands are defined.
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
This is a Streamlit-based trading statistics dashboard that analyzes backtest and live trading performance.
|
|
20
|
+
|
|
21
|
+
### Core Components
|
|
22
|
+
- **app.py** - Main Streamlit application with dashboard UI and data visualization
|
|
23
|
+
- **cli.py** - Command-line interface using Click, wraps Streamlit execution
|
|
24
|
+
- **data.py** - Data loading functions for returns, trades, round trips, slippage, and benchmarks
|
|
25
|
+
- **config.py** - Configuration management via TOML files, API setup (Tushare, yfinance)
|
|
26
|
+
- **ui.py** - UI components and plotting functions for performance visualization
|
|
27
|
+
- **auth.py** - Authentication setup for the dashboard
|
|
28
|
+
- **utils.py** - Utility functions including cache management
|
|
29
|
+
- **stats.py** - Statistical analysis functions and performance metrics calculations
|
|
30
|
+
- **roundtrip.py** - Round-trip analysis and trade extraction functions
|
|
31
|
+
|
|
32
|
+
### Data Sources
|
|
33
|
+
- Local CSV/HDF/Parquet files containing returns, trades, round trips, slippage data
|
|
34
|
+
- Remote data via yfinance for benchmark symbols
|
|
35
|
+
- Tushare API for Chinese market indices (requires token in config.toml)
|
|
36
|
+
- Optional investors.csv for investor-specific performance tracking
|
|
37
|
+
|
|
38
|
+
### Key Features
|
|
39
|
+
- Multi-account performance analysis and comparison
|
|
40
|
+
- Benchmark comparison with leverage options
|
|
41
|
+
- Period selection (YTD, inception, custom ranges)
|
|
42
|
+
- Performance metrics, drawdown analysis, return distributions
|
|
43
|
+
- Trade analysis including underlying breakdowns and slippage tracking
|
|
44
|
+
- Round-trip trade analysis and extraction capabilities
|
|
45
|
+
- Investor-specific return calculations when investors.csv exists
|
|
46
|
+
- Automated investor data generation from cashflow data
|
|
47
|
+
|
|
48
|
+
### Configuration
|
|
49
|
+
- Optional config.toml file defines accounts and data directories
|
|
50
|
+
- Falls back to auto-discovery of directories for account data
|
|
51
|
+
- Supports custom benchmark symbols and API tokens
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
Uses specialized financial libraries: empyrical-reloaded for performance metrics, with local implementations for trade analysis functions. Additional dependencies include streamlit, plotly, click, yfinance, tushare, tomlkit, tabulate, numpy, pandas, extra-streamlit-components, st-annotated-text, and watchdog for enhanced functionality.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stellar-stats
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: Stats page for backtest/live trading
|
|
5
|
+
Author-email: Keli Hu <dev@keli.hu>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/keli/stellar-stats
|
|
8
|
+
Keywords: trade stats
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: click
|
|
12
|
+
Requires-Dist: tabulate
|
|
13
|
+
Requires-Dist: empyrical-reloaded
|
|
14
|
+
Requires-Dist: extra-streamlit-components
|
|
15
|
+
Requires-Dist: plotly
|
|
16
|
+
Requires-Dist: st-annotated-text
|
|
17
|
+
Requires-Dist: streamlit>=1.39.0
|
|
18
|
+
Requires-Dist: tomlkit
|
|
19
|
+
Requires-Dist: tushare
|
|
20
|
+
Requires-Dist: watchdog
|
|
21
|
+
Requires-Dist: yfinance>=0.2.51
|
|
22
|
+
|
|
23
|
+
# Stellar Stats
|
|
24
|
+
|
|
25
|
+
A Streamlit-based trading statistics dashboard that analyzes backtest and live trading performance with comprehensive metrics and visualizations.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Multi-account performance analysis** - Compare performance across different trading accounts
|
|
30
|
+
- **Benchmark comparison** - Compare against market indices with leverage options
|
|
31
|
+
- **Flexible time periods** - YTD, inception-to-date, or custom date ranges
|
|
32
|
+
- **Comprehensive metrics** - Performance metrics, drawdown analysis, return distributions
|
|
33
|
+
- **Trade analysis** - Detailed breakdowns by underlying assets and slippage tracking
|
|
34
|
+
- **Round-trip analysis** - Extract and analyze complete trading round-trips
|
|
35
|
+
- **Investor tracking** - Calculate investor-specific returns
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install stellar-stats
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Run the Dashboard
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
stellar-stats run
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This launches the Streamlit web interface for interactive analysis.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
Create an optional `config.toml` file to define:
|
|
58
|
+
|
|
59
|
+
- Account configurations and data directories
|
|
60
|
+
- Custom benchmark symbols
|
|
61
|
+
- API tokens (Tushare for Chinese market data)
|
|
62
|
+
|
|
63
|
+
The system will auto-discover account directories if no configuration is provided, which is useful for viewing backtesting results.
|
|
64
|
+
|
|
65
|
+
## Data Sources
|
|
66
|
+
|
|
67
|
+
- **Local files**: CSV/HDF/Parquet files containing returns, trades, round trips, and slippage data
|
|
68
|
+
- **Market data**: yfinance for global benchmark symbols
|
|
69
|
+
- **Chinese markets**: Tushare API (requires token configuration)
|
|
70
|
+
- **Investor data**: Optional investors.csv for investor-specific analysis
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
|
76
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Stellar Stats
|
|
2
|
+
|
|
3
|
+
A Streamlit-based trading statistics dashboard that analyzes backtest and live trading performance with comprehensive metrics and visualizations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multi-account performance analysis** - Compare performance across different trading accounts
|
|
8
|
+
- **Benchmark comparison** - Compare against market indices with leverage options
|
|
9
|
+
- **Flexible time periods** - YTD, inception-to-date, or custom date ranges
|
|
10
|
+
- **Comprehensive metrics** - Performance metrics, drawdown analysis, return distributions
|
|
11
|
+
- **Trade analysis** - Detailed breakdowns by underlying assets and slippage tracking
|
|
12
|
+
- **Round-trip analysis** - Extract and analyze complete trading round-trips
|
|
13
|
+
- **Investor tracking** - Calculate investor-specific returns
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install stellar-stats
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Run the Dashboard
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
stellar-stats run
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This launches the Streamlit web interface for interactive analysis.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
Create an optional `config.toml` file to define:
|
|
36
|
+
|
|
37
|
+
- Account configurations and data directories
|
|
38
|
+
- Custom benchmark symbols
|
|
39
|
+
- API tokens (Tushare for Chinese market data)
|
|
40
|
+
|
|
41
|
+
The system will auto-discover account directories if no configuration is provided, which is useful for viewing backtesting results.
|
|
42
|
+
|
|
43
|
+
## Data Sources
|
|
44
|
+
|
|
45
|
+
- **Local files**: CSV/HDF/Parquet files containing returns, trades, round trips, and slippage data
|
|
46
|
+
- **Market data**: yfinance for global benchmark symbols
|
|
47
|
+
- **Chinese markets**: Tushare API (requires token configuration)
|
|
48
|
+
- **Investor data**: Optional investors.csv for investor-specific analysis
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
|
54
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
dependencies = [
|
|
7
|
+
"click",
|
|
8
|
+
"tabulate",
|
|
9
|
+
"empyrical-reloaded",
|
|
10
|
+
"extra-streamlit-components",
|
|
11
|
+
"plotly",
|
|
12
|
+
"st-annotated-text",
|
|
13
|
+
"streamlit>=1.39.0",
|
|
14
|
+
"tomlkit",
|
|
15
|
+
"tushare",
|
|
16
|
+
"watchdog",
|
|
17
|
+
"yfinance>=0.2.51",
|
|
18
|
+
]
|
|
19
|
+
name = "stellar-stats"
|
|
20
|
+
dynamic = ["version"]
|
|
21
|
+
description = "Stats page for backtest/live trading"
|
|
22
|
+
authors = [
|
|
23
|
+
{name = "Keli Hu", email = "dev@keli.hu"},
|
|
24
|
+
]
|
|
25
|
+
requires-python = ">=3.9"
|
|
26
|
+
readme = "README.md"
|
|
27
|
+
license = {text = "MIT"}
|
|
28
|
+
keywords = ["trade stats"]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/keli/stellar-stats"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
stellar-stats = "stellar_stats.cli:main"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools]
|
|
37
|
+
packages = ["stellar_stats"]
|
|
38
|
+
package-dir = { "stellar_stats" = "src/stellar_stats" }
|
|
39
|
+
|
|
40
|
+
[tool.setuptools_scm]
|
|
41
|
+
local_scheme = 'no-local-version'
|
|
42
|
+
version_scheme = "post-release"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.dynamic]
|
|
45
|
+
version = { attr = "setuptools_scm.get_version" }
|
|
File without changes
|