行情区图表:成交量、十字线 OHLCV、可视高低点、日线满 500 根
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,7 +15,7 @@ from hub_kline_store import (
|
||||
upsert_bars,
|
||||
window_start_ms,
|
||||
)
|
||||
from hub_ohlcv_lib import TIMEFRAME_MS
|
||||
from hub_ohlcv_lib import TIMEFRAME_MS, chart_fetch_start_ms, window_start_ms
|
||||
|
||||
|
||||
class TestHubKlineStore(unittest.TestCase):
|
||||
@@ -28,7 +28,18 @@ class TestHubKlineStore(unittest.TestCase):
|
||||
|
||||
def test_bar_limits(self):
|
||||
self.assertEqual(bar_limit_for_timeframe("5m"), 1000)
|
||||
self.assertEqual(bar_limit_for_timeframe("1h"), 1000)
|
||||
self.assertEqual(bar_limit_for_timeframe("1d"), 500)
|
||||
self.assertEqual(bar_limit_for_timeframe("1w"), 500)
|
||||
|
||||
def test_chart_fetch_window_exceeds_retention(self):
|
||||
import time
|
||||
|
||||
now = int(time.time() * 1000)
|
||||
need = bar_limit_for_timeframe("1d")
|
||||
fetch_start = chart_fetch_start_ms("1d", need, now)
|
||||
db_start = window_start_ms("1d", need, retention_days(), now)
|
||||
self.assertLess(fetch_start, db_start)
|
||||
|
||||
def test_purge_retention(self):
|
||||
import time
|
||||
|
||||
Reference in New Issue
Block a user