tyndale-ai-service/artifacts/exchanges/mexc.yaml

95 lines
2.9 KiB
YAML

# artifacts/exchange/mexc_exchange.yaml
source_file: exchange/mexc.py
schema_version: v1.1
factual_summary: >
Implements the exchange integration for the MEXC exchange, providing
authenticated REST and websocket connectivity for order execution and
exchange state monitoring. This module manages request signing, connection
setup, instrument discovery, and asynchronous processing of exchange events
using a shared base exchange abstraction.
methods:
- name: sign_rest
signature: "(key, obj) -> MexcSignature"
description: >
Generates a REST API signature for authenticated requests by serializing
request data and producing a signed representation.
- name: sign_ws
signature: "() -> MexcSignature"
description: >
Generates a signature required for authenticated websocket connections
to the exchange.
- name: headers_for_sign
signature: "(s: MexcSignature) -> dict"
description: >
Constructs HTTP headers required for authenticated REST requests using
a previously generated signature.
- name: __init__
signature: "(trader, exchName) -> None"
description: >
Initializes the MEXC exchange instance, configures internal state tracking,
and starts background tasks required for exchange interaction.
- name: up
signature: "() -> None"
description: >
Establishes authenticated websocket and HTTP connections, retrieves
instrument information, and initializes exchange readiness state.
- name: run
signature: "() -> None"
description: >
Monitors websocket streams and asynchronous task queues, processes
incoming exchange events, and logs relevant operational information.
interpretive_summary: >
Serves as the execution-layer adapter for the MEXC exchange, encapsulating
all exchange-specific authentication, request signing, and connectivity
logic. This module isolates MEXC protocol and security requirements from
trading strategy and decision-making components, enabling consistent and
safer multi-exchange execution within the trading system.
invariants:
- Exchange authentication must be completed before private data is processed
- Request signing is required for all authenticated REST and websocket interactions
- Instrument information is fetched before the exchange is considered ready
- Exchange readiness state reflects user, trade, position, and instrument subsystems
tags:
domain:
- exchange_integration
- order_execution
trading_function:
- order_execution
- position_management
strategy_layer:
- execution
system_layer:
- engine
intent:
- abstraction
- isolation
- security
- observability
data_type:
- orders
- positions
- configs
risk:
- capital_loss
- latency
- exchange_ban
- security
maturity:
- production
provenance:
generated_at: 2026-02-02
generated_by: manual_from_docs
confidence_score: 0.77