A Rust client library for the QuickFS API, providing programmatic access to financial statement data, key ratios, and company metadata for U.S., Canadian, and Australian stocks.
- Full API Coverage: Access to all QuickFS endpoints including datapoints, companies, metrics, and usage history
- Async Support: Built with
tokio
andreqwest
for high-performance async operations - Type Safety: Strongly typed responses with
serde
serialization - Authentication: Support for both API key query parameters and header-based authentication
- Error Handling: Comprehensive error types for different API failure scenarios
Add this to your Cargo.toml
:
[dependencies]
quickfs-api-rs = "1.0.0"
Or install from local path:
[dependencies]
openapi = { path = "./openapi" }
use openapi::apis::{configuration::Configuration, datapoints_api};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Configure the client with your API key
let mut config = Configuration::new();
config.api_key = Some(openapi::apis::configuration::ApiKey {
prefix: None,
key: std::env::var("QUICKFS_API_KEY")
.expect("QUICKFS_API_KEY environment variable must be set"),
});
// Fetch revenue data for Apple
let symbol = "AAPL";
let metric = "revenue";
match datapoints_api::data_symbol_metric_get(
&config,
symbol,
metric,
Some("FY"), // Annual data
).await {
Ok(data) => println!("Revenue data for {}: {:?}", symbol, data),
Err(e) => eprintln!("Error fetching data: {:?}", e),
}
Ok(())
}
Get your API key from your QuickFS account page.
export QUICKFS_API_KEY="your_api_key_here"
config.api_key = Some(openapi::apis::configuration::ApiKey {
prefix: None,
key: "your_api_key_here".to_string(),
});
The client handles various QuickFS API errors:
InvalidPeriodError
(400): Invalid time period specifiedUnsupportedMetricError
(404): Requested metric not supportedUnsupportedCompanyError
(404): Company not in QuickFS databaseBatchLimitExceededError
(413): Too many items in batch requestInsufficientQuotaError
(429): Daily quota exceeded
QuickFS Premium subscribers have a daily quota of 25,000 data requests. Each distinct metric returned counts as one request against your quota.
Subscription | Daily Quota |
---|---|
Free | No longer supported |
Premium | 25,000 requests |
Each distinct metric (e.g., Revenue) returned from a request counts as one data call. For example:
GET /v1/data/IBM/revenue?period=FY-9:FY
This request returns 10 years of annual revenue data but only counts as 1 request because it's a single metric.
Only paths containing /v1/data
or /v1/companies/updated/
count against your quota.
Use the Usage History API to monitor your quota consumption:
use openapi::apis::usage_history_api;
let usage = usage_history_api::usage_get(&config).await?;
println!("Current usage: {:?}", usage);
See the examples/
directory for more usage examples:
basic_usage.rs
- Simple data retrievalbatch_request.rs
- Batch data requests
Run examples with:
QUICKFS_API_KEY=your_key cargo run --example basic_usage
This client provides access to all QuickFS API endpoints:
companies_country_exchange_get
- List supported companies by country/exchangecompanies_updated_date_country_get
- List recently updated companies
data_symbol_metric_get
- Get financial data for specific metricsdata_all_data_symbol_get
- Get full datasets for a companydata_batch_post
- Batch requests for multiple datapoints
metrics_get
- List all available financial metrics
usage_get
- Check your current API quota usage
For detailed API endpoint documentation, see the docs/
directory.
To generate and view the crate documentation:
cargo doc --open
- For this Rust client: Open an issue
- QuickFS support: https://quickfs.net/support
- For QuickFS API questions: api@quickfs.net
This project is licensed under the MIT license.