Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.15.0
2.16.0
1 change: 1 addition & 0 deletions docs/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ All official releases are produced deterministically through GitHub Actions:

## Release History

- [v2.16.0 Release Notes](releases/v2.16.0.md) — Added floating `↑ Back to Top` (`#tape-scroll-top`) pill when scrolling the Running Tape, paired side-by-side with `New Events ↑` in `.tape-float-bar` across both main and pop-out `web/tape.html` windows (Resolves #94).
- [v2.15.0 Release Notes](releases/v2.15.0.md) — Added dedicated screener tab Add (`+`), inline Duplicate (`⧉`), and right-side inline Close (`×`) buttons without right-clicking, plus stale screen state pruning in `ScreenerWorker` (Resolves #85).
- [v2.14.0 Release Notes](releases/v2.14.0.md) — Added responsive horizontal topbar scrolling with auto-shown left/right arrow buttons on both sides of the screen for narrow windows and multi-tab layouts (Resolves #84).
- [v2.13.0 Release Notes](releases/v2.13.0.md) — Added cross-platform Power & Keep-Awake controls (prevent screen lock, prevent system sleep, prevent monitors turning off) in General Settings with a 1-click topbar Prevent Screen Lock toggle button (Resolves #83).
Expand Down
6 changes: 4 additions & 2 deletions docs/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ Non-session fields: `float_shares_outstanding`, `market_cap_basic`, `sector`,
- Watchlist Selector Bar (`#watchlist-bar`) positioned directly above the News pane.
- News pane features custom US equity symbol inspection (`#news-sym-input`) and quick watchlist chips.
- Tape header features instant quick-filter popout (`Strategies 11/13`) with color bullets and select/unselect all.
- Tape can pop out into its own window (second `pywebview` window serving `web/tape.html` with full watchlist `+` parity).
- Tape floating pill bar (`.tape-float-bar`) houses both `New Events ↑` (`#tape-new-events`) and an auto-shown `↑ Back to Top` (`#tape-scroll-top`) scroll utility button side-by-side without overlap across both embedded and pop-out `web/tape.html` views.
- Tape can pop out into its own window (second `pywebview` window serving `web/tape.html` with full watchlist `+` and floating `↑ Back to Top` parity).
- Dark theme matching TradingView look.

## 6. Screener
Expand Down Expand Up @@ -481,7 +482,8 @@ The right-hand pane combines real-time catalyst PR headlines with deep SEC EDGAR
- triggers a squeeze condition (§8.2), with per-symbol/per-strategy cooldown (default 30 s). **Monotonic Window Progression**: During an active time window (e.g. 5 min / 10 min), subsequent triggers for the same symbol & strategy require strictly higher prices (`price > last_alert_price`). Server-side `change|5` velocity checks are isolated to regular trading hours. If the price falls or is flat vs the previous trigger, alerts are suppressed; once the time window resets (`now - last_alert_time >= window_min * 60`), a new squeeze cycle can begin.
- **Persistent Storage & Off-Hours Review**: Tape alerts are automatically saved to `<APP_DIR>/tape_history.json` via debounced atomic writes and respect user-configured `retention_days` (default 4 days, minimum 1 day) and `max_events` (default 5,000, minimum 100). On startup or session transition, the first poll silently seeds initial universe state before emitting live alerts. When the app restarts, reloads, or opens during off-hours / weekends, all historical alerts are immediately loaded into the tape for retrospective review.
- **Timestamp Formatting**: Displays `H:MM:SS am/pm` for alerts triggered today, and `MMM DD H:MM am/pm` for older alerts, with full ET date/time and relative age tooltips.
- Newest events on top; bounded by `max_events` (default 5,000); ⏸ pause freezes scrolling and shows "New events ↑"; 🗑️ clear button removes history (`POST /api/clear_tape`).
- Newest events on top; bounded by `max_events` (default 5,000); ⏸ pause freezes scrolling and shows `New Events ↑` (`#tape-new-events`); 🗑️ clear button removes history (`POST /api/clear_tape`).
- **Floating Back-to-Top Pill (`#tape-scroll-top`)**: Whenever the user scrolls down past `24px` in the Running Tape (in either the embedded pane or detached `web/tape.html`), a dark-glass `↑ Back to Top` pill appears automatically inside `.tape-float-bar` (bottom-centered at `bottom: 18px`) alongside `#tape-new-events` without overlap. Clicking `#tape-scroll-top` immediately jumps back to `scrollTop = 0` (avoiding mid-flight cancellation during live tape cascades) while preserving manual pause state (`Tape.paused`); returning to top automatically hides `#tape-scroll-top` and clears unpaused `scrolledNew` state.

### 8.2 Predefined strategies (toggle list like the Warrior screenshot)
| Strategy | Rule (defaults, all editable in Settings) |
Expand Down
38 changes: 38 additions & 0 deletions docs/releases/v2.16.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# NewsAlerts v2.16.0 — Release Notes

**Release Date:** December 2026
**Type:** Minor Feature Release (`MINOR` — Running Tape Floating Back-to-Top Button)
**Single Source of Truth:** `VERSION` (`2.16.0`)

---

## 🚀 Overview

NewsAlerts **v2.16.0** adds an automatic floating **`↑ Back to Top`** (`#tape-scroll-top`) pill to the Running Momentum Tape so traders reviewing deep historical prints (up to 3,000 DOM rows / 4-day history) can jump straight back to the top in a single click—even during quiet periods or off-hours when no new live events are arriving.

---

## ✨ What's New

- **Floating `↑ Back to Top` Pill (`#tape-scroll-top`)**:
- Automatically appears as soon as the tape scrolls down past `24px` (`SCROLL_TOP_THRESHOLD`) and hides automatically once back at the top.
- Jumps immediately back to `scrollTop = 0` (immune to mid-flight cancellation during rapid live cascades) while **preserving manual pause state** (`Tape.paused`) so paused tape reviews are never accidentally resumed.
- **Non-Overlapping Centered Float Bar (`.tape-float-bar`)**:
- Groups `New Events ↑` (`#tape-new-events`) and `↑ Back to Top` (`#tape-scroll-top`) inside a bottom-centered flex pill bar (`.tape-float-bar`, `bottom: 18px`) with an `8px` gap so both controls can appear simultaneously with zero collision against each other, `.pane-head`, sticky column headers, scrollbars, or the corner version badge.
- Fixed `@keyframes bob` to translate vertically only (`translateY(3px)`), eliminating horizontal shift inside the centered flex bar.
- **Embedded & Pop-Out Tape Parity**:
- Works identically in both `web/index.html` and detached `web/tape.html`, with synchronized `?v=12` cache-buster versions across both HTML entry points.

---

## 🎯 Closed Issues

- Resolves [#94](https://github.com/mlgitdev/NewsAlerts/issues/94): `feat(tape): add floating back-to-top button when scrolling tape`

---

## 🧪 Verification & Test Suite

- Added test-first regression suite in `tests/test_tape_scroll_top.py` verifying `#tape-scroll-top`, `.tape-float-bar`, vertical-only `@keyframes bob`, `index.html`/`tape.html` `?v=` asset parity, and `docs/SPEC.md` documentation.
- Verified live in the integrated browser against an isolated `NEWSALERTS_DIR` server across desktop (`1920x1080`, `1600x900`) and narrow (`820x900`, `640x520`) viewports plus detached `web/tape.html`, confirming zero overlap, pause preservation, smooth return to top, and `0` console errors.
- Passed full syntax compilation, unit test suite, PyInstaller portable build, and deterministic package verification gate.
4 changes: 3 additions & 1 deletion docs/wiki/Running-Momentum-Tape.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ The **Running Momentum Tape** provides a high-velocity stream of High of Day (HO
- **Pop-Out Detached Window**:
Press `T` on your keyboard or click the Pop-Out icon (`⧉`) in the Tape header to launch a dedicated, borderless floating tape window for multi-monitor setups.
- **Pause & Scroll Lock**:
Press `Space` or click `⏸` to freeze tape scrolling during rapid cascades while inbound events continue queuing (`New events ↑`).
Press `Space` or click `⏸` to freeze tape scrolling during rapid cascades while inbound events continue queuing (`New Events ↑`).
- **Floating Back-to-Top Pill (`↑ Back to Top`)**:
As soon as you scroll down through historical tape rows (in either the embedded tape or detached pop-out window), a floating **`↑ Back to Top`** pill appears beside `New Events ↑` so you can jump back to the top in one click—even when paused or during off-hours with no new events arriving.

---

Expand Down
2 changes: 1 addition & 1 deletion docs/wiki/_Footer.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
<p align="center">
<small>
<b>NewsAlerts v2.15.0</b> · Institutional Trading Terminal · Maintained by <a href="https://github.com/mlgitdev">@mlgitdev</a> · <a href="https://github.com/mlgitdev/NewsAlerts">GitHub Repository</a> · <a href="Home">Wiki Home</a>
<b>NewsAlerts v2.16.0</b> · Institutional Trading Terminal · Maintained by <a href="https://github.com/mlgitdev">@mlgitdev</a> · <a href="https://github.com/mlgitdev/NewsAlerts">GitHub Repository</a> · <a href="Home">Wiki Home</a>

</small>
</p>
51 changes: 51 additions & 0 deletions tests/test_tape_scroll_top.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""Unit tests for Running Tape floating Back-to-Top button and sibling entry-point parity."""
from __future__ import annotations

import re
import unittest
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent


class TestTapeBackToTop(unittest.TestCase):
def test_tape_js_mounts_float_bar_and_scroll_top_button(self):
js = (ROOT / "web" / "js" / "tape.js").read_text(encoding="utf-8")
self.assertIn('id: "tape-scroll-top"', js)
self.assertIn("tape-float-bar", js)
self.assertIn("SCROLL_TOP_THRESHOLD", js)
self.assertIn("updateScrollTopBtn()", js)
self.assertIn("scrollToTop()", js)

def test_tape_css_uses_non_overlapping_float_bar_and_vertical_bob(self):
css = (ROOT / "web" / "css" / "app.css").read_text(encoding="utf-8")
self.assertIn(".tape-float-bar", css)
self.assertIn(".tape-scroll-top", css)
self.assertIn(".tape-scroll-top.show", css)
# Anchor float bar near the bottom of .tape-pane so it never occludes .pane-head or sticky <thead>
self.assertRegex(css, r"\.tape-float-bar\s*\{[^}]*bottom:\s*\d+px;")
# @keyframes bob must translate vertically only once centered by .tape-float-bar
self.assertRegex(css, r"@keyframes\s+bob\s*\{\s*50%\s*\{\s*transform:\s*translateY\(")

def test_index_and_popout_tape_html_share_asset_cache_buster_version(self):
idx_html = (ROOT / "web" / "index.html").read_text(encoding="utf-8")
tape_html = (ROOT / "web" / "tape.html").read_text(encoding="utf-8")
for asset in ("css/app.css", "js/util.js", "js/tape.js"):
m_idx = re.search(rf'{re.escape(asset)}\?v=(\d+)', idx_html)
m_tape = re.search(rf'{re.escape(asset)}\?v=(\d+)', tape_html)
self.assertIsNotNone(m_idx, f"{asset} version missing in index.html")
self.assertIsNotNone(m_tape, f"{asset} version missing in tape.html")
self.assertEqual(
m_idx.group(1),
m_tape.group(1),
f"Cache-buster mismatch for {asset}: index.html v={m_idx.group(1)} vs tape.html v={m_tape.group(1)}",
)

def test_spec_md_documents_tape_back_to_top_control(self):
spec = (ROOT / "docs" / "SPEC.md").read_text(encoding="utf-8")
self.assertIn("#tape-scroll-top", spec)
self.assertIn("Back to Top", spec)


if __name__ == "__main__":
unittest.main()
24 changes: 21 additions & 3 deletions web/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,31 @@ body.bright .tape-pane .grid td.vol-cell { color: #fff; }
.tape-pane td.float-low { color: var(--mint); font-weight: 600; }
body.bright .tape-pane td.float-low { background: #8ff0a4 !important; color: #06140f; }
.vol-cell { font-weight: 600; }
.tape-float-bar {
position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 5;
display: flex; align-items: center; gap: 8px; pointer-events: none; max-width: calc(100% - 24px);
}
.new-events {
position: absolute; top: 44px; left: 50%; transform: translateX(-50%); z-index: 5;
pointer-events: auto;
padding: 6px 14px; border-radius: 999px; background: #fff5c2; color: #2b2200; font-weight: 700;
font-size: 12px; white-space: nowrap;
box-shadow: var(--shadow); cursor: pointer; display: none; border: none;
}
.new-events.show { display: block; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, 3px); } }
.new-events.show { display: inline-flex; align-items: center; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }
.tape-scroll-top {
pointer-events: auto;
padding: 6px 13px; border-radius: 999px;
background: rgba(18, 24, 38, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
color: var(--text); border: 1px solid var(--border-2);
font-size: 12px; font-weight: 650; white-space: nowrap;
box-shadow: var(--shadow); cursor: pointer; display: none;
transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.tape-scroll-top.show { display: inline-flex; align-items: center; gap: 5px; }
.tape-scroll-top:hover {
border-color: var(--mint); color: var(--mint); background: rgba(24, 33, 52, 0.96);
}

/* ---------------------------------------------------------------- dropdowns / popovers */
.pop {
Expand Down
14 changes: 7 additions & 7 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="icon.png">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="css/app.css?v=11">
<link rel="stylesheet" href="css/app.css?v=12">
</head>
<body>
<div class="app">
Expand Down Expand Up @@ -235,11 +235,11 @@ <h2>Settings & Data Sources</h2>
</div>

<!-- SCRIPTS -->
<script src="js/util.js?v=11"></script>
<script src="js/screener.js?v=11"></script>
<script src="js/news.js?v=11"></script>
<script src="js/tape.js?v=11"></script>
<script src="js/settings.js?v=11"></script>
<script src="js/app.js?v=11"></script>
<script src="js/util.js?v=12"></script>
<script src="js/screener.js?v=12"></script>
<script src="js/news.js?v=12"></script>
<script src="js/tape.js?v=12"></script>
<script src="js/settings.js?v=12"></script>
<script src="js/app.js?v=12"></script>
</body>
</html>
42 changes: 37 additions & 5 deletions web/js/tape.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
["Strategy Name", "l", (e) => e.strategy],
];
const MAX_DOM = 3000;
const SCROLL_TOP_THRESHOLD = 24;

const Tape = {
events: [],
Expand All @@ -34,7 +35,15 @@
});
const popBtn = opts.popout ? null : U.el("button", { class: "icon-btn", id: "tape-popout-btn", title: "Pop out tape", html: U.icons.popout });
const count = U.el("span", { class: "sub" });
const newBtn = U.el("button", { class: "new-events", id: "tape-new-events" }, "New Events ↑");
const newBtn = U.el("button", { class: "new-events", id: "tape-new-events", type: "button" }, "New Events ↑");
const scrollTopBtn = U.el("button", {
class: "tape-scroll-top",
id: "tape-scroll-top",
type: "button",
"aria-label": "Back to top",
title: "Scroll back to top of tape",
}, "↑ Back to Top");
const floatBar = U.el("div", { class: "tape-float-bar", id: "tape-float-bar" }, newBtn, scrollTopBtn);
const thead = U.el("tr", {}, COLS.map(([h, c]) => U.el("th", { class: c, html: h })));
const tbody = U.el("tbody");
const body = U.el("div", { class: "pane-body" },
Expand All @@ -43,9 +52,9 @@
U.el("div", { class: "pane-head" },
U.el("div", { class: "pane-title" }, "⚡ Small Cap — High of Day Momentum", count),
U.el("div", { class: "spacer" }), strBtn, pauseBtn, clearBtn, popBtn),
newBtn, body);
floatBar, body);
host.append(pane);
Object.assign(Tape, { root: pane, tbody, body, newBtn, pauseBtn, clearBtn, strBtn, count });
Object.assign(Tape, { root: pane, tbody, body, floatBar, newBtn, scrollTopBtn, pauseBtn, clearBtn, strBtn, count });

strBtn.onclick = () => Tape.strategyMenu(strBtn);
pauseBtn.onclick = () => Tape.setPaused(!Tape.paused);
Expand All @@ -57,8 +66,17 @@
}
};
if (popBtn) popBtn.onclick = () => App.api().pop_tape();
newBtn.onclick = () => { Tape.setPaused(false); body.scrollTop = 0; Tape.updateNewBtn(); };
body.addEventListener("scroll", () => { if (body.scrollTop < 5 && !Tape.paused) Tape.updateNewBtn(); });
newBtn.onclick = () => {
Tape.setPaused(false);
body.scrollTop = 0;
Tape.updateNewBtn();
Tape.updateScrollTopBtn();
};
scrollTopBtn.onclick = () => Tape.scrollToTop();
body.addEventListener("scroll", () => {
if (body.scrollTop < 5 && !Tape.paused) Tape.updateNewBtn();
Tape.updateScrollTopBtn();
});
tbody.addEventListener("click", (e) => {
const tr = e.target.closest("tr");
if (tr && tr.dataset.t) App.api().select_symbol(tr.dataset.t);
Expand Down Expand Up @@ -169,6 +187,7 @@
Tape.pending = [];
Tape.updateStrBtn();
Tape.updateNewBtn();
Tape.updateScrollTopBtn();
},

add(evs) {
Expand Down Expand Up @@ -201,6 +220,7 @@
while (Tape.tbody.children.length > MAX_DOM) Tape.tbody.lastChild.remove();
if (body.scrollTop > 5) { body.scrollTop += body.scrollHeight - before; Tape.scrolledNew = true; }
Tape.updateNewBtn();
Tape.updateScrollTopBtn();
},

setPaused(p) {
Expand Down Expand Up @@ -235,6 +255,18 @@
Tape.count.textContent = Tape.paused ? "· paused" : (vis ? `· ${vis} alerts (${days}d history)` : "");
},

scrollToTop() {
if (!Tape.body) return;
Tape.body.scrollTop = 0;
if (!Tape.paused) Tape.updateNewBtn();
Tape.updateScrollTopBtn();
},

updateScrollTopBtn() {
if (!Tape.scrollTopBtn || !Tape.body) return;
Tape.scrollTopBtn.classList.toggle("show", Tape.body.scrollTop > SCROLL_TOP_THRESHOLD);
},


updateStrBtn() {
const all = App.config.tape.strategies.length;
Expand Down
6 changes: 3 additions & 3 deletions web/tape.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="icon.png">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="css/app.css?v=8">
<link rel="stylesheet" href="css/app.css?v=12">
</head>
<body class="tape-only">
<div class="app">
Expand All @@ -17,8 +17,8 @@
</div>
</div>

<script src="js/util.js?v=8"></script>
<script src="js/tape.js?v=8"></script>
<script src="js/util.js?v=12"></script>
<script src="js/tape.js?v=12"></script>
<script>
window.addEventListener("DOMContentLoaded", async () => {
await App.ready;
Expand Down
Loading