rsbit

Crates.iorsbit
lib.rsrsbit
version0.5.4
sourcesrc
created_at2023-12-13 15:21:29.7837
updated_at2024-05-12 12:31:31.954317
descriptionThis is a library for the Bybit API.
homepage
repositoryhttps://github.com/torohash/rsbit
max_upload_size
id1068114
size648,900
(torohash)

documentation

README

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

Commit count: 107

cargo fmt