Compare commits
4 Commits
e0ae6bbd14
...
polymarket
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfad8d3072 | ||
| c0f008ab8b | |||
|
|
53c268511a | ||
|
|
7f3b885521 |
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: polymarket-browse
|
name: polymarket-browse
|
||||||
|
version: 0.0.2
|
||||||
category: research
|
category: research
|
||||||
description: Browse tradeable Polymarket events by game category. Shows active matches with ML odds (cents format), volume, tournament, and market URLs. Supports Counter Strike, League of Legends, Dota 2, Valorant, NBA, NFL, UFC, Tennis.
|
description: Browse tradeable Polymarket events by game category. Shows active matches with ML odds (cents format), volume, tournament, and market URLs. Supports Counter Strike, League of Legends, Dota 2, Valorant, NBA, NFL, UFC, Tennis.
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -470,8 +470,8 @@ def _get_time_data(e: dict[str, Any], tz: timezone | None = None) -> TimeData:
|
|||||||
delta = start_dt - now_utc
|
delta = start_dt - now_utc
|
||||||
total_sec = delta.total_seconds()
|
total_sec = delta.total_seconds()
|
||||||
|
|
||||||
if total_sec < 0:
|
if total_sec <= 0:
|
||||||
# Event is in the past
|
# Event is in the past or happening now
|
||||||
hours_ago = abs(total_sec) / 3600
|
hours_ago = abs(total_sec) / 3600
|
||||||
if hours_ago < 1:
|
if hours_ago < 1:
|
||||||
time_status = "LIVE"
|
time_status = "LIVE"
|
||||||
|
|||||||
@@ -309,6 +309,16 @@ class TestTimeFunctions(unittest.TestCase):
|
|||||||
self.assertEqual(td["time_urgency"], 3)
|
self.assertEqual(td["time_urgency"], 3)
|
||||||
self.assertIn("WIB", td["abs_time"])
|
self.assertIn("WIB", td["abs_time"])
|
||||||
|
|
||||||
|
def test_get_time_data_live_exactly_now(self):
|
||||||
|
"""Event starts exactly now -> 'LIVE', urgency 3 (not 'In 0m')."""
|
||||||
|
frozen = self._frozen_dt(2026, 3, 25, 12, 0, 0)
|
||||||
|
with patch("browse.datetime", self._mock_datetime(frozen)):
|
||||||
|
from browse import _get_time_data
|
||||||
|
|
||||||
|
td = _get_time_data(self._make_event("2026-03-25T12:00:00Z"))
|
||||||
|
self.assertEqual(td["time_status"], "LIVE")
|
||||||
|
self.assertEqual(td["time_urgency"], 3)
|
||||||
|
|
||||||
def test_get_time_data_started_2h_ago(self):
|
def test_get_time_data_started_2h_ago(self):
|
||||||
"""Started 2 hours ago -> 'LIVE 2h', urgency 3."""
|
"""Started 2 hours ago -> 'LIVE 2h', urgency 3."""
|
||||||
frozen = self._frozen_dt(2026, 3, 25, 14, 0, 0)
|
frozen = self._frozen_dt(2026, 3, 25, 14, 0, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user