A command-line interface tool for financial instrument discovery and data extraction using the Refinitiv API. This tool provides a simplified interface for accessing market data, news, and instrument information through a unified command-line experience.
Refinitiv/
├── refinitiv_cli.py # Main CLI tool
├── data/
│ ├── output/ # Exported CSV files (gitignored)
│ └── cache/ # Cached data storage
├── docs/
│ ├── README_API.md # API reference documentation
│ ├── README_CLI.md # CLI usage guide
│ ├── README_PLAN.md # Implementation plan
│ └── LSEG_API_REFERENCE.md # LSEG API specifications
├── scripts/
│ ├── bonds/
│ ├── options/
│ ├── news/
│ ├── fx/
│ └── equities/
├── utilities/
│ ├── export_vibe_recent.py
│ └── pdf_save.py
├── .gitignore
└── README.md
- Python 3.8+
- Refinitiv Data Library (
lseg.data) - Valid Refinitiv API credentials
pip install lseg.data pandas# Display help menu
python refinitiv_cli.py --help
# Fetch bond data with automatic export
python refinitiv_cli.py bond US5YT=RR --export auto
# Fetch news with custom export path
python refinitiv_cli.py news "R:AAPL.O AND Language:LEN" --export data/output/news_data.csvThe project includes comprehensive documentation:
- API Reference:
docs/README_API.md- Detailed API usage examples and patterns - CLI Guide:
docs/README_CLI.md- Complete command reference and usage examples - Implementation Plan:
docs/README_PLAN.md- Project roadmap and architecture - LSEG Reference:
docs/LSEG_API_REFERENCE.md- Official API specifications
- Instrument Data Access: Retrieve pricing and reference data for bonds, options, FX, and equities
- News Retrieval: Search and fetch financial news headlines and stories
- Data Export: Export results to CSV with automatic or custom filename generation
- Session Management: Automatic API session handling with proper cleanup
- Automatic Directory Structure: All exports saved to
data/output/ - Unique Filenames: Timestamp-based naming prevents overwrites
- File Naming Convention:
- Bonds:
bond_{INSTRUMENT}_{TIMESTAMP}.csv - Options:
option_{INSTRUMENT}_{TIMESTAMP}.csv - FX:
fx_{CURRENCY_PAIRS}_{TIMESTAMP}.csv - Equities:
equity_{TICKERS}_{TIMESTAMP}.csv - News:
news_{QUERY_HASH}_{TIMESTAMP}.csv
- Bonds:
- Error Handling: Graceful recovery from API errors with user-friendly messages
- Rate Limit Compliance: Respects Refinitiv API rate limits (5 requests/second)
- Modular Design: Easy to extend with additional instrument types and features
- Core Language: Python 3.8+
- API Library: LSEG Data Library (
lseg.data) - Data Processing: Pandas for data manipulation and export
- CLI Framework: Built-in argparse for command-line interface
python refinitiv_cli.py bond US10YT=RR --export auto
# Output: data/output/bond_US10YTRR_20260224_162001.csvpython refinitiv_cli.py option AAPLA192405000.U --export auto
# Output: data/output/option_AAPLA192405000.U_20260224_162001.csvpython refinitiv_cli.py news "R:AAPL.O AND Language:LEN" --export auto
# Output: data/output/news_RAAPL.O__LanguageLEN_20260224_162001.csvThe tool requires a valid refinitiv-data.config.json file with your API credentials. Ensure this file is present in the working directory or specified path.
--export auto: Automatic filename generation with timestamp--export path/to/file.csv: Custom export path- No export flag: Display results in console only
- ✅ Core CLI functionality for all instrument types
- ✅ Automatic data organization and export
- ✅ Comprehensive documentation
- ✅ Error handling and session management
- ✅ Rate limit compliance
- Advanced filtering and screening capabilities
- Batch processing for multiple instruments
- Additional export formats (JSON, Excel)
- Enhanced error recovery and retry logic
- All data files are excluded from version control via
.gitignore - Utility scripts are available in the
utilities/directory - Instrument-specific scripts are organized in the
scripts/directory - The project follows Python best practices with type hints and docstrings
For API-related questions, refer to the official Refinitiv documentation:
- Refinitiv Developer Portal
- LSEG Data Library Documentation# Refinitiv_Helper