Skip to content

Commit 4135eb8

Browse files
committed
feat: adapt list_instruments to instrument coverage (sdk-java 0.6.1)
Bump com.qtsurfer:sdk-java to 0.6.1 (API spec 0.97.0). InstrumentDetail replaced its flat dataFrom/dataTo fields with a per-data-type coverage object, so list_instruments now derives each data window from coverage (preferring the tickers window, falling back to klines) via the new appendCoverage helper. No change to the tool input or output contract.
1 parent 20893f7 commit 4135eb8

4 files changed

Lines changed: 33 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66

77
## [Unreleased]
88

9+
## [0.5.0] — 2026-07-10
10+
11+
### Changed 🔄
12+
13+
- Bumped `com.qtsurfer:sdk-java` to `0.6.1` (API spec 0.97.0). `InstrumentDetail` replaced its flat `dataFrom`/`dataTo` fields with per-data-type `coverage`, so the **`list_instruments`** tool now derives each instrument's `data: <from> → <to>` window from `coverage` (preferring the `tickers` window, falling back to `klines`, and omitting the suffix when unavailable). No change to the tool's input or output contract.
14+
915
## [0.4.0] — 2026-06-16
1016

1117
### Added ✨

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ MCP transport: stdio (stdin/stdout JSON-RPC 2.0)
158158
| Tool | Description |
159159
|------|-------------|
160160
| `list_exchanges` | List available exchanges (e.g. `binance`, `binancefutures`) |
161-
| `list_instruments` | List instruments for an exchange with data-availability windows and market info |
161+
| `list_instruments` | List instruments for an exchange with per-data-type coverage windows and market info |
162162
| `submit_backtest` | Compile a Java strategy and submit a backtesting run; returns a job ID |
163163
| `get_job_status` | Get status and full execution metrics for a submitted job |
164164
| `list_jobs` | List jobs from the current session, optionally filtered by status |

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.qtsurfer</groupId>
77
<artifactId>mcp-java</artifactId>
8-
<version>0.4.0</version>
8+
<version>0.5.0</version>
99
<packaging>jar</packaging>
1010
<name>qtsurfer-mcp-java</name>
1111

@@ -34,7 +34,7 @@
3434
<maven.compiler.release>${java.version}</maven.compiler.release>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3636
<mcp.version>1.1.2</mcp.version>
37-
<sdk.version>0.5.0</sdk.version>
37+
<sdk.version>0.6.1</sdk.version>
3838
<slf4j.version>2.0.16</slf4j.version>
3939
<logback.version>1.5.11</logback.version>
4040
<junit.version>5.11.4</junit.version>

src/main/java/com/qtsurfer/mcp/tool/McpTools.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.qtsurfer.mcp.model.JobStatus;
1313
import com.qtsurfer.mcp.service.BacktestingService;
1414

15+
import java.time.OffsetDateTime;
1516
import java.util.ArrayList;
1617
import java.util.List;
1718
import java.util.Map;
@@ -114,10 +115,7 @@ private static SyncToolSpecification listInstruments(BacktestingService service)
114115
if (i.getLastPrice() != null) {
115116
sb.append(" (last: ").append(i.getLastPrice()).append(')');
116117
}
117-
if (i.getDataFrom() != null && i.getDataTo() != null) {
118-
sb.append(" data: ").append(i.getDataFrom().toLocalDate())
119-
.append(" → ").append(i.getDataTo().toLocalDate());
120-
}
118+
appendCoverage(sb, i);
121119
sb.append('\n');
122120
});
123121
return text(sb.toString().stripTrailing());
@@ -129,6 +127,28 @@ private static SyncToolSpecification listInstruments(BacktestingService service)
129127
});
130128
}
131129

130+
/**
131+
* Appends a {@code " data: <from> → <to>"} suffix derived from the instrument's
132+
* coverage, preferring the {@code tickers} window and falling back to
133+
* {@code klines}. Appends nothing when coverage, both windows, or either
134+
* endpoint of the chosen window is unavailable.
135+
*/
136+
private static void appendCoverage(StringBuilder sb, InstrumentDetail instrument) {
137+
if (instrument.getCoverage() == null) return;
138+
var coverage = instrument.getCoverage();
139+
OffsetDateTime from = null;
140+
OffsetDateTime to = null;
141+
if (coverage.getTickers() != null) {
142+
from = coverage.getTickers().getFrom();
143+
to = coverage.getTickers().getTo();
144+
} else if (coverage.getKlines() != null) {
145+
from = coverage.getKlines().getFrom();
146+
to = coverage.getKlines().getTo();
147+
}
148+
if (from == null || to == null) return;
149+
sb.append(" data: ").append(from.toLocalDate()).append(" → ").append(to.toLocalDate());
150+
}
151+
132152
// ---- submit_backtest ----------------------------------------------------
133153

134154
private static SyncToolSpecification submitBacktest(BacktestingService service) {

0 commit comments

Comments
 (0)