Screener context.
Stock-screener strategies, indicator search, and pre-defined
recommendation strategies. Mirrors the official ScreenerContext
in longbridge/openapi-go (Go) and longbridge/openapi/rust
(Rust) SDKs.
Usage
config = Longbridge.Config.new(...)
# Pre-defined recommended strategies
{:ok, response} = Longbridge.ScreenerContext.recommend_strategies(config, "US")
# The user's saved screener strategies
{:ok, response} = Longbridge.ScreenerContext.user_strategies(config, "US")
# A single strategy by ID
{:ok, strategy} = Longbridge.ScreenerContext.strategy(config, 42)
# Search by typed conditions (Mode B)
{:ok, results} = Longbridge.ScreenerContext.search(config, "US",
conditions: [
%{key: "pettm", min: "5", max: "20"}
],
page: 0,
size: 50
)
# Or by a saved strategy ID (Mode A) — the server-side strategy
# supplies its own filters and market.
{:ok, results} = Longbridge.ScreenerContext.search(config, "US",
strategy_id: 42, page: 0, size: 50
)
# List of available indicators
{:ok, indicators} = Longbridge.ScreenerContext.indicators(config)Note on responses
The screener API returns free-form JSON (json.RawMessage in the
Go SDK). We surface the raw decoded map directly; callers should
not assume a fixed schema. The upstream applies a filter_ prefix
transformation on some fields — see the docs in each function.
Summary
Functions
Lists available screener indicators.
Fetches the list of pre-defined recommended screener strategies for
a market ("US", "HK", "CN", "SG").
Executes a screener search.
Fetches a single screener strategy by ID.
Fetches the current user's saved screener strategies for a market.
Functions
@spec indicators( Longbridge.Config.t(), keyword() ) :: {:ok, map()} | {:error, term()}
Lists available screener indicators.
Endpoint: GET /v1/quote/ai/screener/indicators
The response is normalized:
"filter_"prefix is stripped from everygroups[].indicators[].key.tech_valuesis built fromtech_indicatorsas{tech_key: [%{value: String.t(), label: String.t()}]}.
@spec recommend_strategies(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Fetches the list of pre-defined recommended screener strategies for
a market ("US", "HK", "CN", "SG").
Endpoint: GET /v1/quote/ai/screener/strategies/recommend?market=...
@spec search(Longbridge.Config.t(), String.t(), keyword(), keyword()) :: {:ok, map()} | {:error, term()}
Executes a screener search.
Endpoint: POST /v1/quote/ai/screener/search
Two modes:
Mode A (
strategy_id:given) — the server-side strategy supplies its own filters and market. Themarketargument is ignored; the strategy's own market is used.Mode B (
conditions:given) — typed conditions drive the filters, and the suppliedmarketis used directly.
The "filter_" prefix is stripped from every
items[].indicators[].key in the response before it is returned.
Options
:strategy_id— non_neg_integer, sets Mode A. Mutually exclusive with:conditions.:conditions— list of%{key: String.t(), min: String.t(), max: String.t()}, sets Mode B. The"filter_"prefix is added automatically.:show— list of extra return columns to include beyond the defaults. Optional.:page— 0-indexed page number. Required.:size— page size. Required.
@spec strategy(Longbridge.Config.t(), non_neg_integer(), keyword()) :: {:ok, map()} | {:error, term()}
Fetches a single screener strategy by ID.
Endpoint: GET /v1/quote/ai/screener/strategy/{id}
The "filter_" prefix is stripped from every
filter.filters[].key in the response before it is returned.
@spec user_strategies(Longbridge.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Fetches the current user's saved screener strategies for a market.
Endpoint: GET /v1/quote/ai/screener/strategies/mine?market=...