A scraper for economic calendars (ForexFactory, CryptoCraft, EnergyExch, MetalsMine).
Project description
🎛️ • FOREX PYTORY
Advanced, Modular, and MCP-Ready Economic Events Scraper Library
Forex-Pytory is an open-source Python package that provides a robust and elegant way to scrape core economic data, news releases, and calendar events from major financial markets. Designed for modern Python ecosystems, it offers seamless integration for automated trading bots, data analysis pipelines, and even AI agents.
✨ Key Features & Capabilities
-
🌐 Unified Multi-Source Engine: Stop writing different scrapers for different sites! This package natively supports ForexFactory (Forex), CryptoCraft (Crypto), EnergyExch (Energy), and MetalsMine (Precious Metals) through a single, consistent API. You get the exact same data structure regardless of which market you are querying.
-
🛡️ Strict Type Safety with Pydantic v2: No more dealing with messy, unpredictable dictionaries. Every single event scraped from the web is parsed, validated, and cast into an
EconomicEventPydantic model. This guarantees type safety, automatic data casting, and clean IDE autocompletion for fields likeimpact,forecast,actual, andtime. -
💻 Powerful CLI (Command Line Interface): Need a quick market overview without writing code? The built-in CLI tool powered by
Richlets you pull and visualize data directly in your terminal. You can instantly view events in beautifully color-coded tables (where colors indicate market impact) or export them as raw JSON for external ingestion. -
🤖 MCP (Model Context Protocol) Ready: Welcome to the future of AI tooling. This package ships with an official MCP Server integration. This means AI Agents (like Claude 3.5 Sonnet) can securely connect to this library and invoke it as a local tool to answer your complex financial questions, summarize the daily calendar, or analyze upcoming high-impact events autonomously.
🚀 Installation
After setting up your virtual environment, you can install the project directly from the source. It is highly recommended to install with optional dependencies to unlock the CLI and MCP features:
git clone https://github.com/your-username/forex-pytory.git
cd forex-pytory
pip install -e .[mcp,cli]
(Note: Core dependencies such as pandas, beautifulsoup4, cloudscraper, pydantic, mcp, and rich will be installed automatically.)
🛠️ Usage Scenarios & Code Examples
You can use the package in 3 different ways: as a Python library, as a standalone CLI tool, or as an MCP Server connected to AI assistants.
1. Library Usage (Python API)
Import the package into your own scripts or Jupyter Notebooks to power your financial applications:
from datetime import datetime
from src.forex_pytory.core.scraper import forex_factory_scraper
# 1. Generate the target URL for today
dt = datetime.now()
url = forex_factory_scraper.get_url(day=dt.day, month=dt.month, year=dt.year, timeline="day")
# 2. Fetch and parse data (Returns a list of strictly typed Pydantic 'EconomicEvent' objects)
records = forex_factory_scraper.get_records(url)
# 3. Access attributes safely
for event in records[:3]:
print(f"[{event.time}] {event.currency} - {event.event} (Impact: {event.impact})")
2. Command Line Interface (CLI) Usage
Upon installation, the global forex-scraper command becomes available in your terminal.
A. Modern Table View:
Use the --format table flag for a dynamic, color-coded terminal table. High-impact events are bold red, medium are yellow, etc.
forex-scraper --source forex --format table
B. JSON Format Output:
Perfect for piping into jq or integrating with other shell scripts, use --format json (which is the default behavior).
forex-scraper --source crypto --format json
3. MCP Server (Agent Integration) Usage
Connect this tool directly to your AI Assistant! By hooking the scraper up to Claude via the Model Context Protocol, Claude can fetch live calendar data to assist your analysis.
Add the following block to your claude_desktop_config.json:
{
"mcpServers": {
"forex-pytory": {
"command": "/path/to/your/.venv/bin/python",
"args": [
"-m",
"forex_pytory.mcp.server"
]
}
}
}
Restart your Claude Desktop app, and you can simply ask: "Check ForexFactory for any major Euro news today!"
⚖️ Legal and License
This project is open-sourced under the Apache License 2.0. See the LICENSE file for more details.
🚨 IMPORTANT: Please read the DISCLAIMER.md before using this software. The data provided by this tool does not constitute investment advice, and the end-user assumes all legal responsibility and risk arising from its use.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forex_pytory-0.1.0.tar.gz.
File metadata
- Download URL: forex_pytory-0.1.0.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30505192a4bc256a06a256fd216294346c10c61f923cf4cc960669ab200f13db
|
|
| MD5 |
5cdb8d4633a8429c384f97d9bcc79d55
|
|
| BLAKE2b-256 |
dbf6770297c8d2d4dbcb707c592b4bd13aa472eeecd3a6a987ca83a7e09b2f05
|
Provenance
The following attestation bundles were made for forex_pytory-0.1.0.tar.gz:
Publisher:
release.yml on AtaCanYmc/forex-pytory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forex_pytory-0.1.0.tar.gz -
Subject digest:
30505192a4bc256a06a256fd216294346c10c61f923cf4cc960669ab200f13db - Sigstore transparency entry: 1841143324
- Sigstore integration time:
-
Permalink:
AtaCanYmc/forex-pytory@8f6985d011b8a9da8bcd7998534db01206655626 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/AtaCanYmc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8f6985d011b8a9da8bcd7998534db01206655626 -
Trigger Event:
push
-
Statement type:
File details
Details for the file forex_pytory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: forex_pytory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ffd18dc6781fe0e9409568e2494062bc71dc4c2e63ae365ec7490ef9c354d1e
|
|
| MD5 |
b088b88715f004e3e03d581e57ad99a5
|
|
| BLAKE2b-256 |
23ed01045d332dc96462200492ed29926df75791a12b2b5b42cf42f78799fcf0
|
Provenance
The following attestation bundles were made for forex_pytory-0.1.0-py3-none-any.whl:
Publisher:
release.yml on AtaCanYmc/forex-pytory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forex_pytory-0.1.0-py3-none-any.whl -
Subject digest:
4ffd18dc6781fe0e9409568e2494062bc71dc4c2e63ae365ec7490ef9c354d1e - Sigstore transparency entry: 1841143369
- Sigstore integration time:
-
Permalink:
AtaCanYmc/forex-pytory@8f6985d011b8a9da8bcd7998534db01206655626 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/AtaCanYmc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8f6985d011b8a9da8bcd7998534db01206655626 -
Trigger Event:
push
-
Statement type: