pine_core/syminfo.rs
1/// Symbol information the host supplies for a script run.
2///
3/// Mirrors PineScript's `syminfo.*` namespace: the instrument's identity and
4/// trading conventions. A script may read any of these; the host fills in what
5/// it knows and leaves the rest at their defaults.
6#[derive(Clone, Debug, Default)]
7pub struct SymInfo {
8 /// Symbol without exchange prefix, e.g. `"AAPL"` (`syminfo.ticker`).
9 pub ticker: String,
10 /// Fully qualified symbol including exchange, e.g. `"NASDAQ:AAPL"`
11 /// (`syminfo.tickerid`).
12 pub tickerid: String,
13 /// Human-readable description of the symbol (`syminfo.description`).
14 pub description: String,
15 /// Exchange/data-source prefix, e.g. `"NASDAQ"` (`syminfo.prefix`).
16 pub prefix: String,
17 /// Currency the symbol is quoted in, e.g. `"USD"` (`syminfo.currency`).
18 pub currency: String,
19 /// Base currency for forex pairs, e.g. `"EUR"` in `EURUSD`
20 /// (`syminfo.basecurrency`).
21 pub basecurrency: String,
22 /// Instrument type, e.g. `"stock"`, `"forex"`, `"crypto"` (`syminfo.type`).
23 pub type_: String,
24 /// Smallest price increment, e.g. `0.01` (`syminfo.mintick`).
25 pub mintick: f64,
26 /// Currency value of one point of price movement (`syminfo.pointvalue`).
27 pub pointvalue: f64,
28 /// Exchange timezone, e.g. `"America/New_York"` (`syminfo.timezone`).
29 pub timezone: String,
30 /// Trading session specification (`syminfo.session`).
31 pub session: String,
32 /// Root of a futures contract, e.g. `"ES"` (`syminfo.root`).
33 pub root: String,
34 /// The current standard contract of a continuous futures symbol
35 /// (`syminfo.current_contract`).
36 pub current_contract: String,
37 /// Symbol of the main pair for a spread/derived symbol
38 /// (`syminfo.main_tickerid`).
39 pub main_tickerid: String,
40 /// ISIN of the symbol (`syminfo.isin`).
41 pub isin: String,
42 /// Country the symbol is traded in, e.g. `"US"` (`syminfo.country`).
43 pub country: String,
44 /// Economic sector, e.g. `"Technology"` (`syminfo.sector`).
45 pub sector: String,
46 /// Industry, e.g. `"Semiconductors"` (`syminfo.industry`).
47 pub industry: String,
48 /// How volume is reported, e.g. `"base"`/`"quote"` (`syminfo.volumetype`).
49 pub volumetype: String,
50 /// Number of mintick increments in the minimum price move
51 /// (`syminfo.minmove`).
52 pub minmove: f64,
53 /// Price scale, the denominator of a fractional price (`syminfo.pricescale`).
54 pub pricescale: f64,
55 /// Minimum tradable contract size (`syminfo.mincontract`).
56 pub mincontract: f64,
57 /// Expiration date of a derivative, as a UNIX timestamp
58 /// (`syminfo.expiration_date`).
59 pub expiration_date: f64,
60 /// Number of employees (`syminfo.employees`).
61 pub employees: f64,
62 /// Number of shareholders (`syminfo.shareholders`).
63 pub shareholders: f64,
64 /// Total shares outstanding (`syminfo.shares_outstanding_total`).
65 pub shares_outstanding_total: f64,
66 /// Float shares outstanding (`syminfo.shares_outstanding_float`).
67 pub shares_outstanding_float: f64,
68 /// Analyst recommendation totals (`syminfo.recommendations_*`).
69 pub recommendations_buy: f64,
70 pub recommendations_buy_strong: f64,
71 pub recommendations_hold: f64,
72 pub recommendations_sell: f64,
73 pub recommendations_sell_strong: f64,
74 pub recommendations_total: f64,
75 /// Date the recommendations were issued, as a UNIX timestamp
76 /// (`syminfo.recommendations_date`).
77 pub recommendations_date: f64,
78 /// Analyst price targets (`syminfo.target_price_*`).
79 pub target_price_average: f64,
80 pub target_price_high: f64,
81 pub target_price_low: f64,
82 pub target_price_median: f64,
83 pub target_price_estimates: f64,
84 /// Date the price targets were issued, as a UNIX timestamp
85 /// (`syminfo.target_price_date`).
86 pub target_price_date: f64,
87}