This project consists of two main components: a maker bot and a hedge bot for the Chainflip protocol. The maker bot facilitates market making on the Chainflip platform, while the hedge bot manages risk by hedging positions on Hyperliquid.
Disclaimer: Fully examine all code before running it. Before runn
- Python 3.7 or higher
- pip (Python package installer)
- Chainflip LP API running from your server Instructions here if needed
- A Chainflip LP account funded with at least 10 FLIP
- Hyperliquid account with your ETH address, API and API secret key
- Clone the repository:
git clone https://github.com/chainflipgod/Chainflip-Maker-Hedge.git cd Chainflip-Maker-Hedge
- Run the setup script:
./setup.sh
This script will:
- Update your package list
- Install Python3 and venv if not already installed
- Create a virtual environment named
chainflip_env
- Activate the virtual environment
- Upgrade pip
- Install all required packages from
requirements.txt
- After the setup is complete, activate the virtual environment (if not already activated):
source chainflip_env/bin/activate
- Edit
config.yaml
with your specific settings:
- Set your Chainflip and Hyperliquid API endpoints
- Configure your LP address
- Set up your trading pairs and amounts
- Add your Telegram bot token and chat ID for notifications
- Adjust other parameters as needed
Note: Remember to activate the virtual environment every time you want to run the bot or install new packages.
To deactivate the virtual environment when you're done, simply run:
deactivate
To run both the maker and hedge bots simultaneously:
-
Ensure you're in the project directory and your virtual environment is activated
-
Start the bots using the provided script:
python3 start.py
-
The script will launch both the maker and hedge bots. You'll see messages indicating that each bot has started and where their logs are being written.
-
To stop the bots, press Ctrl+C in the terminal where you started
start.py
. The script will handle graceful termination of both bots.
The start.py
script automatically manages log files for both bots:
- Log files are stored in the
logs
directory. - Each run creates new log files with timestamps to prevent overwriting.
- Log files follow this naming convention:
maker_YYYYMMDD_HHMMSS.log
for the maker bothedge_YYYYMMDD_HHMMSS.log
for the hedge bot
To monitor the logs in real-time:
-
Open a new terminal window.
-
For the maker bot logs, use: tail -f logs/maker_.log
Replace <timestamp>
with the actual timestamp of the latest log file.
- In another terminal window, for the hedge bot logs, use:
tail -f logs/hedge_.log
This allows you to monitor both bots' activities simultaneously in separate terminal windows.
To view the entire log file, you can use a text editor or the cat
command:
cat logs/maker_.log
Replace <timestamp>
with the actual timestamp and maker
with hedge
to view the hedge bot logs.
If you encounter any issues:
- Check the log files for error messages. The most recent error messages will be at the bottom of the log files.
- Ensure your
config.yaml
is correctly set up and all required fields are filled. - Verify that you have the latest version of the code and all dependencies are installed.
- Make sure your virtual environment is activated when running the bots.
This market making bot is provided as-is, without any guarantees or warranty. Use it at your own risk. The authors are not responsible for any potential losses incurred while using this bot.
Contributions to improve the bot are welcome. Please submit pull requests or open issues to discuss potential improvements or report bugs.