Skip to content

add hacker news demo#4

Merged
gangtao merged 1 commit into
mainfrom
feature/3-hacker-new-demo
May 15, 2026
Merged

add hacker news demo#4
gangtao merged 1 commit into
mainfrom
feature/3-hacker-new-demo

Conversation

@gangtao
Copy link
Copy Markdown
Contributor

@gangtao gangtao commented May 15, 2026

No description provided.

@gangtao gangtao linked an issue May 15, 2026 that may be closed by this pull request
@gangtao gangtao self-assigned this May 15, 2026
@gangtao gangtao merged commit d16cb15 into main May 15, 2026
@gangtao gangtao deleted the feature/3-hacker-new-demo branch May 19, 2026 16:54
gangtao added a commit that referenced this pull request May 21, 2026
Closes the alpha-101 demo's main goal: 10 alphas from the WorldQuant
101 paper, each chosen to demonstrate a different streaming-SQL
pattern in Timeplus.

Shared pipeline upgrade (additive, non-breaking):
- v_bars now exposes high (max price/bucket), low (min price/bucket),
  vwap (sum(price*volume)/sum(volume)), in addition to the existing
  open, close, volume.
- Reshaped v_bars's aggregation so vwap is computed in an outer SELECT
  after the GROUP BY — Timeplus 3.3.1 rejects `null_if(sum(volume),0)`
  in the same SELECT as `sum(volume)` with a "nested aggregate" error.
  Renamed the inner sum-of-volume alias to `vol_sum` to avoid alias
  collision with the column name.

New alpha chains and the pattern each demonstrates:

  #3  rank-correlation(open, volume, 10)
      — cross-sectional rank of raw OHLC inputs + 10-bucket Pearson corr

  #4  ts_rank(rank(low), 9)
      — time-series rank within rolling window via
        array_count(x -> x <= current, lags(_, 0, 8))

  #6  correlation(open, volume, 10)
      — raw-value rolling Pearson correlation (no rank step) for contrast

  #9  nested-if(ts_min/ts_max of delta-close)
      — array_min/array_max over lags(_, 0, 4) + multi_if conditionals

  #12 sign(Δvolume) × −Δclose
      — minimal alpha: single-step deltas via lags(_, 1, 1), sign,
        multiplication; tiny SQL footprint to contrast with the others

  #22 delta(corr(high, volume, 5), 5) × rank(stddev(close, 20))
      — chained derived series: rolling corr → delta of derived signal
        × cross-sectional rank of rolling stddev

  #41 √(high × low) − vwap
      — VWAP derivation in v_bars + intra-bar nonlinear math

  #54 -1 × (low − close) × open⁵ / ((low − high) × close⁵)
      — pure intra-bar nonlinear OHLC, no lags or aggregation

Naming follows the consistent _alpha_N suffix convention. Files
numbered 013–035 in /ddl. Each alpha is a 1-4 file chain (features
→ ranks → alpha → backtest, with simpler alphas skipping intermediate
views).

Dashboards: extended the Alpha dropdown's inlineValues from
"1,2" to "1,2,3,4,6,9,12,22,41,54". No new dashboard files needed —
the {{filter_alpha}} substitution handles all 10 alphas.

README rewritten with a per-alpha pattern table and updated pipeline
diagram.

End-to-end verified: fresh .tpapp install brings up all 35 DDL
resources + 2 dashboards. Every v_alpha_N emits non-null values
in streaming queries; v_backtest_alpha_N emits pnl. (Some longer-
lookback alphas like #3 and #22 take more warmup before the
correlation arrays fully populate — same pattern as Alpha #1.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gangtao added a commit that referenced this pull request May 21, 2026
The random source assigns each stock a fixed price band ([50, 80, 120,
…] with only ±0.5% tick noise), so cross-sectional rank of raw price-
level features is a constant per stock — bands never overlap. This
makes alphas #3, #4, and #6 degenerate (alpha_4 always = -1 in steady
state, etc.) — the math is correct, the data just has no rank
information to extract.

Documents which alphas DO produce meaningful varying signals on this
synthetic feed (#1, #2, #9, #12, #22, #41, #54 — the ones operating
on returns, deltas, or intra-bar quantities) versus which need real
market data to demo properly.

Caught when reviewer noticed alpha_4 = -1 everywhere.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hacker New Demo

1 participant