start_data_collection
Start a background OctoBot historical data collection job for a specified exchange and symbols, returning a job ID immediately. Poll job status to monitor progress and retrieve the resulting data files.
Instructions
Start a real OctoBot historical data collection run in the background and return immediately.
Not confirm-gated (ADR-0003/tool spec): starts a background download,
never touches live trading, destroys no data, exposes no credentials --
same reasoning as start_backtest. Maps to POST /data_collector ?action_type=start_collector [V]. symbols must be non-empty.
time_frames is optional (OctoBot collects its own default set when
omitted). start_timestamp/end_timestamp are optional epoch
milliseconds (confirmed both live and from source this session --
see this module's docstring).
To discover valid exchange/symbols values, use the existing
get_all_symbols(exchange) tool (confirmed this session to return
data identical to OctoBot's own data-collector-scoped symbol list, per
FR-27 -- no separate get_available_symbols_for_collection tool
exists here for that reason). For time_frames, use this module's own
get_available_timeframes_for_collection(exchange).
Behavior (ADR-0007): creates a kind: "data_collection" job, acquires
JobStore.data_collection_execution_lock -- a lock INDEPENDENT of
backtest_execution_lock (NFR-15): a concurrent start_backtest +
start_data_collection never block each other, but two concurrent
start_data_collection calls do serialize (queueing, same as two
concurrent backtests) -- then submits the start action and spawns a
background watcher connecting to OctoBot's /data_collector Socket.IO
namespace, mirroring start_backtest's watcher exactly (this session's
own live round-trip confirmation is recorded in this module's
docstring).
Output: {"job_id": str, "state": "queued"} -- always "queued"
immediately (the background watcher has not yet run at all). Poll
get_job_status(job_id) for progress_percent/eta_seconds;
get_job_result(job_id) once state == "completed" returns
{"exchange", "symbols", "time_frames", "start_timestamp", "end_timestamp", "message"} -- deliberately NO resulting filename
(OctoBot itself names none anywhere in this flow, confirmed this
session): call list_data_files() afterward to find the new file.
A confirmed OctoBot-side limitation, not a bug in this tool: a
collection submitted for a nonexistent/invalid exchange name returns
the SAME success response and the SAME "finished" status as a
genuinely successful run (confirmed live this session, resolving open
question #11) -- if list_data_files() doesn't show the expected new
file after a "completed" job, the exchange/symbol/timeframe
combination was likely invalid upstream, not a failure this server
could have detected sooner. A collection that never progresses at all
(staleness, NFR-3) is a separate, detectable case: its
eta_confidence will show "low"/eta_seconds: null and it should
be cancelled via cancel_job.
Supports progressToken (ADR-0002 decision point 3, reused via
octobot_mcp.tools._shared._attach_progress_notifier) exactly like
start_backtest.
Errors: DataCollectionStartFailedError wrapping OctoBot's own
failure text -- confirmed messages include "Backtesting is disabled.",
"Please select an exchange.", "Please select a trading pair.", any of
_ensure_backtesting_limits's three possible messages (see this
module's docstring -- source-confirmed text, not guessed), and "Can't
collect data for {symbols} on {exchange} (Historical data collector is
already running)" for OctoBot's own one-at-a-time guard. Raised from
the background watcher (not this function), surfacing as the job's
errors/state="failed" via get_job_status -- this function itself
only raises synchronously for input validation caught before any job
is created.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbols | Yes | ||
| exchange | Yes | ||
| time_frames | No | ||
| end_timestamp | No | ||
| start_timestamp | No |