A high-frequency algorithmic trading bot for Coincheck, a major Japanese cryptocurrency exchange. Built with Rust, this project leverages asynchronous programming and WebSockets to handle real-time data for efficient trading operations.
- Real-Time Data Handling: Connects to Coincheck's WebSocket API to receive live order book and trade updates.
- Automated Trading: Automatically places buy and sell orders based on the best bid and ask prices.
- Order Management: Manages active orders, updates balances, and handles order executions.
- Graceful Shutdown: Listens for termination signals to cancel active orders and safely exit.
- Configurable Parameters: Easily adjust trading parameters such as order size and price increments.
git clone https://github.com/yourusername/coincheck-rust.git
cd coincheck-rust
Create a .env
file in the root directory and add your Coincheck API credentials:
API_KEY=your_coincheck_api_key
SECRET_KEY=your_coincheck_secret_key
You can run the application using Cargo:
RUST_LOG=debug,rustls=off,reqwest=off cargo run
The trading parameters can be configured in the Config
struct found in src/config.rs
. The default parameters are set as follows:
- Symbol:
btc_jpy
- Size:
0.02
- Max Size:
1.0
- Price Increment:
0.00000001
Modify these values as needed to suit your trading strategy.
Once the application is running, it will:
- Connect to Coincheck's WebSocket API.
- Subscribe to the order book and trade channels for the specified symbol.
- Continuously monitor market data to place and manage buy/sell orders.
- Handle order executions and update balances accordingly.
- Listen for termination signals (e.g., SIGINT, SIGTERM) to cancel active orders and exit gracefully.
The application uses the env_logger
crate for logging. The log level can be adjusted via the RUST_LOG
environment variable. For example:
RUST_LOG=info cargo run
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes with clear messages.
- Submit a pull request detailing your changes.
This project is licensed under the MIT License.
- Tokio for asynchronous runtime.
- Reqwest for HTTP requests.
- Serde for serialization/deserialization.
- Coincheck for providing the API.