Make ticks dataset opt-in for collect-history (#87)

* feat: make SQLite tick history opt-in for collect-history

Ticks can grow SQLite databases quickly, so they are excluded from the
default dataset selection. The new DEFAULT_HISTORY_DATASETS constant
(rates, history-orders, history-deals) drives resolve_history_datasets(None),
collect_history(), and update_history(). Callers must pass
--dataset ticks (CLI) or datasets={Dataset.ticks} (SDK) to include ticks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALK71tg75JWrrCKaiShb7b

* chore: reformat docs/index.md table column widths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALK71tg75JWrrCKaiShb7b

* fix: update stale docstrings and tighten CLI None check

- update_history and ThrottledHistoryUpdater.__init__ docstrings now
  state that ticks are opt-in, matching collect_history's wording
- cli.py collect-history uses `is not None` for explicit empty-list safety

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALK71tg75JWrrCKaiShb7b

* docs: update README collect-history to reflect ticks opt-in default

The command table and section intro previously stated ticks were
collected by default ("all four", "rates, ticks, history-orders, and
history-deals"). Both now reflect the new default (rates, history-orders,
history-deals) and note that --dataset ticks is required to include ticks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALK71tg75JWrrCKaiShb7b

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Daichi Narushima
2026-06-28 06:00:26 +09:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 43f632bc40
commit 80c3f3f65e
8 changed files with 173 additions and 49 deletions
+16 -2
View File
@@ -19,6 +19,7 @@ from pdmt5 import TIMEFRAME_MAP
from mt5cli import history
from mt5cli.history import (
DEFAULT_HISTORY_DATASETS,
DEFAULT_HISTORY_TIMEFRAMES,
DedupScope,
RateTarget,
@@ -547,10 +548,23 @@ class TestResolveHistorySettings:
"""Tests for history dataset and timeframe resolution."""
def test_resolve_history_datasets_defaults_and_empty(self) -> None:
"""Test dataset resolution distinguishes None from empty selection."""
assert resolve_history_datasets(None) == set(Dataset)
"""Test dataset resolution excludes ticks by default."""
resolved = resolve_history_datasets(None)
assert resolved == set(DEFAULT_HISTORY_DATASETS)
assert Dataset.ticks not in resolved
assert {
Dataset.rates,
Dataset.history_orders,
Dataset.history_deals,
} == resolved
assert resolve_history_datasets(set()) == set()
def test_resolve_history_datasets_explicit_ticks(self) -> None:
"""Test that explicit ticks selection is honored."""
assert resolve_history_datasets({Dataset.ticks}) == {Dataset.ticks}
all_ds = resolve_history_datasets(set(Dataset))
assert Dataset.ticks in all_ds
def test_resolve_history_timeframes_defaults(self) -> None:
"""Test default timeframes include all fixed MT5 values."""
resolved = resolve_history_timeframes(None)