Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Refinitiv CLI Tool

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.

Project Structure

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

Quick Start

Prerequisites

  • Python 3.8+
  • Refinitiv Data Library (lseg.data)
  • Valid Refinitiv API credentials

Installation

pip install lseg.data pandas

Basic Usage

# 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.csv

Documentation

The 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

Features

Core Functionality

  • 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

Data Organization

  • 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

Technical Implementation

  • 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

Technical Stack

  • 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

Usage Examples

Fetch Bond Data

python refinitiv_cli.py bond US10YT=RR --export auto
# Output: data/output/bond_US10YTRR_20260224_162001.csv

Fetch Option Data

python refinitiv_cli.py option AAPLA192405000.U --export auto
# Output: data/output/option_AAPLA192405000.U_20260224_162001.csv

Fetch News Data

python refinitiv_cli.py news "R:AAPL.O AND Language:LEN" --export auto
# Output: data/output/news_RAAPL.O__LanguageLEN_20260224_162001.csv

Configuration

API Authentication

The 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 Options

  • --export auto: Automatic filename generation with timestamp
  • --export path/to/file.csv: Custom export path
  • No export flag: Display results in console only

Project Status

Current Implementation

  • ✅ Core CLI functionality for all instrument types
  • ✅ Automatic data organization and export
  • ✅ Comprehensive documentation
  • ✅ Error handling and session management
  • ✅ Rate limit compliance

Future Enhancements

  • Advanced filtering and screening capabilities
  • Batch processing for multiple instruments
  • Additional export formats (JSON, Excel)
  • Enhanced error recovery and retry logic

Notes

  • 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

Support

For API-related questions, refer to the official Refinitiv documentation:

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages