Skip to main content

Crate revolutx

Crate revolutx 

Source
Expand description

Unofficial Rust SDK for the Revolut X crypto exchange REST API.

revolutx is a handwritten, domain-oriented SDK aimed at trading bots and automation. The local OpenAPI specification is used as a contract and regression-test source, but generated OpenAPI types are not part of the public API. Prices, quantities, balances, and fees use rust_decimal::Decimal (re-exported as Decimal); they are never f64.

§Authentication

Authenticated requests are signed automatically with Ed25519 — callers never construct the X-Revx-Timestamp or X-Revx-Signature headers themselves. Generate a key pair with:

openssl genpkey -algorithm ed25519 -out private.pem
openssl pkey -in private.pem -pubout -out public.pem

§Example

use revolutx::{Environment, RevolutXClient};

let client = RevolutXClient::builder()
    .api_key("your-api-key")
    .private_key_pem(std::fs::read_to_string("private.pem").unwrap())
    .environment(Environment::Production)
    .build()?;

// Read-only: fetch balances and an order book.
let balances = client.balances().get_all().await?;
let book = client.market_data().order_book("BTC-USD").await?;
println!("{} balances, {} bid levels", balances.len(), book.bids.len());

Public market data needs no credentials:

let client = revolutx::RevolutXClient::builder().build()?;
let book = client.market_data().public_order_book("BTC-USD").await?;
println!("best bid level count: {}", book.bids.len());

§Disclaimer

This crate is not affiliated with Revolut. Trading automation carries financial risk; callers are responsible for their own validation, risk controls, and credential security. The SDK handles API access, typing, signing, and error reporting only — it does not provide trading strategy or risk management.

Re-exports§

pub use access::AccessLevel;
pub use agent::AgentControl;
pub use agent::AgentExecutor;
pub use agent::AgentServer;
pub use agent::AuthOutcome;
pub use agent::AuthToken;
pub use agent::default_socket_path;
pub use client::ClientBuilder;
pub use client::Environment;
pub use client::RevolutXClient;
pub use config::ClientConfig;
pub use config::client_from_env;
pub use error::ApiError;
pub use error::ApiErrorKind;
pub use error::Error;
pub use error::Result;
pub use keystore::Keystore;
pub use keystore::KeystoreError;
pub use model::Page;
pub use model::RawPage;
pub use model::common::ClientOrderId;
pub use model::common::OrderId;
pub use model::common::Price;
pub use model::common::Quantity;
pub use model::common::Side;
pub use model::common::Symbol;
pub use model::common::Timestamp;
pub use transport::LocalExecutor;
pub use transport::RawResponse;
pub use transport::RequestExecutor;
pub use transport::RequestSpec;

Modules§

access
Access tiers — the capability ladder shared by the signing agent’s authoritative gate and the high-level command layer.
agent
Signing-agent proxy (agent feature, unix-only).
api
Endpoint groups.
client
Client configuration and endpoint entry points.
commands
High-level command layer (commands feature).
config
Build a RevolutXClient from credentials and a target environment, with a fallback to the REVOLUTX_* environment variables.
error
Public error model.
fix
FIX 4.4 client (market data and trading). Enabled by the fix feature.
keystore
Encrypted credential vault (keystore feature).
model
Public domain models.
transport
Request execution and the pluggable transport seam.

Structs§

Decimal
Decimal represents a 128 bit representation of a fixed-precision decimal number. The finite set of values of type Decimal are of the form m / 10e, where m is an integer such that -296 < m < 296, and e is an integer between 0 and 28 inclusive.
Ed25519Signer
The default Signer: holds the API key and the Ed25519 signing key in memory for the lifetime of the client. Both are zeroized on drop (the key via ed25519-dalek’s zeroize support).
GeneratedKeyPair
A freshly generated Ed25519 key pair, PEM-encoded, from generate_key_pair.
RequestAuth
The authentication material for a single request.

Traits§

Signer
Authenticates Revolut X requests.

Functions§

generate_key_pair
Generates a new Ed25519 key pair from operating-system randomness.
public_pem_from_private_pem
Derives the SPKI public-key PEM from a PKCS#8 private-key PEM.