| Crates.io | alpaca-websocket |
| lib.rs | alpaca-websocket |
| version | 0.3.1 |
| created_at | 2026-01-01 19:51:45.010346+00 |
| updated_at | 2026-01-02 07:33:44.234903+00 |
| description | WebSocket client for Alpaca trading platform real-time data |
| homepage | https://github.com/joaquinbejar/alpaca-rs |
| repository | https://github.com/joaquinbejar/alpaca-rs |
| max_upload_size | |
| id | 2017374 |
| size | 120,146 |
WebSocket client for the Alpaca trading platform real-time data and account updates.
alpaca-websocket provides a real-time streaming interface for Alpaca's market data and account events. It's built on top of tokio-tungstenite for high-performance asynchronous streaming.
Add to your Cargo.toml:
[dependencies]
alpaca-websocket = "0.3.1"
Run examples with cargo run -p alpaca-websocket --example <name>:
| Example | Description |
|---|---|
ws_stock_trades_stream |
Stream real-time stock trades |
ws_stock_quotes_stream |
Stream real-time stock quotes |
ws_stock_bars_stream |
Stream real-time stock bars |
ws_crypto_stream |
Stream real-time crypto data |
ws_trade_updates |
Stream order/trade updates |
ws_websocket_config |
Configure WebSocket client |
ws_reconnection |
Handle disconnections and reconnect |
ws_stream_news |
Subscribe to real-time news |
# Stream stock trades
cargo run -p alpaca-websocket --example ws_stock_trades_stream
# Stream trade updates (order fills)
cargo run -p alpaca-websocket --example ws_trade_updates
Note: Examples require ALPACA_API_KEY and ALPACA_API_SECRET environment variables.
We welcome contributions to this project! If you would like to contribute, please follow these steps:
If you have any questions, issues, or would like to provide feedback, please feel free to contact the project maintainer:
We appreciate your interest and look forward to your contributions!
License: MIT
This software is not officially associated with Alpaca Markets. Trading financial instruments carries risk, and this library is provided as-is without any guarantees. Always test thoroughly with a paper trading account before using in a live trading environment.