Documentation Index
Fetch the complete documentation index at: https://mintlify.com/hummingbot/hummingbot/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Thehistory command displays past trades and calculates performance metrics including profit/loss, returns, and trading statistics. It provides detailed analytics on your bot’s trading performance.
Basic Usage
View History for Current Session
Command Options
Filter by Time Period
Number of days of history to display (supports decimals)
Verbose Mode (Show Trade List)
Verbose mode shows up to the most recent 100 trades by default (configurable via
MAXIMUM_TRADE_FILLS_DISPLAY_OUTPUT).Set Display Precision
Number of decimal places to display for numeric values
Combining Options
Performance Metrics Explained
Trading Statistics
Total count of completed trades (split by buy/sell/total)
Sum of all trade amounts in base and quote currency
Volume-weighted average price of trades
Asset Changes
Asset balance when the strategy started
Current asset balance
Difference between current and start balances
Percentage of portfolio value held in base asset
Performance Calculations
What your portfolio would be worth if you hadn’t traded (holding initial assets at current prices)
Actual current value of your portfolio at current prices
Profit/loss from trading activity (current value - hold value)
Total trading fees paid (broken down by token)
Net profit/loss after deducting fees
Total P&L as a percentage of initial portfolio value
Multi-Market Strategies
For strategies trading multiple markets or pairs:Smart Rounding
The history command uses intelligent rounding:- Large values: Rounded to whole numbers (e.g., 50000)
- Medium values: 2-4 decimal places (e.g., 0.1234)
- Small values: More decimals as needed (e.g., 0.00001234)
- Percentages: Always 2 decimal places (e.g., 0.50%)
--precision flag for consistent decimals.
Implementation Details
The history command is implemented in/hummingbot/client/command/history_command.py:29 and provides:
- Database-backed trade storage: Trades stored in SQLite
- Performance calculation engine: Calculates P&L, returns, fees
- Multi-market support: Aggregates data across exchanges and pairs
- Rate oracle integration: Converts assets for portfolio valuation
- Async balance fetching: Gets current balances for accurate calculations
Use Cases
Daily Performance Review
Check today’s performance:Weekly Analysis
Review the past week:Detailed Trade Audit
Examine all trades with full precision:Quick P&L Check
Just see the summary:Exporting History
While the CLI shows formatted output, you can access raw data:Understanding Returns
Return % Calculation
- Initial portfolio: 100,000 USDT
- Total P&L: 500 USDT
- Return %: (500 / 100,000) × 100 = 0.50%
Hold vs Trade Value
Hold Value:- What you’d have if you didn’t trade
- Calculated using initial balances at current prices
- Actual current portfolio value
- Reflects all trading activity
- Difference between current and hold
- Shows if trading added value vs. holding
Troubleshooting
”No past trades to report”
If you see this message:- Ensure a strategy has been imported/created
- Verify trades have been executed
- Check the time period (try removing
--daysfilter) - Confirm the strategy file matches
Network Errors
If balance fetching fails:- Check internet connection
- Verify exchange is online
- Increase timeout:
Inaccurate Returns
If returns seem incorrect:- Check initial balances: Ensure the bot started with correct balances
- Account for manual trades: Trades made outside the bot aren’t tracked
- Verify fees: Ensure exchange fee tiers are correct
- Oracle rates: Confirm rate oracle is providing accurate conversions
Missing Trades
If some trades don’t appear:- Verify the trades were filled (check exchange)
- Ensure the strategy file name matches
- Check if trades are outside the time filter
- Confirm database isn’t corrupted