The ForexSmartBot now supports multiple data providers to ensure reliable forex data access. Here's how to set them up:
- Status: Free, no API key needed
- Limitations: Limited forex data, some pairs may not be available
- Usage: Works out of the box as fallback
- Status: Free tier available (500 calls/day)
- Setup Required: Yes
- Coverage: Excellent forex data coverage
- Go to https://www.alphavantage.co/support/#api-key
- Sign up for a free account
- Get your API key
- Set environment variable:
set ALPHA_VANTAGE_API_KEY=your_api_key_here - Or set in code (see below)
- Status: Free practice account
- Setup Required: Yes
- Coverage: Professional forex data
- Go to https://www.oanda.com/account/tapi/personal_token
- Create a free practice account
- Generate an API token
- Get your account ID
- Set environment variables:
set OANDA_API_KEY=your_token_here set OANDA_ACCOUNT_ID=your_account_id_here
The bot uses a MultiProvider that tries providers in this order:
- Yahoo Finance (if available)
- Alpha Vantage (if API key provided)
- OANDA (if API key provided)
If one provider fails, it automatically tries the next one.
# Windows
set ALPHA_VANTAGE_API_KEY=your_key_here
set OANDA_API_KEY=your_token_here
set OANDA_ACCOUNT_ID=your_account_id_here
# Linux/Mac
export ALPHA_VANTAGE_API_KEY=your_key_here
export OANDA_API_KEY=your_token_here
export OANDA_ACCOUNT_ID=your_account_id_herefrom forexsmartbot.adapters.data import MultiProvider, DataProviderConfig
# Create configuration
config = DataProviderConfig()
config.set_api_key('alpha_vantage', 'your_key_here')
config.set_api_key('oanda', 'your_token_here')
# Use with multi-provider
provider = MultiProvider()Run the bot and check the console output. You should see messages like:
Trying provider 1/3 for GBPJPY
Successfully got data from provider 2 for GBPJPY
- This means all providers failed for that symbol
- Check your API keys are correct
- Verify internet connection
- Some exotic currency pairs may not be available
- Alpha Vantage free tier: 5 calls per minute
- OANDA: 1000 calls per day
- The bot handles rate limits automatically
- Double-check your API keys
- Ensure environment variables are set correctly
- Restart the application after setting environment variables
For best results, set up both Alpha Vantage and OANDA:
- Get Alpha Vantage API key (free)
- Get OANDA practice account (free)
- Set both environment variables
- The bot will use the most reliable source for each symbol
This gives you maximum coverage and reliability for forex data!