Skip to content

Official Rust SDK for OpenExchangeAPI — high-performance client for accessing real-time and historical exchange data.

License

Notifications You must be signed in to change notification settings

OpenExchangeAPI/sdk-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenExchangeAPI Rust SDK

Minimal, idiomatic Rust client for OpenExchangeAPI

  • All endpoints supported
  • API key is optional
  • Async/await support
  • Strong types and precise decimal support

Installation

Add to your Cargo.toml:

[dependencies]
openexchangeapi = "*"

Usage

use openexchangeapi::OpenExchangeApiClient;

#[tokio::main]
async fn main() -> Result<(), openexchangeapi::OpenExchangeApiError> {
    let client = OpenExchangeApiClient::new(None); // API key optional

    // Get latest rates
    let latest = client.get_latest(None).await?;
    println!("{:?}", latest);

    // Convert currency
    let result = client.convert("USD", "EUR", 100.0).await?;
    println!("{:?}", result);

    Ok(())
}

API Reference

  • get_latest(base)
  • get_latest_precise(base)
  • get_historical(date, base)
  • get_historical_precise(date, base)
  • convert(from, to, amount)
  • convert_precise(from, to, amount)
  • list_currencies(type)
  • get_currency(code)

All methods return Result<T, OpenExchangeApiError>.

Error Handling

All errors are returned as OpenExchangeApiError.

License

MIT

About

Official Rust SDK for OpenExchangeAPI — high-performance client for accessing real-time and historical exchange data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages