Module websocket

Source
Expand description

WebSocket client for polygon.io.

§Authentication

Use an API key to authenticate. This can be provided through the auth_key parameter to WebSocketClient::new() or through the POLYGON_AUTH_KEY environment variable.

§Example

use polygon_client::websocket::{STOCKS_CLUSTER, WebSocketClient};

#[tokio::main]
async fn main() {
    let mut client = WebSocketClient::new(STOCKS_CLUSTER, None);
    let res = client.receive();
    let msg_text = res.unwrap().into_text().unwrap();
    println!("msg: {}", msg_text);
}

Structs§

WebSocketClient

Constants§

CRYPTO_CLUSTER
FOREX_CLUSTER
STOCKS_CLUSTER