btcturk_websockets

Crates.iobtcturk_websockets
lib.rsbtcturk_websockets
version0.3.1
created_at2023-08-22 09:07:04.141282+00
updated_at2025-06-15 20:49:42.551618+00
descriptionA Rust library for interacting with the BTCTurk Websockets API.
homepage
repository
max_upload_size
id950825
size41,522
Doğa Budak (dogabudak)

documentation

README

Rust WebSocket Crate

Rust Version WebSocket Version License

Installation

Add the following dependency to your Cargo.toml file:

[dependencies]
btcturk_websockets = "0.3.1"

Example Usage

Here's an example of how to use the btcturk_websockets library:

use btcturk_websockets::{Client, ApiKeys};
use dotenv::dotenv;

#[tokio::test]
async fn general_test() {
    dotenv().ok(); // Load environment variables from .env file
    let btc_public_key = std::env::var("BTCTURK_PUBLIC_KEY").expect("BTCTURK_PUBLIC_KEY must be set.");
    let btc_private_key = std::env::var("BTCTURK_PRIVATE_KEY").expect("BTCTURK_PRIVATE_KEY must be set.");
    let connect_addr = std::env::var("BTCTURK_WEBSOCKET_ADDRESS").expect("BTCTURK_PRIVATE_KEY must be set.");
    let api_keys=ApiKeys::new(btc_public_key, btc_private_key);
    let client = Client::new(connect_addr, api_keys);
    let token = client.clone().generate_token_message();
    let connection = client.clone().create_connection().await;
    let ticker = client.clone().get_ticker("BTCTRY").await;
}

Make sure to set up your .env file with the necessary environment variables before running the example.

Commit count: 0

cargo fmt