The Market Data API Client is a Rust-based application that interacts with the Financial Modeling Prep (FMP) API to retrieve various financial data, including stock quotes, market indices, commodities, cryptocurrencies, and more. This project is designed to provide a simple and efficient way to access financial data programmatically.
- Retrieve stock quotes and historical data
- Access market indices and their quotes
- Get information on commodities and cryptocurrencies
- Fetch financial statements and metrics for companies
- Support for asynchronous operations using Tokio
- Rust (version 1.30 or higher)
- Cargo (Rust package manager)
- An API key from Financial Modeling Prep (FMP)
-
Clone the repository:
git clone https://github.com/yourusername/market_data.git cd market_data
-
Create a
.env
file in the root directory and add your FMP API key:
FMP_API_KEY=your_api_key_here
- Build the project:
cargo build
- Run the application:
cargo run
The application provides various modules to interact with different aspects of the FMP API. Here are some examples of how to use the client:
//@main.rs
mod market;
use crate::market::Market;
pub async fn example() -> Result<(), reqwest::Error> {
// Get most active stocks
let active = Market::most_active().await?;
println!("ACTIVES: {:?}", active);
#[tokio::main]
async fn main() {
example().await;
}
- auth: Handles API key retrieval from environment variables.
- market: Provides functions to access market data.
- financial: Contains methods for fetching financial statements.
- crypto: Interacts with cryptocurrency data.
- forex: Accesses foreign exchange rate data.
- commodity: Retrieves commodity-related information.
- etf: Provides access to ETF data.
- mutualfund: Interacts with mutual fund data.
- index: Accesses market index data.
- search: Allows searching for financial instruments.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
- Financial Modeling Prep for providing the API.
- Tokio for asynchronous programming in Rust.
- FMP Node Wrapper project which we converted into full Rust.