Skip to main content

Crate tvscreener

Crate tvscreener 

Source
Expand description

Unofficial TradingView screener API client (Rust), inspired by deepentropy/tvscreener.

Canonical repository: Interchouette-ITC/tvscreener-rs.

Builds JSON payloads and POSTs them to https://scanner.tradingview.com/{subtype}/scan.

§Payload shape

core::Screener::build_payload emits a JSON object with filter, columns, range, options, symbols, optional sort, and optional top-level keys from core::Screener::add_misc. Filters with the same left key are merged: values accumulate and the operator may promote to in_range.

§Rows

Scan responses decode to ScreenerRow: each row holds a symbol string and a data map keyed by column label (not technical field name). Labels come from the (technical, label) pairs produced by util::get_columns_to_request.

§Example (offline payload)

use tvscreener::core::Screener;
use tvscreener::field::default_crypto_fields;
use tvscreener::filter::{FieldCondition, FilterOperator};
use serde_json::json;

let mut screener = Screener::new("crypto");
screener
.select(default_crypto_fields())
.where_condition(FieldCondition::new(
"name",
FilterOperator::Match,
json!("btc"),
)).unwrap()
.set_range(0, 5);
let payload = screener.build_payload().unwrap();
assert!(payload.get("columns").and_then(|v| v.as_array()).is_some());

Not affiliated with TradingView. Use is subject to TradingView terms.

Re-exports§

pub use beautify::format_cell;
pub use beautify::format_cell_for_field;
pub use beautify::format_rows_table;
pub use beautify::CellTone;
pub use beautify::FormattedCell;
pub use beautify::RowTechMap;
pub use beautify::TableFormatOptions;
pub use beautify::DEFAULT_TABLE_MAX_COLUMNS;
pub use error::Result;
pub use error::TvscreenerError;
pub use field::catalog_len;
pub use field::get_preset;
pub use field::list_fields;
pub use field::list_presets;
pub use field::resolve_field;
pub use field::search_fields;
pub use field::Asset;
pub use field::FieldDef;
pub use field::IndexSymbolDef;
pub use field::Market;
pub use field::NamedValue;
pub use field::RatingBand;
pub use filter::ExtraFilter;
pub use filter::FieldCondition;
pub use filter::Filter;
pub use filter::FilterOperator;
pub use util::format_recommendation;
pub use util::format_row;
pub use util::format_value;

Modules§

beautify
Field-aware cell formatting (Python tvscreener.beauty without Jupyter HTML).
core
Asset-class screeners and shared Screener builder state.
error
Error types for HTTP, JSON, and request construction failures.
field
Curated field definitions, presets, and metadata loaded from data/fields.json.
filter
Filter operators, Filter payloads, FieldCondition, and ExtraFilter.
logging
Process logging helpers (tracing + stderr subscriber install).
mcp
MCP tool helpers and rmcp server (stdio or Streamable HTTP).
query_config
Shared filter/sort parsing and application for CLI, TUI, and MCP.
resolve
Shared CSV token parsing and catalog wire-value resolution (CLI + MCP).
ta
Technical-analysis helpers for computed recommendation columns.
tui
Ratatui screener TUI (tvscreener-tui binary).
util
URL helpers, request headers, millify, display formatting, and column-name utilities.

Structs§

ScreenerRow
One row from a screener scan response.