Author: jamesPmagic 0x4eF
Original Post Date: 9 Jun 2022
Script to visualise and analyse performance of high-frequency crypto trading bots using Hummingbot
Snapshot proposal (approved):
The tool is available at this link:
This is a python script for studying and visualising the performance of HB bots.
To use the script, provide the following inputs [examples in brackets]:
- Exchange [ascendex / binance / kucoin / gate / ftx / any other exchange supported by ccxt]
- Trading pair [BTC/USDT]
- Start time for the analysis in the format datetime(Year, Month, Day, Hour, Minute, Second) [datetime(2022, 6, 17, 4, 0, 00)]
- Path where trades data is stored for the bot you are analysing (/Users/xxx/hummingbot_data/trades.csv)
- Fees percent (0.2)
The script does the following:
- Calculates a suitable candlestick interval based on the time elapsed between Start Time and Current Time.
- Fetches candlestick data for the Exchange and Trading Pair provided from ccxt (CCXT — ccxt 1.90.35 documentation)
- Fetches trade data for the interval between Start Time and Current Time from the bot’s trades.csv file.
- Makes a plot that shows the high and low of all candles, along with all buy and sell trades.
- Calculates the following data for printing:
- Market change percentage
- Number of buy trades
- Number of sell trades
- Average buy price
- Average sell price
- Average spread
- Fees paid (in quote)
- Trade PNL after fees (in quote)
- Trade volume (in quote)
- Change in base asset
- PNL as percentage of trade volume
Sample run is shown below: