J-Quants API Client
Table of Contents
Overview
The J-Quants API Client is a Rust implementation designed to provide seamless access to various J-Quants API endpoints. It facilitates efficient data retrieval and manipulation through asynchronous processing, ensuring fast and reliable communication.
What is J-Quants?
J-Quants is a financial data platform provided by JPX Market Innovation & Research, Inc. (JPXI).
It offers access to a wide range of financial data through its API, enabling developers, analysts, and investors to integrate and analyze financial information effectively.
To use the J-Quants API, you must register for an account. A Free plan is available, allowing users to access the API without any cost. You can register for an account below.
For an in-depth understanding of the data provided, service usage, and API specifications, please refer to the following resources:
Features
- Asynchronous Processing: Ensures fast and efficient data communication.
- Comprehensive API Support: Access to authentication, data retrieval, and more.
- Pagination Handling: Easily manage paginated data responses.
- Error Handling: Robust error management for reliable operations.
- Plan-Specific, Type-Safe Clients: Provides clients tailored to each subscription plan, allowing for type-safe usage specific to individual plans.
- Automatic ID Token Refresh: Automatically handles the renewal of ID tokens, ensuring uninterrupted API access without manual intervention.
- Secure Authentication Management: Does not store email addresses and passwords in memory; they are immediately discarded after use to ensure security.
Prerequisites
- Rust: Ensure you have Rust installed.
- Tokio: Asynchronous runtime used by the client.
Installation
Ensure Rust is installed on your system. Then, add the jquants-api-client
to your Cargo.toml
:
[]
= "0.1.0"
Supported APIs
The J-Quants API Client currently supports the following APIs:
Authentication
API Endpoint | Description | Status |
---|---|---|
/token/auth_user |
Refresh Token | Implemented |
/token/auth_refresh |
ID Token | Implemented |
Data Retrieval
API Endpoint | Description | Status |
---|---|---|
/listed/info |
Listed Issue Information | Implemented |
/prices/daily_quotes |
Stock Prices (OHLC) | Implemented |
/fins/statements |
Financial Data | Implemented |
/fins/announcement |
Earnings Calendar | Implemented |
/markets/trading_calendar |
Trading Calendar | Implemented |
/markets/trades_spec |
Trading by Type of Investors | Implemented |
/indices/topix |
TOPIX Prices (OHLC) | Implemented |
/indices |
Indices (OHLC) | Implemented |
/option/index_option |
Index Option Prices (OHLC) | Implemented |
/derivatives/futures |
Futures (OHLC) | Implemented |
/derivatives/options |
Options (OHLC) | Implemented |
/markets/weekly_margin_interest |
Margin Trading Outstandings | Implemented |
/markets/short_selling |
Short Sale Value and Ratio by Sector | Implemented |
/markets/breakdown |
Breakdown Trading Data | Implemented |
/prices/prices_am |
Morning Session Stock Prices (OHLC) | Implemented |
/fins/dividend |
Cash Dividend Data | Implemented |
/fins/fs_details |
Financial Statement Data (BS/PL) | Implemented |
Client Usage Example
Below are examples of how to use the J-Quants API client.
Standard Fetch
This example demonstrates a basic fetch operation to retrieve listed issue information.
use ;
use tokio;
async
Pagination
This example demonstrates how to handle paginated responses when retrieving daily stock prices.
use StreamExt;
use ;
use tokio;
async
Additional Examples
For more detailed examples, please refer to the examples directory in the repository.
Note: For security reasons, never commit or expose your refresh tokens or any other sensitive information in your code repositories.
Testing
Run unit tests using the following command:
To run specific tests or see detailed output, you can use:
Contributing
Contributions are welcome! To ensure a smooth process, please follow these guidelines:
- Fork the Repository: Click the "Fork" button at the top of this page to create your own fork.
- Clone Your Fork:
- Create a Branch:
- Make Your Changes: Implement your feature or fix.
- Run Tests: Ensure all tests pass.
- Commit Your Changes:
- Push to Your Fork:
- Create a Pull Request: Go to the original repository and create a pull request from your fork.
Note: Never commit or expose your refresh tokens or any other sensitive information in your code repositories.
Reporting Issues
If you encounter any bugs or have feature suggestions, please open an issue on the Issues page.
Documents
Comprehensive documentation is available here.
For API reference, visit the API Specifications (English), API Specifications (Japanese).
Feedback
We value your feedback! If you have any suggestions or encounter issues, please open an issue or reach out directly.
License
This project is licensed under the MIT License.