12 releases (4 breaking)

0.5.4 May 12, 2024
0.5.3 May 7, 2024
0.5.0 Feb 3, 2024
0.4.0 Jan 23, 2024
0.1.0 Dec 13, 2023

#1766 in Web programming

MIT/Apache

545KB
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–27MB
~536K SLoC