ctrader-api-client 0.4.1__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/PKG-INFO +1 -1
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/pyproject.toml +1 -1
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/auth/manager.py +9 -9
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/client.py +7 -7
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/connection/heartbeat.py +3 -3
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/connection/protocol.py +1 -1
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/connection/transport.py +1 -1
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/events/router.py +9 -5
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/events/types.py +1 -1
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/events/test_emitter.py +8 -8
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/events/test_router.py +2 -2
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/events/test_types.py +4 -4
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/uv.lock +1 -1
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/.claude/settings.local.json +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/.github/workflows/docs.yml +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/.gitignore +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/.pre-commit-config.yaml +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/.python-version +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/Justfile +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/LICENSE +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/README.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/accounts.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/client.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/enums.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/events.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/market-data.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/models.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/symbols.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/api/trading.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/getting-started.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/docs/index.md +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/mkdocs.yml +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/SOURCE +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/VERSION +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/update.sh +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/vendor/OpenApiCommonMessages.proto +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/vendor/OpenApiCommonModelMessages.proto +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/vendor/OpenApiMessages.proto +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/vendor/OpenApiModelMessages.proto +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/scripts/fix_proto_imports.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/messages.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/proto/OpenApiCommonMessages.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/proto/OpenApiCommonModelMessages.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/proto/OpenApiMessages.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/proto/OpenApiModelMessages.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/proto/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/serialization.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/accounts.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/market_data.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/symbols.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/trading.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/auth/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/auth/credentials.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/config.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/connection/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/enums.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/events/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/events/emitter.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/exceptions.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/__init__.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/_base.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/account.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/deal.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/market_data.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/order.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/position.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/requests.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/symbol.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/py.typed +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/_internal/test_messages.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/_internal/test_serialization.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/api/conftest.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/api/test_accounts.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/api/test_market_data_api.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/api/test_symbols.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/api/test_trading.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/auth/test_credentials.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/auth/test_manager.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/connection/test_heartbeat.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/connection/test_protocol.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/connection/test_transport.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/models/test_account.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/models/test_deal.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/models/test_market_data.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/models/test_order.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/models/test_position.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/models/test_requests.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/models/test_symbol.py +0 -0
- {ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/test_client.py +0 -0
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/auth/manager.py
RENAMED
|
@@ -159,7 +159,7 @@ class AuthManager:
|
|
|
159
159
|
APIError: If authentication fails.
|
|
160
160
|
CTraderConnectionTimeoutError: If request times out.
|
|
161
161
|
"""
|
|
162
|
-
logger.
|
|
162
|
+
logger.debug("Authenticating application")
|
|
163
163
|
|
|
164
164
|
request = ProtoOAApplicationAuthReq(
|
|
165
165
|
client_id=self._client_id,
|
|
@@ -175,7 +175,7 @@ class AuthManager:
|
|
|
175
175
|
)
|
|
176
176
|
|
|
177
177
|
self._app_authenticated = True
|
|
178
|
-
logger.
|
|
178
|
+
logger.debug("Application authenticated successfully")
|
|
179
179
|
return response
|
|
180
180
|
|
|
181
181
|
async def authenticate_account(
|
|
@@ -200,9 +200,9 @@ class AuthManager:
|
|
|
200
200
|
CTraderConnectionTimeoutError: If request times out.
|
|
201
201
|
"""
|
|
202
202
|
if reauth:
|
|
203
|
-
logger.
|
|
203
|
+
logger.debug("Re-authenticating account %d", credentials.account_id)
|
|
204
204
|
else:
|
|
205
|
-
logger.
|
|
205
|
+
logger.debug("Authenticating account %d", credentials.account_id)
|
|
206
206
|
|
|
207
207
|
request = ProtoOAAccountAuthReq(
|
|
208
208
|
ctid_trader_account_id=credentials.account_id,
|
|
@@ -219,7 +219,7 @@ class AuthManager:
|
|
|
219
219
|
|
|
220
220
|
# Store credentials for refresh monitoring
|
|
221
221
|
self._accounts[credentials.account_id] = credentials
|
|
222
|
-
logger.
|
|
222
|
+
logger.debug("Account %d authenticated successfully", credentials.account_id)
|
|
223
223
|
|
|
224
224
|
# Notify callback
|
|
225
225
|
if self._on_account_ready is not None:
|
|
@@ -339,7 +339,7 @@ class AuthManager:
|
|
|
339
339
|
APIError: If authentication fails.
|
|
340
340
|
CTraderConnectionTimeoutError: If request times out.
|
|
341
341
|
"""
|
|
342
|
-
logger.
|
|
342
|
+
logger.debug("Authenticating by trader login %d", trader_login)
|
|
343
343
|
|
|
344
344
|
# Resolve trader_login to account_id
|
|
345
345
|
account_id = await self.resolve_account_id(access_token, trader_login, timeout=timeout)
|
|
@@ -368,7 +368,7 @@ class AuthManager:
|
|
|
368
368
|
"""
|
|
369
369
|
if account_id in self._accounts:
|
|
370
370
|
del self._accounts[account_id]
|
|
371
|
-
logger.
|
|
371
|
+
logger.debug("Account %d removed from auth manager", account_id)
|
|
372
372
|
return True
|
|
373
373
|
return False
|
|
374
374
|
|
|
@@ -417,7 +417,7 @@ class AuthManager:
|
|
|
417
417
|
continue
|
|
418
418
|
|
|
419
419
|
if credentials.expires_soon(self._refresh_buffer):
|
|
420
|
-
logger.
|
|
420
|
+
logger.debug(
|
|
421
421
|
"Token for account %d expires soon (%.0fs remaining), refreshing",
|
|
422
422
|
account_id,
|
|
423
423
|
credentials.time_until_expiry(),
|
|
@@ -481,7 +481,7 @@ class AuthManager:
|
|
|
481
481
|
)
|
|
482
482
|
self._accounts[account_id] = new_credentials
|
|
483
483
|
|
|
484
|
-
logger.
|
|
484
|
+
logger.debug(
|
|
485
485
|
"Token refreshed for account %d, new expiry in %ds",
|
|
486
486
|
account_id,
|
|
487
487
|
response.expires_in,
|
|
@@ -257,7 +257,7 @@ class CTraderClient:
|
|
|
257
257
|
if self._connected:
|
|
258
258
|
return
|
|
259
259
|
|
|
260
|
-
logger.
|
|
260
|
+
logger.debug("Connecting to %s:%d", self._config.host, self._config.port)
|
|
261
261
|
|
|
262
262
|
await self._transport.connect()
|
|
263
263
|
await self._protocol.start()
|
|
@@ -266,7 +266,7 @@ class CTraderClient:
|
|
|
266
266
|
self._router.start()
|
|
267
267
|
|
|
268
268
|
self._connected = True
|
|
269
|
-
logger.info("Connected
|
|
269
|
+
logger.info("Connected to cTrader server at %s:%d", self._config.host, self._config.port)
|
|
270
270
|
|
|
271
271
|
async def close(self) -> None:
|
|
272
272
|
"""Close the connection and clean up resources.
|
|
@@ -277,7 +277,7 @@ class CTraderClient:
|
|
|
277
277
|
if not self._connected:
|
|
278
278
|
return
|
|
279
279
|
|
|
280
|
-
logger.
|
|
280
|
+
logger.debug("Closing connection")
|
|
281
281
|
|
|
282
282
|
self._router.stop()
|
|
283
283
|
await self._auth.stop()
|
|
@@ -286,7 +286,7 @@ class CTraderClient:
|
|
|
286
286
|
await self._transport.close()
|
|
287
287
|
|
|
288
288
|
self._connected = False
|
|
289
|
-
logger.
|
|
289
|
+
logger.debug("Connection closed")
|
|
290
290
|
|
|
291
291
|
async def _emit_ready_event(self, account_id: int, is_reconnect: bool, is_reauth: bool) -> None:
|
|
292
292
|
"""Emit ReadyEvent when an account is authenticated.
|
|
@@ -313,7 +313,7 @@ class CTraderClient:
|
|
|
313
313
|
the app and all previously authenticated accounts, then emits
|
|
314
314
|
a ReconnectedEvent so users can restore subscriptions.
|
|
315
315
|
"""
|
|
316
|
-
logger.
|
|
316
|
+
logger.debug("Connection restored, re-authenticating...")
|
|
317
317
|
|
|
318
318
|
# Restart heartbeat monitoring
|
|
319
319
|
await self._heartbeat.restart()
|
|
@@ -325,7 +325,7 @@ class CTraderClient:
|
|
|
325
325
|
try:
|
|
326
326
|
await self._auth.authenticate_app()
|
|
327
327
|
app_auth_restored = True
|
|
328
|
-
logger.
|
|
328
|
+
logger.debug("App re-authenticated successfully")
|
|
329
329
|
except Exception as e:
|
|
330
330
|
logger.error("Failed to re-authenticate app after reconnect: %s", e)
|
|
331
331
|
app_auth_restored = False
|
|
@@ -344,7 +344,7 @@ class CTraderClient:
|
|
|
344
344
|
try:
|
|
345
345
|
await self._auth.authenticate_account(credentials, reconnect=True)
|
|
346
346
|
restored.append(account_id)
|
|
347
|
-
logger.
|
|
347
|
+
logger.debug("Re-authenticated account %d", account_id)
|
|
348
348
|
except Exception as e:
|
|
349
349
|
logger.error("Failed to re-authenticate account %d: %s", account_id, e)
|
|
350
350
|
failed.append((account_id, str(e)))
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/connection/heartbeat.py
RENAMED
|
@@ -56,7 +56,7 @@ class HeartbeatManager:
|
|
|
56
56
|
self._task_group = anyio.create_task_group()
|
|
57
57
|
await self._task_group.__aenter__()
|
|
58
58
|
self._task_group.start_soon(self._heartbeat_loop)
|
|
59
|
-
logger.
|
|
59
|
+
logger.debug("Heartbeat monitor started (interval=%.1fs, timeout=%.1fs)", self._interval, self._timeout)
|
|
60
60
|
|
|
61
61
|
async def stop(self) -> None:
|
|
62
62
|
"""Stop heartbeat monitoring.
|
|
@@ -67,7 +67,7 @@ class HeartbeatManager:
|
|
|
67
67
|
self._task_scope.cancel()
|
|
68
68
|
|
|
69
69
|
if self._task_group is not None:
|
|
70
|
-
logger.
|
|
70
|
+
logger.debug("Heartbeat monitor stopped")
|
|
71
71
|
self._task_group.cancel_scope.cancel()
|
|
72
72
|
try:
|
|
73
73
|
await self._task_group.__aexit__(None, None, None)
|
|
@@ -87,7 +87,7 @@ class HeartbeatManager:
|
|
|
87
87
|
self._last_received = time.monotonic()
|
|
88
88
|
if self._task_group is not None:
|
|
89
89
|
self._task_group.start_soon(self._heartbeat_loop)
|
|
90
|
-
logger.
|
|
90
|
+
logger.debug("Heartbeat monitor restarted")
|
|
91
91
|
|
|
92
92
|
async def _record_activity(self, _message: betterproto.Message) -> None:
|
|
93
93
|
"""Reset the inactivity timer on any received server message."""
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/connection/transport.py
RENAMED
|
@@ -83,7 +83,7 @@ class Transport:
|
|
|
83
83
|
raise CTraderConnectionFailedError(self._host, self._port, e) from e
|
|
84
84
|
|
|
85
85
|
if self._ssl:
|
|
86
|
-
logger.
|
|
86
|
+
logger.debug("Connected to %s:%d with SSL", self._host, self._port)
|
|
87
87
|
else:
|
|
88
88
|
logger.warning("Connected to %s:%d without SSL (plaintext)", self._host, self._port)
|
|
89
89
|
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/events/router.py
RENAMED
|
@@ -136,7 +136,7 @@ class EventRouter:
|
|
|
136
136
|
)
|
|
137
137
|
|
|
138
138
|
self._started = True
|
|
139
|
-
logger.
|
|
139
|
+
logger.debug("Event router started")
|
|
140
140
|
|
|
141
141
|
def stop(self) -> None:
|
|
142
142
|
"""Idempotent. Unregister all proto event handlers."""
|
|
@@ -172,7 +172,7 @@ class EventRouter:
|
|
|
172
172
|
)
|
|
173
173
|
|
|
174
174
|
self._started = False
|
|
175
|
-
logger.
|
|
175
|
+
logger.debug("Event router stopped")
|
|
176
176
|
|
|
177
177
|
# -------------------------------------------------------------------------
|
|
178
178
|
# Proto to Event Converters
|
|
@@ -180,15 +180,19 @@ class EventRouter:
|
|
|
180
180
|
|
|
181
181
|
async def _handle_spot(self, proto: ProtoOASpotEvent) -> None:
|
|
182
182
|
"""Convert ProtoOASpotEvent to SpotEvent."""
|
|
183
|
+
|
|
184
|
+
# I don't trust the API
|
|
185
|
+
if proto.trendbar is None:
|
|
186
|
+
trendbars = [] # type: ignore[unreachable]
|
|
187
|
+
else:
|
|
188
|
+
trendbars = [Trendbar.from_proto(tb, bid_price=Decimal(proto.bid)) for tb in proto.trendbar]
|
|
183
189
|
event = SpotEvent(
|
|
184
190
|
account_id=proto.ctid_trader_account_id,
|
|
185
191
|
symbol_id=proto.symbol_id,
|
|
186
192
|
bid=proto.bid / Decimal(100000) if proto.bid else None,
|
|
187
193
|
ask=proto.ask / Decimal(100000) if proto.ask else None,
|
|
188
194
|
timestamp=self._timestamp_to_datetime(proto.timestamp) if proto.timestamp else datetime.now(UTC),
|
|
189
|
-
trendbar=
|
|
190
|
-
Trendbar.from_proto(proto.trendbar[0], bid_price=Decimal(str(proto.bid))) if proto.trendbar else None
|
|
191
|
-
),
|
|
195
|
+
trendbar=trendbars,
|
|
192
196
|
)
|
|
193
197
|
await self._emitter.emit(event)
|
|
194
198
|
|
|
@@ -143,7 +143,7 @@ class TestEventEmitterEmit:
|
|
|
143
143
|
symbol_id=1,
|
|
144
144
|
bid=Decimal("1.23000"),
|
|
145
145
|
ask=Decimal("1.23050"),
|
|
146
|
-
trendbar=
|
|
146
|
+
trendbar=[],
|
|
147
147
|
timestamp=datetime.now(UTC),
|
|
148
148
|
)
|
|
149
149
|
await emitter.emit(event)
|
|
@@ -164,7 +164,7 @@ class TestEventEmitterEmit:
|
|
|
164
164
|
symbol_id=1,
|
|
165
165
|
bid=Decimal("1.23000"),
|
|
166
166
|
ask=Decimal("1.23050"),
|
|
167
|
-
trendbar=
|
|
167
|
+
trendbar=[],
|
|
168
168
|
timestamp=datetime.now(UTC),
|
|
169
169
|
)
|
|
170
170
|
await emitter.emit(event)
|
|
@@ -185,7 +185,7 @@ class TestEventEmitterEmit:
|
|
|
185
185
|
symbol_id=2,
|
|
186
186
|
bid=Decimal("1.23000"),
|
|
187
187
|
ask=Decimal("1.23050"),
|
|
188
|
-
trendbar=
|
|
188
|
+
trendbar=[],
|
|
189
189
|
timestamp=datetime.now(UTC),
|
|
190
190
|
)
|
|
191
191
|
await emitter.emit(event)
|
|
@@ -205,7 +205,7 @@ class TestEventEmitterEmit:
|
|
|
205
205
|
symbol_id=1,
|
|
206
206
|
bid=Decimal("1.23000"),
|
|
207
207
|
ask=Decimal("1.23050"),
|
|
208
|
-
trendbar=
|
|
208
|
+
trendbar=[],
|
|
209
209
|
timestamp=datetime.now(UTC),
|
|
210
210
|
)
|
|
211
211
|
await emitter.emit(event)
|
|
@@ -236,7 +236,7 @@ class TestEventEmitterEmit:
|
|
|
236
236
|
symbol_id=1,
|
|
237
237
|
bid=Decimal("1.23000"),
|
|
238
238
|
ask=Decimal("1.23050"),
|
|
239
|
-
trendbar=
|
|
239
|
+
trendbar=[],
|
|
240
240
|
timestamp=datetime.now(UTC),
|
|
241
241
|
)
|
|
242
242
|
await emitter.emit(event)
|
|
@@ -262,7 +262,7 @@ class TestEventEmitterErrorHandling:
|
|
|
262
262
|
symbol_id=1,
|
|
263
263
|
bid=Decimal("1.23000"),
|
|
264
264
|
ask=Decimal("1.23050"),
|
|
265
|
-
trendbar=
|
|
265
|
+
trendbar=[],
|
|
266
266
|
timestamp=datetime.now(UTC),
|
|
267
267
|
)
|
|
268
268
|
await emitter.emit(event)
|
|
@@ -286,7 +286,7 @@ class TestEventEmitterErrorHandling:
|
|
|
286
286
|
symbol_id=1,
|
|
287
287
|
bid=Decimal("1.23000"),
|
|
288
288
|
ask=Decimal("1.23050"),
|
|
289
|
-
trendbar=
|
|
289
|
+
trendbar=[],
|
|
290
290
|
timestamp=datetime.now(UTC),
|
|
291
291
|
)
|
|
292
292
|
await emitter.emit(event)
|
|
@@ -311,7 +311,7 @@ class TestEventEmitterErrorHandling:
|
|
|
311
311
|
symbol_id=1,
|
|
312
312
|
bid=Decimal("1.23000"),
|
|
313
313
|
ask=Decimal("1.23050"),
|
|
314
|
-
trendbar=
|
|
314
|
+
trendbar=[],
|
|
315
315
|
timestamp=datetime.now(UTC),
|
|
316
316
|
)
|
|
317
317
|
|
|
@@ -113,7 +113,7 @@ class TestSpotEventConversion:
|
|
|
113
113
|
assert event.symbol_id == 1
|
|
114
114
|
assert event.bid == Decimal("1.23") # 123000 / 1e5
|
|
115
115
|
assert event.ask == Decimal("1.2305") # 123050 / 1e5
|
|
116
|
-
assert event.trendbar
|
|
116
|
+
assert len(event.trendbar) == 0
|
|
117
117
|
assert event.timestamp == datetime(2021, 1, 1, 0, 0, 0, tzinfo=UTC)
|
|
118
118
|
|
|
119
119
|
@pytest.mark.anyio
|
|
@@ -140,7 +140,7 @@ class TestSpotEventConversion:
|
|
|
140
140
|
assert len(received_events) == 1
|
|
141
141
|
assert received_events[0].bid is None
|
|
142
142
|
assert received_events[0].ask is None
|
|
143
|
-
assert received_events[0].trendbar
|
|
143
|
+
assert len(received_events[0].trendbar) == 0
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
class TestExecutionEventConversion:
|
|
@@ -34,7 +34,7 @@ class TestSpotEvent:
|
|
|
34
34
|
symbol_id=1,
|
|
35
35
|
bid=Decimal("1.23000"),
|
|
36
36
|
ask=Decimal("1.23050"),
|
|
37
|
-
trendbar=
|
|
37
|
+
trendbar=[],
|
|
38
38
|
timestamp=timestamp,
|
|
39
39
|
)
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ class TestSpotEvent:
|
|
|
42
42
|
assert event.symbol_id == 1
|
|
43
43
|
assert event.bid == Decimal("1.23000")
|
|
44
44
|
assert event.ask == Decimal("1.23050")
|
|
45
|
-
assert event.trendbar
|
|
45
|
+
assert len(event.trendbar) == 0
|
|
46
46
|
assert event.timestamp == timestamp
|
|
47
47
|
|
|
48
48
|
def test_spot_event_is_frozen(self) -> None:
|
|
@@ -52,7 +52,7 @@ class TestSpotEvent:
|
|
|
52
52
|
symbol_id=1,
|
|
53
53
|
bid=Decimal("1.23000"),
|
|
54
54
|
ask=Decimal("1.23050"),
|
|
55
|
-
trendbar=
|
|
55
|
+
trendbar=[],
|
|
56
56
|
timestamp=datetime.now(UTC),
|
|
57
57
|
)
|
|
58
58
|
|
|
@@ -66,7 +66,7 @@ class TestSpotEvent:
|
|
|
66
66
|
symbol_id=1,
|
|
67
67
|
bid=None,
|
|
68
68
|
ask=None,
|
|
69
|
-
trendbar=
|
|
69
|
+
trendbar=[],
|
|
70
70
|
timestamp=datetime.now(UTC),
|
|
71
71
|
)
|
|
72
72
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/vendor/OpenApiCommonMessages.proto
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/vendor/OpenApiCommonModelMessages.proto
RENAMED
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/protos/vendor/OpenApiModelMessages.proto
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/__init__.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/_internal/messages.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/__init__.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/accounts.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/api/market_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/auth/__init__.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/auth/credentials.py
RENAMED
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/connection/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/events/__init__.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/events/emitter.py
RENAMED
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/__init__.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/_base.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/account.py
RENAMED
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/market_data.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/order.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/position.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/requests.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/src/ctrader_api_client/models/symbol.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/_internal/test_serialization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/api/test_market_data_api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/connection/test_heartbeat.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/connection/test_protocol.py
RENAMED
|
File without changes
|
{ctrader_api_client-0.4.1 → ctrader_api_client-0.4.3}/tests/unit/connection/test_transport.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|