This is a simple arbitrage trading bot written in Python. The bot aims to identify arbitrage opportunities in different currency pairs over various exchanges and execute trades to capitalize on the price differentials.
- Data Gathering: The bot fetches real-time price data for different currency pairs like USD/EUR, USD/GBP, etc., from Alpaca's API.
- Storage: The fetched data is stored in a Redis database for quick retrieval.
- Arbitrage Identification: For each currency pair, the bot identifies the exchange with the lowest buying price and the exchange with the highest selling price.
- Profit Calculation: The bot calculates the potential profit from each arbitrage opportunity.
- Trade Execution: If the potential profit is above a predefined threshold, the bot executes the trade.
- Python 3.x
- Redis
- Alpaca account and API keys
- Clone the repository.
git clone https://github.com/yourusername/arbitrage-bot.git
- Install the required packages.
pip install -r requirements.txt
-
Start the Redis server.
redis-server
-
Replace the placeholder Alpaca API keys (
PUB_KEY
,SEC_KEY
) with your actual keys. -
Run the Python script.
python trader_v1.py
Note: Before running the bot with real money, make sure to test extensively and understand the associated risks.