feat: migrate CLOB client to V2-only trading

This commit is contained in:
floor-licker
2026-04-24 12:48:30 -03:00
parent 0ad1915d2a
commit e78ae17286
24 changed files with 1281 additions and 463 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Benchmark with Keep-Alive Enabled");
println!("==================================\n");
let client = ClobClient::new("https://clob.polymarket.com");
let client = ClobClient::new("https://clob-v2.polymarket.com");
// Start keep-alive
println!("Starting keep-alive...");
+9 -11
View File
@@ -94,21 +94,19 @@ impl PolyfillDemo {
/// Create a new demo
pub fn new() -> Result<Self> {
// Create basic client
let client = ClobClient::new("https://clob.polymarket.com");
// Create advanced client with configuration
let _config = ClientConfig {
base_url: "https://clob.polymarket.com".to_string(),
chain_id: 137, // Polygon
private_key: None, // Would be set in production
api_credentials: None, // Would be set in production
max_slippage: Some(dec!(0.01)), // 1% max slippage
fee_rate: Some(dec!(0.02)), // 2% fee rate
let config = ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
chain: 137,
private_key: None,
api_credentials: None,
builder_code: None,
timeout: Some(Duration::from_secs(30)),
max_connections: Some(100),
};
let client = ClobClient::new(&config.base_url);
let advanced_client = PolyfillClient::new("https://clob.polymarket.com");
// Create advanced client with configuration
let advanced_client = PolyfillClient::from_config(config.clone())?;
// Create order book manager
let book_manager = OrderBookManager::new(100);
+1 -1
View File
@@ -20,7 +20,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
for i in 1..=20 {
let start = Instant::now();
let response = client
.get("https://clob.polymarket.com/simplified-markets?next_cursor=MA==")
.get("https://clob-v2.polymarket.com/simplified-markets?next_cursor=MA==")
.send()
.await?;
+1 -1
View File
@@ -184,7 +184,7 @@ async fn test_config(
let start = Instant::now();
match client
.get("https://clob.polymarket.com/simplified-markets?next_cursor=MA==")
.get("https://clob-v2.polymarket.com/simplified-markets?next_cursor=MA==")
.send()
.await
{
+1 -1
View File
@@ -127,7 +127,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
};
// Create client with API credentials only (no private key needed for custodial trading)
let mut client = ClobClient::new("https://clob.polymarket.com");
let mut client = ClobClient::new("https://clob-v2.polymarket.com");
client.set_api_creds(api_creds);
println!("✅ Client configured for custodial API trading");
+1 -1
View File
@@ -18,7 +18,7 @@ async fn main() -> Result<()> {
info!("======================");
// Create client
let client = ClobClient::new("https://clob.polymarket.com");
let client = ClobClient::new("https://clob-v2.polymarket.com");
// Test 1: Basic connectivity
info!("\nTesting API Connectivity...");
+2 -2
View File
@@ -29,7 +29,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
for i in 1..=20 {
let start = Instant::now();
match baseline_http
.get("https://clob.polymarket.com/simplified-markets?next_cursor=MA==")
.get("https://clob-v2.polymarket.com/simplified-markets?next_cursor=MA==")
.send()
.await
{
@@ -68,7 +68,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Test 2: polyfill-rs (with keep-alive)");
println!("══════════════════════════════════════");
let our_client = polyfill_rs::ClobClient::new("https://clob.polymarket.com");
let our_client = polyfill_rs::ClobClient::new("https://clob-v2.polymarket.com");
our_client
.start_keepalive(std::time::Duration::from_secs(30))
.await;