Guide
There are two ways to build a screener: by either asking the AI or building your own query. In this document, we will focus on building your queries for advanced use cases. While AI can help, it is not perfect, so it's always a good idea to review the query it generates.
Pre-defined Variables
We offer over 100 fundamental filters you can use. You can find detailed descriptions of these filters by visiting the appropriate page.
Basic Filtering
Example 1
Filter for companies with EBITDA greater than 5 million:
Example 2
Filter for companies with EBITDA greater than 5 million and a market cap between 1 and 5 billion:
Additional Columns
You can include additional columns in the output, such as price and volume data. However, only predefined and user-defined variables are permitted.
Prevent browser hangs using "max_tickers"
Handling large data sets can potentially cause your browser to hang, so it's recommended to limit the number of tickers displayed in a single result.
Point-in-Time Screening
We have a historical dataset from January 1998 until today. You can do historical scans by using point_in_time
parameter
Logical Operators
We support logical operators such as and
and or
.
Root "and" Operator
At least one and
operator is required within the fundamentals or technicals filters. The first and
is known as the root logical operator.
You cannot have two or more root logical operators:
Instead, you should use nesting:
There are no limits on how many nested logical operators you can use, but be aware that complex queries may slow down the screener.
Comparison Operators
We have used the gt
(greater than) operator so far, but other comparison operators are supported:
eq
: equal toneq
: not equal togt
: greater thangte
: greater than or equal tolt
: less thanlte
: less than or equal tobetween
: within a specified range
Example of eq
Operator
eq
OperatorEBITDA is equal to 5 million:
Example of neq
Operator
neq
OperatorEBITDA is not equal to 5 million:
Example of gt
Operator
gt
OperatorEBITDA is greater than 5 million:
Example of gte
Operator
gte
OperatorEBITDA is greater than or equal to 5 million:
Example of lt
Operator
lt
OperatorEBITDA is less than 5 million:
Example of lte
Operator
lte
OperatorEBITDA is less than or equal to 5 million:
Example of between
Operator
between
OperatorEBITDA is between 5 and 7 million:
Defining Variables
You can assign a variable with a number, a mathematical expression, by aliasing a predefined variable or a combination of both. The variable name must always begin with a non-numeric character.
Variable names with number prefix is not allowed:
Defining a Mathematical Formula
The following basic mathematical operations are supported:
+
(Addition), -
(Subtraction), *
(Multiplication), /
(Division), and parentheses ()
for grouping.
For example, if you want to create a custom filter for (ebitda + revenue) * 2
, you would define a variable as follows:
You can then use the variable my_formula
inside the fundamentals filter. Sorting is also supported:
Advanced Functions
Using the previous
Function
previous
FunctionThe previous
function allows you to reference the value of a variable from previous rows. The syntax for the previous
function is as follows:
var
: This is the name of the variable (pre-defined or user-defined) whose previous value you want to retrieve.n
: This is the number of periods you want to look back. For example,n=1
would retrieve the value from the previous period.
Example 1: Getting Yesterday's Closing Price
In this example, we want to get the closing price from the previous day (yesterday's closing price), and then filter for cases where yesterday's closing price was greater than 500.
Example 2: Getting Last Year's Closing Price
In this example, we want to get the last year's closing price, and then filter for cases where price is greater than 500
Using the average
Function
average
FunctionThe average function calculates a simple moving average. Here’s how it is structured:
var: Represents the name of the variable (either pre-defined or user-defined) that you want to calculate the average for.
n: Specifies the number of periods over which to calculate the average. For example,
n=5
would compute a 5-day moving average for a stock.t (optional): Can define the time frame such as daily, weekly, monthly, or yearly.
Example 1: 200-day Moving Average of the Closing Price
In this case, the goal is to calculate the 200-day moving average of a stock's closing price.
This example computes the 200-day simple moving average (SMA) of the closing price and then checks if the 200-day SMA is greater than the current closing price.
Getting Help with Queries from the AI Assistant
If you're having trouble correcting a query or are unsure of the filter name, you can always ask the AI assistant for help.
Last updated