Overview
Bothbot.py and consensus.py record all trades to CSV files for analysis. This guide explains the CSV format and how to analyze your trading performance.
CSV Output Files
The bot creates CSV files in thedata/ directory:
| File | Source | Description |
|---|---|---|
data/mock_trades.csv | bot.py | Paper trading results from all strategies |
data/consensus_trades.csv | consensus.py | Real trading results from CONSENSUS strategy |
CSV Format: Paper Trading (bot.py)
Columns
| Column | Type | Description |
|---|---|---|
time | ISO timestamp | When the trade was placed |
strategy | string | Strategy name (PREVIOUS, MOMENTUM, CONSENSUS, etc.) |
previous_ticker | string | Previous market ticker (for context) |
previous_result | string | Previous market result or signal description |
buy_ticker | string | Market ticker that was traded |
buy_side | string | yes or no |
stake_usd | float | Amount staked in USD |
price_usd | float | Price per contract (0.00-1.00) |
contracts | float | Number of contracts purchased |
fee_usd | float | Trading fees (for CONSENSUS strategies) |
gross_profit_usd | float | Profit before fees |
outcome | string | WIN, LOSS, or empty (pending) |
payout_usd | float | Payout received (contracts if won, 0 if lost) |
profit_usd | float | Net profit/loss after fees |
Example Data
CSV Format: Real Trading (consensus.py)
Columns
| Column | Type | Description |
|---|---|---|
time | ISO timestamp | When the trade was placed |
buy_ticker | string | Market ticker that was traded |
buy_side | string | yes or no |
stake_usd | float | Amount staked in USD |
price_usd | float | Price per contract (0.00-1.00) |
contracts | int | Number of contracts purchased |
order_id | string | Kalshi order ID |
prev_signal | string | PREVIOUS strategy signal (yes or no) |
mom_signal | string | MOMENTUM strategy signal (yes or no) |
outcome | string | WIN, LOSS, or empty (pending) |
payout_usd | float | Payout received |
profit_usd | float | Net profit/loss |
Example Data
Using the Analysis Script
The project includesanalyze.py for automated performance analysis.
Running the Analysis
Example Output
Understanding the Metrics
Percentage of trades that were profitable.Formula:
(Wins / Total Trades) × 100Net profit/loss across all trades for the strategy.Formula:
Sum of all profit_usd valuesTotal profit as a percentage of total capital staked.Formula:
(Total Profit / Total Staked) × 100Average profit per trade.Formula:
Total Profit / Total TradesManual Analysis with Python
For custom analysis, load the CSV with pandas:Key Performance Indicators
Strategy Comparison
Compare strategies on these dimensions:Win Rate
Higher is better, but consider sample size. 70%+ is excellent.
ROI
Return on capital. Positive ROI means profitable strategy.
Total Profit
Absolute gains. Strategies with higher volume may have higher total profit.
Risk-Adjusted Returns
Consider volatility and drawdowns, not just returns.
Red Flags
Advanced Analytics
Calculate Sharpe Ratio
Measure risk-adjusted returns:Maximum Drawdown
Find worst peak-to-trough decline:Win/Loss Streaks
Identify longest winning and losing streaks:Exporting Results
To Excel
To JSON
Monitoring Live Performance
Real-time Metrics
While the bot is running, monitor these in real-time:Setting Alerts
Create alerts for important events:Best Practices
Next Steps
Configuration
Optimize your configuration based on analysis
Running the Bot
Run the bot with updated settings