Commit Graph

7 Commits

Author SHA1 Message Date
jgrusewski
2c3a070a9b feat(ctrader-openapi): complete client API with orders, symbols, account, market data
Add rate limiter (50/s + 5/s historical), symbol mapper, order builders,
account queries, market data subscriptions, and high-level CTraderClient
that orchestrates the full connect/auth/symbol-load lifecycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00
jgrusewski
1a3dd5409a feat(ctrader-openapi): message dispatcher with request correlation
MessageDispatcher spawns a reader task that routes responses to pending
requests by clientMsgId (UUID + oneshot channels), and broadcasts
server-pushed events (executions, spots, errors) via tokio broadcast.
Handles connection closure with pending request cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00
jgrusewski
891085dd96 feat(ctrader-openapi): OAuth2 token exchange and connection authentication
HTTP OAuth2 flow (auth code exchange + refresh) via reqwest, plus
protobuf-level two-phase auth (ApplicationAuth → AccountAuth) over
the TCP connection. Error extraction from OA error responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00
jgrusewski
64210b1519 feat(ctrader-openapi): TCP+TLS connection with heartbeat keepalive
CTraderConnection establishes TCP+TLS via tokio-native-tls, wraps in
framed codec, splits into shared sender + exclusive receiver, and
spawns a heartbeat task at configurable interval (default 10s).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00
jgrusewski
b2a3447fd8 feat(ctrader-openapi): length-delimited protobuf codec
CTraderCodec implements tokio_util Decoder+Encoder with 4-byte BE length
prefix framing. Handles partial frames, multiple frames in buffer, and
rejects oversized frames (16 MiB max). 5 unit tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00
jgrusewski
43edbeaa36 feat(ctrader-openapi): vendor and compile cTrader protobuf definitions
Downloads 4 proto files from spotware/openapi-proto-messages (MIT license),
compiles with prost-build, and adds payload-type constants + dispatch helpers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00
jgrusewski
f63ba8627c feat(ctrader-openapi): scaffold crate with config and error types
New workspace crate for cTrader Open API client (Protobuf over TCP+TLS).
Includes CTraderConfig, CTraderEnvironment, CTraderError, and RateLimitBucket types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00