#api-wrapper #api #wrapper #bybit

rsbit

This is a library for the Bybit API

8 releases (4 breaking)

0.5.0 Feb 3, 2024
0.4.0 Jan 23, 2024
0.3.3 Jan 20, 2024
0.3.1 Dec 26, 2023
0.1.0 Dec 13, 2023

#1450 in Web programming

MIT/Apache

540KB
15K SLoC

Crates.io

I am live coding on YouTube. If you're interested, please feel free to visit.
※日本語で話しています。
YouTube Channel Link

Details

This is a library for the Bybit API.

Usage

The response is returned in the form of a deserialized struct.

use rsbit::v5::api::{
    BybitApi,
    get::market::get_public_recent_trading_history::{
        GetPublicRecentTradingHistoryParameters,
        GetPublicRecentTradingHistoryCategory,
    }
};

#[tokio::main]
async fn main() {
    // If you're only using public APIs, there is no need to set it up with an API key or API secret.
    let bybit_api = BybitApi::new()
        .with_mainnet() // The default is for the testnet, so please add it for use on the mainnet.
        .with_testnet() // You can also revert to the testnet if needed.
        .with_api_key("your_api_key")
        .with_api_secret("your_api_secret");
    
    let params = GetPublicRecentTradingHistoryParameters::new(
        GetPublicRecentTradingHistoryCategory::Linear,
    ).with_symbol("BTCUSDT".to_string());

    let result = bybit_api.get_public_recent_trading_history;

    match result {
        Ok(result) => {
            // Do something with the result.
        },
        Err(err) => {
            // Do something with the error.
        }
    }
}

Reference

Dependencies

~13–30MB
~556K SLoC