Skip to main content

fyers_rs/
lib.rs

1//! Idiomatic async Rust client for the documented Fyers broker APIs.
2//!
3//! The crate is organized around a single [`FyersClient`] with typed accessors
4//! for auth, REST, and WebSocket surfaces. The market-data WebSocket talks the
5//! real Fyers V3 binary protocol (auth handshake, channel-mode set, channel
6//! resume, HSM-token-resolved subscribe, `ack` flow control) — see
7//! [`ws::DataSocketConnection`] and [`ws::data_protocol`].
8//!
9//! # Quick start
10//!
11//! ```
12//! use fyers_rs::FyersClient;
13//!
14//! let client = FyersClient::builder()
15//!     .client_id("APPID-100")
16//!     .access_token("ACCESS_TOKEN")
17//!     .build()?;
18//!
19//! let _orders = client.orders();
20//! let _market_data = client.market_data();
21//! let _data_socket = client.data_socket();
22//! # Ok::<(), fyers_rs::FyersError>(())
23//! ```
24//!
25//! # REST and WebSocket APIs
26//!
27//! REST services live under [`rest`] and typed request/response/event models live
28//! under [`models`]. WebSocket managers are exposed through [`ws`].
29//!
30//! # Verification status
31//!
32//! The market-data WebSocket and the profile/funds/holdings REST endpoints
33//! have been live-verified end-to-end. **REST order placement, modification,
34//! and cancellation paths have never been live-fired** against a real Fyers
35//! account — the URLs and payload shapes match the official Python SDK, but
36//! a round-trip live order has not yet been performed through this crate.
37//! See the README's verification matrix and the per-module status notes.
38//!
39//! # Warning
40//!
41//! This project is entirely AI-generated at this stage. It has not been
42//! independently audited or battle-tested. Review, test, and verify all behavior
43//! yourself before using it with real Fyers credentials, market data, or orders.
44
45#![forbid(unsafe_code)]
46#![warn(rust_2018_idioms)]
47
48pub mod auth;
49pub mod client;
50pub mod config;
51pub mod error;
52pub mod models;
53pub mod rest;
54pub mod transport;
55pub mod ws;
56
57pub use client::{FyersClient, FyersClientBuilder};
58pub use config::{FyersConfig, SecretString};
59pub use error::{FyersError, Result};
60
61pub use rest::{
62    alerts, edis, funds, gtt, holdings, market_data, orders, positions, profile, reports,
63    smart_orders, trades,
64};