Commit Graph

11 Commits

Author SHA1 Message Date
jgrusewski
b62e878f91 refactor: enforce unwrap/expect deny attributes across all production crates
Add #![deny(clippy::unwrap_used, clippy::expect_used)] to 11 crates that
were missing it, and standardize 3 existing crates to deny both lints.
Test code is exempted via #![cfg_attr(test, allow(...))].

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 14:52:12 +01:00
jgrusewski
8b9abcc3c1 fix: resolve all clippy errors across 37+ workspace crates
Eliminate ~4,260 clippy deny-level errors that blocked workspace-wide
clippy runs. Errors cascaded: upstream crate failures (ctrader-openapi,
risk-data) hid thousands of downstream errors in ml, tli, backtesting.

Key changes:
- ctrader-openapi: fix shadow_unrelated/shadow_reuse (renamed vars)
- risk-data/risk: replace non-ASCII em dashes with ASCII equivalents
- tli: allow deny lints on prost-generated proto code, fix shadows
- trading_engine: fix let_underscore_must_use, wildcard matches, shadows
- broker_gateway_service: allow dead_code on unused redis_client field
- ml (4030 errors): remove local deny overrides for unwrap/expect/indexing
  (workspace warn level sufficient), add crate-level allows for non-safety
  mass-violation lints (non_ascii_literal, shadow_*, str_to_string, etc.),
  batch-fix em dashes, unseparated literal suffixes, format_push_string,
  wildcard matches, impl_trait_in_params, mutex_atomic, and more
- backtesting: replace unwrap() on first()/last() with match destructure
- tests: simplify loop-that-never-loops, fix mutex unwrap

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:44:10 +01:00
jgrusewski
165aefef7d test(ctrader-openapi): mock server CI tests and demo integration tests
Add 66 mock server tests covering codec, rate limiter, config, order
builders, volume conversion, proto helpers, and error types. Add 6 demo
integration tests (ignored by default, gated behind env vars).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 19:23:30 +01:00
jgrusewski
397ccb9f13 test(integration): rewrite broker integration tests for cTrader OpenAPI migration
Replace FIX-protocol-based integration tests with tests using real cTrader
types (ICMarketsConfig, TradingOrder, BrokerInterface). All 21 tests pass:
broker_failover (5), icmarkets_validation (10), order_lifecycle (6).

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