Skip to main content
Glama
longbridge

longbridge

Official

Historical Candlesticks by Offset

history_candlesticks_by_offset
Read-onlyIdempotent

Fetch historical candlesticks relative to a reference time. Configure symbol, period, count, direction, trade sessions; results cap to account limits if count exceeds entitlement.

Instructions

Get historical candlestick data by offset from a reference time. Only symbol is required; period defaults to day (1m/5m/15m/30m/60m/day/week/month/year), count to 100, forward_adjust/forward to false, trade_sessions to all. If the account's entitlement caps out below the requested count, this returns as many candles as allowed instead of erroring — check the returned array length against count if an exact number matters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
_jqNoOptional jq filter (jaq syntax) applied to this tool's JSON response before it is returned; it never changes the upstream request. One output is returned as-is, several as a JSON array, none as []. Module imports and the `env`/`debug`/`stderr` builtins are unavailable. Example: .data | map({symbol}). Omit for the full response.
timeNoReference datetime (yyyy-mm-ddTHH:MM:SS), omit to start from latest
countNoNumber of candlesticks (optional, max 1000; default 100)
periodNoPeriod: 1m, 5m, 15m, 30m, 60m, day, week, month, year (default: day)day
symbolYesSecurity symbol, e.g. "700.HK". Use the canonical form — a padded code like "00700.HK" returns an empty record, not an error.
forwardNoWhether to query forward in time (true) or backward (false; default)
forward_adjustNoWhether to forward-adjust for splits/dividends (default: false / no adjust)
trade_sessionsNoTrade sessions: "intraday" (regular hours only) or "all" (include pre-market and post-market; default "all")all

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.12.0
    • addedInput schema / properties / _jq / description
      Added value: +"Optional jq filter (jaq syntax) applied to this tool's JSON response before it is returned; it never changes the upstream request. One output is returned as-is, several as a JSON array, none as []. Module imports and the `env`/`debug`/`stderr` builtins are unavailable. Example: .data | map({symbol}). Omit for the full response."
    • removedInput schema / properties / count / format
      Removed value: -"uint"
    • changedInput schema / properties / symbol / description
      Previous value: -"Security symbol, e.g. \"700.HK\""New value: +"Security symbol, e.g. \"700.HK\". Use the canonical form — a padded code like \"00700.HK\" returns an empty record, not an error."
  2. Changed1 schema field changedv0.10.6
    • addedInput schema / properties / _jq
      Added value: +{
      +  "type": "string"
      +}
  3. Changed11 schema fields changedv0.10.2
    • addedInput schema / properties / count / default
      Added value: +100
    • changedInput schema / properties / count / description
      Previous value: -"Number of candlesticks (max 1000)"New value: +"Number of candlesticks (optional, max 1000; default 100)"
    • addedInput schema / properties / forward / default
      Added value: +false
    • changedInput schema / properties / forward / description
      Previous value: -"Whether to query forward in time (true) or backward (false)"New value: +"Whether to query forward in time (true) or backward (false; default)"
    • addedInput schema / properties / forward_adjust / default
      Added value: +false
    • changedInput schema / properties / forward_adjust / description
      Previous value: -"Whether to forward-adjust for splits/dividends"New value: +"Whether to forward-adjust for splits/dividends (default: false / no adjust)"
    • addedInput schema / properties / period / default
      Added value: +"day"
    • changedInput schema / properties / period / description
      Previous value: -"Period: 1m, 5m, 15m, 30m, 60m, day, week, month, year"New value: +"Period: 1m, 5m, 15m, 30m, 60m, day, week, month, year (default: day)"
    • addedInput schema / properties / trade_sessions / default
      Added value: +"all"
    • changedInput schema / properties / trade_sessions / description
      Previous value: -"Trade sessions: \"intraday\" (regular hours only) or \"all\" (include pre-market and post-market)"New value: +"Trade sessions: \"intraday\" (regular hours only) or \"all\" (include pre-market and post-market; default \"all\")"
    • changedInput schema / required
      Previous value: -[
      -  "symbol",
      -  "period",
      -  "forward_adjust",
      -  "forward",
      -  "count",
      -  "trade_sessions"
      -]New value: +[
      +  "symbol"
      +]
  4. Changed1 schema field changedv0.7.1
    • removedInput schema / title
      Removed value: -"HistoryCandlesticksByOffsetParam"
  5. Addedv0.4.5
  6. Removedv0.4.0
  7. Addedv0.3.2
  8. Removedv0.3.1
  9. First observedv0.1.12

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and idempotentHint=true, establishing a safe read operation. The description goes beyond by revealing a subtle behavioral trait: if the account's entitlement caps below the requested count, the tool returns as many candles as allowed instead of erroring, with a warning to check array length. This is exactly the kind of context that helps an agent avoid misinterpreting short responses.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded. The first sentence states the core function; the second lists all defaults in a single breath; the last sentence covers the edge-case behavior. Every sentence contributes essential information without any fluff or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only, idempotent tool with a fully documented schema abbreviation, the description is complete: it identifies the only required parameter, enumerates all defaults, and flags the one behavior (partial results) that could otherwise surprise the caller. There is no output schema, but this tool's return format (candlestick arrays) is standard, and the description even tells the agent how to handle a potential short array.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds value by summarizing defaults in one place and, more importantly, explaining the entitlement cap behavior for the 'count' parameter, which is not in the schema. This goes beyond a mere restatement, though it doesn't override the schema's comprehensive documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Get historical candlestick data by offset from a reference time.' The verb 'Get', the resource 'historical candlestick data', and the distinguishing mechanism 'by offset' make the purpose evident. However, it does not explicitly differentiate from the sibling tool 'history_candlesticks_by_date' (though the name and offset wording implicitly do), so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides excellent context on how to use the tool: defaults for period, count, forward_adjust, forward, and trade_sessions are stated, and it notes that only symbol is required. It also explains the behavior when entitlement caps the count. However, it does not explicitly state when to prefer this tool over alternatives like 'candlesticks' or 'history_candlesticks_by_date', so it lacks explicit alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools