221 stable releases

Uses new Rust 2021

4.6.10 Sep 7, 2022
4.6.8 Aug 26, 2022
4.5.7 Jul 21, 2022
4.1.1 Mar 27, 2022
0.1.0 Dec 30, 2020

#427 in Magic Beans

Download history 114/week @ 2022-06-15 184/week @ 2022-06-22 99/week @ 2022-06-29 511/week @ 2022-07-06 697/week @ 2022-07-13 282/week @ 2022-07-20 735/week @ 2022-07-27 744/week @ 2022-08-03 252/week @ 2022-08-10 114/week @ 2022-08-17 575/week @ 2022-08-24 45/week @ 2022-08-31 545/week @ 2022-09-07 256/week @ 2022-09-14 6/week @ 2022-09-21 107/week @ 2022-09-28

931 downloads per month
Used in wmjtyd-libstock

Apache-2.0

675KB
17K SLoC

crypto-crawler

A rock-solid cryprocurrency crawler.

Crawl realtime trades

use crypto_crawler::{crawl_trade, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl realtime trades for all symbols of binance inverse_swap markets
    crawl_trade("binance", MarketType::InverseSwap, None, tx).await;
}

Crawl realtime level2 orderbook incremental updates

use crypto_crawler::{crawl_l2_event, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl realtime level2 incremental updates for all symbols of binance inverse_swap markets
    crawl_l2_event("binance", MarketType::InverseSwap, None, tx).await;
}

Crawl level2 orderbook full snapshots from RESTful API

use crypto_crawler::{crawl_l2_snapshot, MarketType};

fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    std::thread::spawn(move || {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl level2 full snapshots for all symbols of binance inverse_swap markets
    crawl_l2_snapshot("binance", MarketType::InverseSwap, None, tx);
}

Crawl realtime level2 orderbook top-K snapshots

use crypto_crawler::{crawl_l2_topk, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl realtime level2 top-k snapshots for all symbols of binance inverse_swap markets
    crawl_l2_topk("binance", MarketType::InverseSwap, None, tx).await;
}

Crawl realtime level3 orderbook incremental updates

use crypto_crawler::{crawl_l3_event, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl realtime level3 updates for all symbols of CoinbasePro spot market
    crawl_l3_event("coinbase_pro", MarketType::Spot, None, tx).await;
}

Crawl level3 orderbook full snapshots from RESTful API

use crypto_crawler::{crawl_l3_snapshot, MarketType};

fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    std::thread::spawn(move || {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl level3 orderbook full snapshots for all symbols of CoinbasePro spot markets
    crawl_l3_snapshot("coinbase_pro", MarketType::Spot, None, tx);
}

Crawl realtime BBO

use crypto_crawler::{crawl_bbo, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl realtime best bid and ask messages for all symbols of binance COIN-margined perpetual markets
    crawl_bbo("binance", MarketType::InverseSwap, None, tx).await;
}

Crawl 24hr rolling window tickers

use crypto_crawler::{crawl_ticker, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl 24hr rolling window tickers for all symbols of binance COIN-margined perpetual markets
    crawl_ticker("binance", MarketType::InverseSwap, None, tx).await;
}

Crawl candlesticks(i.e., OHLCV)

use crypto_crawler::{crawl_candlestick, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl candlesticks from 1 minute to 3 minutes for all symbols of binance COIN-margined perpetual markets
    crawl_candlestick("binance", MarketType::InverseSwap, None, tx).await;
}

Crawl funding rates

use crypto_crawler::{crawl_funding_rate, MarketType};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    // Crawl funding rates for all symbols of binance COIN-margined perpetual markets
    crawl_funding_rate("binance", MarketType::InverseSwap, None, tx).await;
}

Dependencies

~13–22MB
~452K SLoC