A complete modular analysis tool for prediction market traders. Analyze past trades, calculate PnL, generate charts, and export reports. Supports both novice and professional traders.
- NEW: Graphical User Interface (GUI) - Easy-to-use desktop application
- Load trade history from JSON, CSV, or Excel
- Calculate global and market-specific PnL
- Filter trades by date, type, and PnL thresholds
- Export reports in multiple formats (CSV, Excel, TXT)
- Interactive CLI menu for easy navigation
- Simple, easy-to-understand charts
- Step-by-step interactive menus
- Clear PnL summaries
- One-click analysis
- Advanced interactive charts with Plotly
- Multi-market dashboards
- Detailed trade-by-trade analysis
- Command-line interface for automation
- Customizable filters and exports
π For detailed installation instructions, see INSTALL.md
- Download/clone this repository
- Double-click
install.bat(or run it from command prompt) - Run
python run.py
# 1. Install dependencies
pip install -r requirements.txt
# 2. Run the analyzer
python run.py --helpThe run.py script will automatically check for missing dependencies and guide you if anything is missing!
If you want to install as a package and use prediction-analyzer command anywhere:
pip install -e .After installation, you can use the prediction-analyzer command directly:
prediction-analyzer --file your_trades.jsonThe easiest way to use Prediction Analyzer is through the graphical interface:
# Windows: Just double-click run_gui.bat
# Or run from command line:
python run_gui.pyThe GUI provides:
- Point-and-click file loading
- Visual trade statistics and summaries
- Easy market selection and analysis
- Interactive filters with form controls
- One-click chart generation
- Simple export functionality
Perfect for users who prefer a visual interface over command-line!
# Without installation
python run.py --file your_trades.json
# Or with installation
prediction-analyzer --file your_trades.json# Global PnL summary
python run.py --file trades.json --global
# Analyze specific market with pro chart
python run.py --file trades.json --market "ETH-USD" --chart pro
# Multi-market dashboard
python run.py --file trades.json --dashboard
# Filter and export
python run.py --file trades.json \
--start-date 2024-01-01 \
--end-date 2024-12-31 \
--type Buy \
--export filtered_trades.xlsxNote: Replace python run.py with prediction-analyzer if you installed the package.
# Fetch trades from API (first time)
python run.py --fetch --key "0xYOURPRIVATEKEY"
# After fetching, use local file
python run.py --file limitless_trades.json# Launch the GUI
python run_gui.py
# Then use the interface to:
# 1. Click "Load Trades File" to select your data file
# 2. View the "Global Summary" tab for overall statistics
# 3. Go to "Market Analysis" tab to analyze specific markets
# 4. Use "Filters" tab to refine your data
# 5. Generate charts with one click
# 6. Export data via File menu or quick action buttonspython run.py --file trades.json --market "BTC-USD" --chart simplepython run.py --file trades.json --dashboardpython run.py --file trades.json \
--start-date 2024-06-01 \
--min-pnl 10 \
--export profitable_trades.csvpython run.py --file trades.json --reportYou can also use the package programmatically:
from prediction_analyzer.trade_loader import load_trades
from prediction_analyzer.pnl import calculate_global_pnl_summary
from prediction_analyzer.charts.pro import generate_pro_chart
# Load trades
trades = load_trades("trades.json")
# Calculate PnL
summary = calculate_global_pnl_summary(trades)
print(f"Total PnL: ${summary['total_pnl']:.2f}")
# Generate chart for specific market
from prediction_analyzer.trade_filter import filter_trades_by_market_slug
market_trades = filter_trades_by_market_slug(trades, "ETH-USD")
generate_pro_chart(market_trades, "ETH-USD")--file FILE- Load trades from file (JSON/CSV/XLSX)--fetch- Fetch live trades from API--key KEY- Private key for API authentication
--market MARKET- Analyze specific market--global- Show global PnL summary--chart {simple,pro}- Chart type (default: simple)--dashboard- Generate multi-market dashboard
--start-date DATE- Filter from date (YYYY-MM-DD)--end-date DATE- Filter to date (YYYY-MM-DD)--type {Buy,Sell}- Filter by trade type--min-pnl PNL- Minimum PnL threshold--max-pnl PNL- Maximum PnL threshold
--export FILE- Export filtered trades (.csv or .xlsx)--report- Generate detailed text report
prediction_analyzer/
βββ __init__.py # Package initialization
βββ __main__.py # CLI entry point
βββ config.py # Configuration constants
βββ trade_loader.py # Trade loading (JSON/CSV/XLSX)
βββ trade_filter.py # Trade filtering utilities
βββ filters.py # Advanced filters (date, type, PnL)
βββ pnl.py # PnL calculations
βββ inference.py # Market outcome inference
βββ charts/ # Chart generation modules
β βββ simple.py # Simple charts (matplotlib)
β βββ pro.py # Professional charts (Plotly)
β βββ global_chart.py # Multi-market dashboard
βββ reporting/ # Report generation
β βββ report_text.py # Text reports
β βββ report_data.py # Data exports (CSV/Excel)
βββ utils/ # Utility functions
β βββ auth.py # API authentication
β βββ data.py # Data fetching
β βββ time_utils.py # Time utilities
β βββ math_utils.py # Math utilities
β βββ export.py # Export utilities
βββ core/ # Core modules
βββ interactive.py # Interactive CLI menu
Root directory:
βββ run.py # CLI launcher
βββ run_gui.py # GUI launcher
βββ run_gui.bat # Windows GUI launcher
βββ gui.py # GUI application
βββ requirements.txt # Dependencies
# Run tests
pytest
# Run with coverage
pytest --cov=prediction_analyzerContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
π For complete troubleshooting guide, see INSTALL.md
The run.py script will now detect missing dependencies and show you exactly what's missing!
Quick Fix:
# Windows: Double-click install.bat or run:
install.bat
# All platforms:
pip install -r requirements.txtDon't use python setup.py directly. Instead:
# Windows users - easiest method:
install.bat
# All platforms:
pip install -r requirements.txtDon't run files from inside the prediction_analyzer/ directory. Always use:
# From the project root directory:
python run.py --file your_trades.jsonOn Windows, use forward slashes or escape backslashes in file paths:
# Good
python run.py --file "C:/Users/YourName/trades.json"
# Also good
python run.py --file "C:\\Users\\YourName\\trades.json"If the GUI doesn't launch on Linux, you may need to install tkinter:
# Ubuntu/Debian
sudo apt-get install python3-tk
# Fedora
sudo dnf install python3-tkinter
# Arch Linux
sudo pacman -S tk