| Crates.io | the0-sdk |
| lib.rs | the0-sdk |
| version | 0.3.1 |
| created_at | 2025-12-26 12:30:35.167678+00 |
| updated_at | 2026-01-09 15:07:24.514635+00 |
| description | the0 trading bot SDK for Rust |
| homepage | https://the0.dev |
| repository | https://github.com/alexanderwanyoike/the0 |
| max_upload_size | |
| id | 2005657 |
| size | 85,856 |
Optional SDK for building trading bots on the0 platform.
Note: This SDK is optional. The the0 runtime automatically wraps your bot's output:
{"status":"success","message":"Bot executed successfully"}{"status":"error","message":"Bot execution failed"}"status" field, it's passed through as-isuse std::env;
fn main() {
// No SDK needed - just run your code and exit normally
let bot_id = env::var("BOT_ID").unwrap_or_default();
let config_str = env::var("BOT_CONFIG").unwrap_or_default();
eprintln!("Bot {} running...", bot_id);
// Your trading logic here
// Exit normally - runtime outputs {"status":"success",...}
}
The SDK provides convenience methods for parsing config and outputting custom results.
Add to your Cargo.toml:
[dependencies]
the0-sdk = "0.1"
serde_json = "1.0" # Required for config access
Or from git:
[dependencies]
the0-sdk = { git = "https://github.com/alexanderwanyoike/the0", subdirectory = "sdk/rust" }
use the0_sdk::input;
fn main() {
// Parse bot configuration
let (bot_id, config) = input::parse();
eprintln!("Bot {} starting", bot_id);
// Access config values
if let Some(symbol) = config.get("symbol") {
eprintln!("Trading symbol: {}", symbol);
}
// Your trading logic here
// Optionally output custom result (otherwise runtime generates it)
input::success("Bot executed successfully");
}
input::parse() -> (String, Value)Parse bot configuration from environment. Returns (bot_id, config).
input::parse_as_map() -> (String, HashMap<String, Value>)Parse configuration as a HashMap for easier access.
input::success(message: &str)Output success result and continue execution.
input::error(message: &str) -> !Output error result and exit with code 1.
input::result(data: &Value)Output custom JSON result.
See the Rust Quick Start Guide for a complete example.
This package is published to crates.io.
Login to crates.io:
cargo login
Ensure you have ownership of the crate on crates.io
# Verify the package
cargo publish --dry-run
# Publish to crates.io
cargo publish
Update the version in Cargo.toml:
version = "0.2.0"
Then publish.
Apache-2.0