Rust Rithmic R | Protocol API client
Unofficial rust client for connecting to Rithmic's R | Protocol API.
rithmic protocol version: 0.84.0.0
Not all functionality has been implemented, but this is currently being used to trade live capital through Rithmic.
Only order_plant, ticker_plant, pnl_plant, history_plant are provided. Each plant uses the actor pattern so you'll want to start a plant, and communicate / call commands with it using it's handle. The crate is setup to be used with tokio channels.
The history_plant supports loading both historical tick data and time bar data (1-second, 1-minute, 5-minute, daily, and weekly bars).
Installation
You can install it from crates.io
$ cargo add rithmic-rs
Or manually add it to your Cargo.toml file.
[dependencies]
rithmic-rs = "0.4.0"
Usage
Store your credentials in a .env file.
# .env
RITHMIC_TEST_USER=<USER_NAME>
RITHMIC_TEST_PW=<PASSWORD>
RITHMIC_DEMO_USER=<USER_NAME>
RITHMIC_DEMO_PW=<PASSWORD>
RITHMIC_LIVE_USER=<USER_NAME>
RITHMIC_LIVE_PW=<PASSWORD>
Rithmic supports three types of account environments, RithmicConnectionSystem::Demo is used for paper trading, RithmicConnectionSystem::Live will connect to your funded account, and RithmicConnectionSystem::Test connects to the test environment before your app is approved.
To use this crate, pass in your account information to one of the plants. Doing so will spawn an actor in a new thread that listens to commands that you send via a handle. Some plants like the ticker plant will also include a broadcast channel that you can listen to for wire level updates.
pub async
Examples
The repository includes several examples to help you get started:
Environment Variables
Before running examples, copy .env.blank to .env and fill in your credentials:
# Edit .env with your Rithmic credentials
Basic Connection
Historical Data
# Load historical tick data
# Load historical time bars (1-minute, 5-minute, daily)
Contribution
Contributions encouraged and welcomed!
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.