1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! TradingView study and fundamental data retrieval.
//!
//! Provides a clean, high-level API modeled after [`crate::historical::HistoricalClient`] for fetching
//! TradingView indicator studies (both built-in and Pine Script studies) over WebSocket.
//!
//! # Architecture
//!
//! ```text
//! StudyClient::retrieve(request)
//! ├── StudyRequest (symbol/exchange, study config, interval, bar count, timeout)
//! ├── StudyState (accumulates points keyed by study ID, tracks completion)
//! ├── StudyDataHandler (inspects timescale_update / du for study points)
//! └── returns StudyResult (symbol info, sorted/deduplicated points, elapsed duration)
//! ```
//!
//! # Example
//!
//! ```no_run
//! use tradingview::Interval;
//! use tradingview::chart::study::StudyConfiguration;
//! use tradingview::study::{StudyClient, StudyRequest};
//! use tradingview::models::pine_indicator::{PineIndicator, ScriptType};
//! use tradingview::DataServer;
//!
//! # async fn run() -> tradingview::Result<()> {
//! let client = StudyClient::new("unauthorized_user_token", DataServer::Data);
//!
//! let indicator = PineIndicator::build()
//! .fetch("STD;Fund_total_revenue_fy", "69.0", ScriptType::IntervalScript)
//! .await?;
//!
//! let request = StudyRequest::builder()
//! .symbol("AAPL")
//! .exchange("NASDAQ")
//! .interval(Interval::OneDay)
//! .base_bar_count(100)
//! .study(StudyConfiguration::Pine(Box::new(indicator)))
//! .build();
//!
//! let result = client.retrieve(request).await?;
//! println!("received {} study points for {}", result.len(), result.symbol_info.name);
//! # Ok(())
//! # }
//! ```
pub use crateStudyConfiguration;
pub use StudyClient;
pub use StudyRequest;
pub use StudyResult;