This project fetches and saves forex data using the ForexConnect API in different timeframes (M1, H1).
- Docker and Docker Compose installed
- ForexConnect API credentials
-
Clone the repository:
git clone [repository_url] cd Forex_API -
Create an environment file: Create a file named
.ENVin theappdirectory with your ForexConnect credentials:FC_USERNAME=your_username FC_PASSWORD=your_password FC_URL=your_api_url
-
Build and run the container using Docker Compose:
docker-compose up --build
-
The application will:
- Connect to the ForexConnect API
- Download USD/JPY data in M1 and H1 timeframes for the past 45 days
- Save the data as CSV files in the
app/FXdirectory
app/Data.py: Main script containing theForexConnectorclass for API interactionapp/FX: Directory where CSV data files are saveddockerfile: Docker configuration for the applicationdocker-compose.yml: Docker Compose configuration for container orchestrationrequirements.txt: List of Python dependencies
The application saves data in CSV format with filenames structured as:
[TICKER]_[TIMEFRAME]_[START_DATE]_to_[END_DATE].csv
Example: USDJPY_H1_20250202_to_20250319.csv
- The application is configured to fetch data for the past 45 days by default
- Data is currently configured to fetch USD/JPY pair in M1 (1-minute) and H1 (1-hour) timeframes
- The Docker setup maps the data directory to a volume so files persist between container runs
To change the ticker or timeframes, modify the variables in the main() function in app/Data.py:
ticker = 'USD/JPY'
timeframes = ['m1','H1']
days_back = 45And re-run the docker.