Crates.io | polymarket-rs-client |
lib.rs | polymarket-rs-client |
version | |
source | src |
created_at | 2024-12-03 09:04:23.975304 |
updated_at | 2024-12-04 10:51:09.945351 |
description | An async client to interact with polymarket. |
homepage | |
repository | https://github.com/TechieBoy/polymarket-rs-client |
max_upload_size | |
id | 1469797 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
An async rust client for interacting with Polymarket.
cargo add polymarket-rs-client
The client internally uses a reqwest Client
, so you will also need the tokio
runtime.
cargo add -F rt-multi-thread,macros tokio
For representing order amounts and sizes, the client uses rust-decimal
crate. It is recommmended to install this crate as well.
cargo add rust-decimal
Create an instance of the ClobClient
to interact with the CLOB API. Note that the prerequisite allowances must be set before creating and sending an order as described here.
use polymarket_rs_client::ClobClient;
use std::env;
const HOST: &str = "https://clob.polymarket.com";
const POLYGON: u64 = 137;
#[tokio::main]
async fn main() {
let private_key = env::var("PK").unwrap();
let nonce = None;
let mut client = ClobClient::with_l1_headers(HOST, &private_key, POLYGON);
let keys = client.create_or_derive_api_key(nonce).await.unwrap();
client.set_api_creds(keys);
let o = client.get_sampling_markets(None).await.unwrap();
dbg!(o);
}
The ClobClient
implements the same API as the official python client. All available functions are listed in the docs.
TODO