Skip to content

aktagon/quickfs-api-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuickFS API Rust Client

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.

Crates.io Documentation

Features

  • Full API Coverage: Access to all QuickFS endpoints including datapoints, companies, metrics, and usage history
  • Async Support: Built with tokio and reqwest 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

Installation

Add this to your Cargo.toml:

[dependencies]
quickfs-api-rs = "1.0.0"

Or install from local path:

[dependencies]
openapi = { path = "./openapi" }

Quick Start

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(())
}

Authentication

Get your API key from your QuickFS account page.

Environment Variable (Recommended)

export QUICKFS_API_KEY="your_api_key_here"

Direct Configuration

config.api_key = Some(openapi::apis::configuration::ApiKey {
    prefix: None,
    key: "your_api_key_here".to_string(),
});

Error Handling

The client handles various QuickFS API errors:

  • InvalidPeriodError (400): Invalid time period specified
  • UnsupportedMetricError (404): Requested metric not supported
  • UnsupportedCompanyError (404): Company not in QuickFS database
  • BatchLimitExceededError (413): Too many items in batch request
  • InsufficientQuotaError (429): Daily quota exceeded

Rate Limits and Quotas

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

What Counts Towards Your Quota?

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.

Checking Your Usage

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);

Examples

See the examples/ directory for more usage examples:

Run examples with:

QUICKFS_API_KEY=your_key cargo run --example basic_usage

API Coverage

This client provides access to all QuickFS API endpoints:

Companies API

  • companies_country_exchange_get - List supported companies by country/exchange
  • companies_updated_date_country_get - List recently updated companies

Datapoints API

  • data_symbol_metric_get - Get financial data for specific metrics
  • data_all_data_symbol_get - Get full datasets for a company
  • data_batch_post - Batch requests for multiple datapoints

Metrics API

  • metrics_get - List all available financial metrics

Usage History API

  • usage_get - Check your current API quota usage

Documentation

For detailed API endpoint documentation, see the docs/ directory.

To generate and view the crate documentation:

cargo doc --open

Related Projects

Support

License

This project is licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published