pub struct ScreenerQuery {
pub size: u32,
pub offset: u32,
pub sort_type: SortType,
pub sort_field: String,
pub include_fields: Vec<String>,
pub top_operator: LogicalOperator,
pub query: QueryGroup,
pub quote_type: QuoteType,
}Expand description
A custom screener query for Yahoo Finance
Allows building flexible queries to filter stocks/funds/ETFs based on various criteria like price, volume, market cap, and more.
§Example
use finance_query::{ScreenerQuery, QueryCondition, screener_query::{Operator, QuoteType}};
// Find US stocks with high volume and market cap > $10B
let query = ScreenerQuery::new()
.quote_type(QuoteType::Equity)
.size(25)
.sort_by("intradaymarketcap", false) // Sort by market cap descending
.add_condition(QueryCondition::new("region", Operator::Eq).value_str("us"))
.add_condition(QueryCondition::new("avgdailyvol3m", Operator::Gt).value(200000))
.add_condition(QueryCondition::new("intradaymarketcap", Operator::Gt).value(10_000_000_000.0));Fields§
§size: u32Number of results to return (default: 25, max: 250)
offset: u32Starting offset for pagination (default: 0)
sort_type: SortTypeSort direction (ASC or DESC)
sort_field: StringField to sort by (e.g., “intradaymarketcap”, “percentchange”)
include_fields: Vec<String>Fields to include in the response
top_operator: LogicalOperatorTop-level logical operator (AND or OR)
query: QueryGroupQuery filter conditions
quote_type: QuoteTypeType of quote to screen (EQUITY, ETF, MUTUALFUND, etc.)
Implementations§
Source§impl ScreenerQuery
impl ScreenerQuery
Sourcepub fn sort_by(self, field: impl Into<String>, ascending: bool) -> Self
pub fn sort_by(self, field: impl Into<String>, ascending: bool) -> Self
Set the sort field and direction
§Arguments
field- Field to sort by (e.g., “intradaymarketcap”, “percentchange”)ascending- If true, sort ascending; if false, sort descending
Sourcepub fn quote_type(self, quote_type: QuoteType) -> Self
pub fn quote_type(self, quote_type: QuoteType) -> Self
Set the quote type (EQUITY or MUTUALFUND)
This also updates the default include_fields and sort_field to use appropriate fields for the quote type.
Sourcepub fn include_fields(self, fields: Vec<String>) -> Self
pub fn include_fields(self, fields: Vec<String>) -> Self
Set the fields to include in the response
Sourcepub fn add_include_field(self, field: impl Into<String>) -> Self
pub fn add_include_field(self, field: impl Into<String>) -> Self
Add a field to include in the response
Sourcepub fn top_operator(self, op: LogicalOperator) -> Self
pub fn top_operator(self, op: LogicalOperator) -> Self
Set the top-level operator (AND or OR)
Sourcepub fn add_condition(self, condition: QueryCondition) -> Self
pub fn add_condition(self, condition: QueryCondition) -> Self
Add a filter condition
§Example
use finance_query::{ScreenerQuery, QueryCondition, screener_query::Operator};
let query = ScreenerQuery::new()
.add_condition(QueryCondition::new("region", Operator::Eq).value_str("us"))
.add_condition(QueryCondition::new("avgdailyvol3m", Operator::Gt).value(200000));Sourcepub fn add_or_conditions(self, conditions: Vec<QueryCondition>) -> Self
pub fn add_or_conditions(self, conditions: Vec<QueryCondition>) -> Self
Add multiple conditions that will be OR’d together
§Example
use finance_query::{ScreenerQuery, QueryCondition, screener_query::Operator};
// Filter for region being US OR GB
let query = ScreenerQuery::new()
.add_or_conditions(vec![
QueryCondition::new("region", Operator::Eq).value_str("us"),
QueryCondition::new("region", Operator::Eq).value_str("gb"),
]);Sourcepub fn most_shorted() -> Self
pub fn most_shorted() -> Self
Create a “most shorted stocks” screener preset
Finds US stocks sorted by short interest percentage.
Sourcepub fn high_dividend() -> Self
pub fn high_dividend() -> Self
Create a “high dividend yield” screener preset
Finds US stocks with dividend yield > 3%.
Sourcepub fn large_cap_growth() -> Self
pub fn large_cap_growth() -> Self
Create a “large cap growth” screener preset
Finds large cap stocks with positive earnings growth.
Trait Implementations§
Source§impl Clone for ScreenerQuery
impl Clone for ScreenerQuery
Source§fn clone(&self) -> ScreenerQuery
fn clone(&self) -> ScreenerQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScreenerQuery
impl Debug for ScreenerQuery
Source§impl Default for ScreenerQuery
impl Default for ScreenerQuery
Source§impl<'de> Deserialize<'de> for ScreenerQuery
impl<'de> Deserialize<'de> for ScreenerQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ScreenerQuery
impl RefUnwindSafe for ScreenerQuery
impl Send for ScreenerQuery
impl Sync for ScreenerQuery
impl Unpin for ScreenerQuery
impl UnsafeUnpin for ScreenerQuery
impl UnwindSafe for ScreenerQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more