CLI usage
Pass the trading pair as a positional argument:BTCUSDT.
Python usage
analyze_market()
Downloads up to limit candlesticks for symbol at the given interval, computes RSI and EMA, and returns a structured signal dictionary.
Signature
Parameters
string
default:"BTCUSDT"
Binance trading pair in uppercase (e.g.
"BTCUSDT", "ETHUSDT", "SOLUSDT"). Any valid Binance spot or futures symbol is accepted.string
default:"1d"
Candlestick interval. Accepts any Binance kline interval string — common values are
"1m", "5m", "1h", "4h", "1d", "1w".number
default:"100"
Number of candlesticks to fetch from Binance (maximum 1000). Must be greater than
max(rsi_period, ema_period) + 1; otherwise the function returns "insufficient data".number
default:"14"
Lookback window for the Wilder RSI calculation.
number
default:"20"
Lookback window for the exponential moving average. Trend is determined by comparing the last close price against the last EMA value.
Return value
Returnsdict[str, str | int].
string
required
Directional bias derived by comparing the most recent close against the EMA. One of
"bullish" (close ≥ EMA) or "bearish" (close < EMA). Returns "neutral" when there is insufficient data.number
required
Most recent RSI value rounded to the nearest integer, in the range 0–100. Returns
50 when there is insufficient data.string
required
Human-readable trading signal derived from RSI and trend. Possible values:
Example response
Insufficient data response
Iflimit is smaller than max(rsi_period, ema_period) + 1, the function returns safe defaults instead of raising an exception:
Signal logic reference
The signal is computed in two steps: first determine trend from price vs. EMA, then apply RSI thresholds.No API key is required. Binance kline data is publicly accessible.