@zeitvu97/cms-sdk 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +478 -0
- package/dist/chunks/_shared-48T7q0V3.js +26 -0
- package/dist/chunks/_shared-48T7q0V3.js.map +1 -0
- package/dist/chunks/auth.constant-DO7ZmsKg.js +68 -0
- package/dist/chunks/auth.constant-DO7ZmsKg.js.map +1 -0
- package/dist/chunks/mt5Retcode-DlZLQOLA.js +178 -0
- package/dist/chunks/mt5Retcode-DlZLQOLA.js.map +1 -0
- package/dist/chunks/storage.constant--64BDSPW.js +44 -0
- package/dist/chunks/storage.constant--64BDSPW.js.map +1 -0
- package/dist/common/constants/auth.constant.d.ts +54 -0
- package/dist/common/constants/auth.constant.d.ts.map +1 -0
- package/dist/common/constants/bars.constant.d.ts +15 -0
- package/dist/common/constants/bars.constant.d.ts.map +1 -0
- package/dist/common/constants/content-types.constant.d.ts +29 -0
- package/dist/common/constants/content-types.constant.d.ts.map +1 -0
- package/dist/common/constants/content.constant.d.ts +114 -0
- package/dist/common/constants/content.constant.d.ts.map +1 -0
- package/dist/common/constants/executions.constant.d.ts +56 -0
- package/dist/common/constants/executions.constant.d.ts.map +1 -0
- package/dist/common/constants/gov.constant.d.ts +118 -0
- package/dist/common/constants/gov.constant.d.ts.map +1 -0
- package/dist/common/constants/history.constant.d.ts +108 -0
- package/dist/common/constants/history.constant.d.ts.map +1 -0
- package/dist/common/constants/http.constant.d.ts +46 -0
- package/dist/common/constants/http.constant.d.ts.map +1 -0
- package/dist/common/constants/index.d.ts +16 -0
- package/dist/common/constants/index.d.ts.map +1 -0
- package/dist/common/constants/kalshi.constant.d.ts +35 -0
- package/dist/common/constants/kalshi.constant.d.ts.map +1 -0
- package/dist/common/constants/llm.constant.d.ts +37 -0
- package/dist/common/constants/llm.constant.d.ts.map +1 -0
- package/dist/common/constants/mt5-action.constant.d.ts +131 -0
- package/dist/common/constants/mt5-action.constant.d.ts.map +1 -0
- package/dist/common/constants/mt5.constant.d.ts +254 -0
- package/dist/common/constants/mt5.constant.d.ts.map +1 -0
- package/dist/common/constants/notifications.constant.d.ts +45 -0
- package/dist/common/constants/notifications.constant.d.ts.map +1 -0
- package/dist/common/constants/people.constant.d.ts +269 -0
- package/dist/common/constants/people.constant.d.ts.map +1 -0
- package/dist/common/constants/rules.constant.d.ts +14 -0
- package/dist/common/constants/rules.constant.d.ts.map +1 -0
- package/dist/common/constants/settings.constant.d.ts +17 -0
- package/dist/common/constants/settings.constant.d.ts.map +1 -0
- package/dist/common/constants/sort.constant.d.ts +14 -0
- package/dist/common/constants/sort.constant.d.ts.map +1 -0
- package/dist/common/constants/storage.constant.d.ts +74 -0
- package/dist/common/constants/storage.constant.d.ts.map +1 -0
- package/dist/common/helpers/format.d.ts +7 -0
- package/dist/common/helpers/format.d.ts.map +1 -0
- package/dist/common/helpers/format.js +20 -0
- package/dist/common/helpers/format.js.map +1 -0
- package/dist/common/helpers/mt5Retcode.d.ts +18 -0
- package/dist/common/helpers/mt5Retcode.d.ts.map +1 -0
- package/dist/common/helpers/mt5Retcode.js +2 -0
- package/dist/common/helpers/mt5Retcode.js.map +1 -0
- package/dist/common/utils/case.d.ts +12 -0
- package/dist/common/utils/case.d.ts.map +1 -0
- package/dist/common/utils/clone.d.ts +9 -0
- package/dist/common/utils/clone.d.ts.map +1 -0
- package/dist/composables/cbsStateKey.d.ts +27 -0
- package/dist/composables/cbsStateKey.d.ts.map +1 -0
- package/dist/core/createApi.d.ts +69 -0
- package/dist/core/createApi.d.ts.map +1 -0
- package/dist/core/createCmsSDK.d.ts +19 -0
- package/dist/core/createCmsSDK.d.ts.map +1 -0
- package/dist/core/credentials/TokenManager.d.ts +38 -0
- package/dist/core/credentials/TokenManager.d.ts.map +1 -0
- package/dist/core/credentials/credential.type.d.ts +16 -0
- package/dist/core/credentials/credential.type.d.ts.map +1 -0
- package/dist/core/credentials/resolveStorage.d.ts +6 -0
- package/dist/core/credentials/resolveStorage.d.ts.map +1 -0
- package/dist/core/credentials/storages/cookieStorage.d.ts +18 -0
- package/dist/core/credentials/storages/cookieStorage.d.ts.map +1 -0
- package/dist/core/credentials/storages/localStorageAdapter.d.ts +8 -0
- package/dist/core/credentials/storages/localStorageAdapter.d.ts.map +1 -0
- package/dist/core/credentials/storages/memoryStorage.d.ts +7 -0
- package/dist/core/credentials/storages/memoryStorage.d.ts.map +1 -0
- package/dist/core/errors.d.ts +26 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/sdk.type.d.ts +115 -0
- package/dist/core/sdk.type.d.ts.map +1 -0
- package/dist/core/ws/createEaeraWebSocket.d.ts +21 -0
- package/dist/core/ws/createEaeraWebSocket.d.ts.map +1 -0
- package/dist/core/ws/index.d.ts +4 -0
- package/dist/core/ws/index.d.ts.map +1 -0
- package/dist/core/ws/ws.constants.d.ts +246 -0
- package/dist/core/ws/ws.constants.d.ts.map +1 -0
- package/dist/core/ws/ws.events.d.ts +264 -0
- package/dist/core/ws/ws.events.d.ts.map +1 -0
- package/dist/core/ws/ws.type.d.ts +225 -0
- package/dist/core/ws/ws.type.d.ts.map +1 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8416 -0
- package/dist/index.js.map +1 -0
- package/dist/nuxt.d.ts +49 -0
- package/dist/nuxt.d.ts.map +1 -0
- package/dist/nuxt.js +47 -0
- package/dist/nuxt.js.map +1 -0
- package/dist/runtime/plugin.d.ts +6 -0
- package/dist/runtime/plugin.js +188 -0
- package/dist/runtime/plugin.js.map +1 -0
- package/dist/server/auth/cbs-callback.post.js +42 -0
- package/dist/server/auth/cbs-callback.post.js.map +1 -0
- package/dist/server/auth/cbs-start.post.js +34 -0
- package/dist/server/auth/cbs-start.post.js.map +1 -0
- package/dist/server/auth/idp-callback.get.js +52 -0
- package/dist/server/auth/idp-callback.get.js.map +1 -0
- package/dist/server/auth/idp-link.post.js +38 -0
- package/dist/server/auth/idp-link.post.js.map +1 -0
- package/dist/server/auth/idp-login.get.js +42 -0
- package/dist/server/auth/idp-login.get.js.map +1 -0
- package/dist/server/auth/idp-unlink.delete.js +38 -0
- package/dist/server/auth/idp-unlink.delete.js.map +1 -0
- package/dist/server/auth/login.post.js +42 -0
- package/dist/server/auth/login.post.js.map +1 -0
- package/dist/server/auth/logout.post.js +31 -0
- package/dist/server/auth/logout.post.js.map +1 -0
- package/dist/server/auth/refresh.post.js +46 -0
- package/dist/server/auth/refresh.post.js.map +1 -0
- package/dist/server/clear-token.delete.js +12 -0
- package/dist/server/clear-token.delete.js.map +1 -0
- package/dist/server/persist.post.js +31 -0
- package/dist/server/persist.post.js.map +1 -0
- package/dist/server/set-token.post.js +27 -0
- package/dist/server/set-token.post.js.map +1 -0
- package/dist/services/auth/auth.type.d.ts +66 -0
- package/dist/services/auth/auth.type.d.ts.map +1 -0
- package/dist/services/auth/index.d.ts +127 -0
- package/dist/services/auth/index.d.ts.map +1 -0
- package/dist/services/auth/mock.d.ts +13 -0
- package/dist/services/auth/mock.d.ts.map +1 -0
- package/dist/services/bars/bars.type.d.ts +78 -0
- package/dist/services/bars/bars.type.d.ts.map +1 -0
- package/dist/services/bars/index.d.ts +24 -0
- package/dist/services/bars/index.d.ts.map +1 -0
- package/dist/services/bars/mock.d.ts +23 -0
- package/dist/services/bars/mock.d.ts.map +1 -0
- package/dist/services/content/content.type.d.ts +832 -0
- package/dist/services/content/content.type.d.ts.map +1 -0
- package/dist/services/content/filter.d.ts +46 -0
- package/dist/services/content/filter.d.ts.map +1 -0
- package/dist/services/content/index.d.ts +35 -0
- package/dist/services/content/index.d.ts.map +1 -0
- package/dist/services/content/mock.d.ts +16 -0
- package/dist/services/content/mock.d.ts.map +1 -0
- package/dist/services/content-types/content-types.type.d.ts +70 -0
- package/dist/services/content-types/content-types.type.d.ts.map +1 -0
- package/dist/services/content-types/index.d.ts +18 -0
- package/dist/services/content-types/index.d.ts.map +1 -0
- package/dist/services/content-types/mock.d.ts +15 -0
- package/dist/services/content-types/mock.d.ts.map +1 -0
- package/dist/services/executions/executions.type.d.ts +67 -0
- package/dist/services/executions/executions.type.d.ts.map +1 -0
- package/dist/services/executions/index.d.ts +30 -0
- package/dist/services/executions/index.d.ts.map +1 -0
- package/dist/services/executions/mock.d.ts +29 -0
- package/dist/services/executions/mock.d.ts.map +1 -0
- package/dist/services/gov/gov.type.d.ts +740 -0
- package/dist/services/gov/gov.type.d.ts.map +1 -0
- package/dist/services/gov/index.d.ts +84 -0
- package/dist/services/gov/index.d.ts.map +1 -0
- package/dist/services/history/history.type.d.ts +167 -0
- package/dist/services/history/history.type.d.ts.map +1 -0
- package/dist/services/history/index.d.ts +38 -0
- package/dist/services/history/index.d.ts.map +1 -0
- package/dist/services/history/mock.d.ts +21 -0
- package/dist/services/history/mock.d.ts.map +1 -0
- package/dist/services/kalshi/index.d.ts +19 -0
- package/dist/services/kalshi/index.d.ts.map +1 -0
- package/dist/services/kalshi/kalshi.type.d.ts +99 -0
- package/dist/services/kalshi/kalshi.type.d.ts.map +1 -0
- package/dist/services/kalshi/mock.d.ts +5 -0
- package/dist/services/kalshi/mock.d.ts.map +1 -0
- package/dist/services/llm/index.d.ts +38 -0
- package/dist/services/llm/index.d.ts.map +1 -0
- package/dist/services/llm/llm.type.d.ts +106 -0
- package/dist/services/llm/llm.type.d.ts.map +1 -0
- package/dist/services/notifications/index.d.ts +38 -0
- package/dist/services/notifications/index.d.ts.map +1 -0
- package/dist/services/notifications/mock.d.ts +39 -0
- package/dist/services/notifications/mock.d.ts.map +1 -0
- package/dist/services/notifications/notifications.type.d.ts +75 -0
- package/dist/services/notifications/notifications.type.d.ts.map +1 -0
- package/dist/services/people/_invoke.d.ts +26 -0
- package/dist/services/people/_invoke.d.ts.map +1 -0
- package/dist/services/people/copilot/index.d.ts +132 -0
- package/dist/services/people/copilot/index.d.ts.map +1 -0
- package/dist/services/people/identity/actions.d.ts +116 -0
- package/dist/services/people/identity/actions.d.ts.map +1 -0
- package/dist/services/people/identity/ct.types.d.ts +133 -0
- package/dist/services/people/identity/ct.types.d.ts.map +1 -0
- package/dist/services/people/identity/index.d.ts +14 -0
- package/dist/services/people/identity/index.d.ts.map +1 -0
- package/dist/services/people/identity/projections.d.ts +63 -0
- package/dist/services/people/identity/projections.d.ts.map +1 -0
- package/dist/services/people/index.d.ts +31 -0
- package/dist/services/people/index.d.ts.map +1 -0
- package/dist/services/people/legal/actions.d.ts +161 -0
- package/dist/services/people/legal/actions.d.ts.map +1 -0
- package/dist/services/people/legal/ct.types.d.ts +186 -0
- package/dist/services/people/legal/ct.types.d.ts.map +1 -0
- package/dist/services/people/legal/index.d.ts +15 -0
- package/dist/services/people/legal/index.d.ts.map +1 -0
- package/dist/services/people/packops/index.d.ts +70 -0
- package/dist/services/people/packops/index.d.ts.map +1 -0
- package/dist/services/people/packops/packops.type.d.ts +183 -0
- package/dist/services/people/packops/packops.type.d.ts.map +1 -0
- package/dist/services/people/perms/actions.d.ts +214 -0
- package/dist/services/people/perms/actions.d.ts.map +1 -0
- package/dist/services/people/perms/ct.types.d.ts +140 -0
- package/dist/services/people/perms/ct.types.d.ts.map +1 -0
- package/dist/services/people/perms/index.d.ts +14 -0
- package/dist/services/people/perms/index.d.ts.map +1 -0
- package/dist/services/people/perms/projections.d.ts +47 -0
- package/dist/services/people/perms/projections.d.ts.map +1 -0
- package/dist/services/people/process/actions.d.ts +154 -0
- package/dist/services/people/process/actions.d.ts.map +1 -0
- package/dist/services/people/process/ct.types.d.ts +304 -0
- package/dist/services/people/process/ct.types.d.ts.map +1 -0
- package/dist/services/people/process/index.d.ts +12 -0
- package/dist/services/people/process/index.d.ts.map +1 -0
- package/dist/services/people/shared.types.d.ts +36 -0
- package/dist/services/people/shared.types.d.ts.map +1 -0
- package/dist/services/rules/conditions.d.ts +264 -0
- package/dist/services/rules/conditions.d.ts.map +1 -0
- package/dist/services/rules/index.d.ts +49 -0
- package/dist/services/rules/index.d.ts.map +1 -0
- package/dist/services/rules/llm-rule.constant.d.ts +84 -0
- package/dist/services/rules/llm-rule.constant.d.ts.map +1 -0
- package/dist/services/rules/mock.d.ts +20 -0
- package/dist/services/rules/mock.d.ts.map +1 -0
- package/dist/services/rules/rules.type.d.ts +262 -0
- package/dist/services/rules/rules.type.d.ts.map +1 -0
- package/dist/services/rules/triggers.d.ts +140 -0
- package/dist/services/rules/triggers.d.ts.map +1 -0
- package/dist/services/settings/index.d.ts +36 -0
- package/dist/services/settings/index.d.ts.map +1 -0
- package/dist/services/settings/mock.d.ts +14 -0
- package/dist/services/settings/mock.d.ts.map +1 -0
- package/dist/services/settings/settings.type.d.ts +39 -0
- package/dist/services/settings/settings.type.d.ts.map +1 -0
- package/dist/stores/auth.d.ts +192 -0
- package/dist/stores/auth.d.ts.map +1 -0
- package/dist/stores/bars.d.ts +288 -0
- package/dist/stores/bars.d.ts.map +1 -0
- package/dist/stores/content.d.ts +4101 -0
- package/dist/stores/content.d.ts.map +1 -0
- package/dist/stores/executions.d.ts +249 -0
- package/dist/stores/executions.d.ts.map +1 -0
- package/dist/stores/gov.d.ts +238 -0
- package/dist/stores/gov.d.ts.map +1 -0
- package/dist/stores/history.d.ts +833 -0
- package/dist/stores/history.d.ts.map +1 -0
- package/dist/stores/index.d.ts +15 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/kalshi.d.ts +728 -0
- package/dist/stores/kalshi.d.ts.map +1 -0
- package/dist/stores/llm-providers.d.ts +97 -0
- package/dist/stores/llm-providers.d.ts.map +1 -0
- package/dist/stores/llm.d.ts +102 -0
- package/dist/stores/llm.d.ts.map +1 -0
- package/dist/stores/people.d.ts +596 -0
- package/dist/stores/people.d.ts.map +1 -0
- package/dist/stores/persist.d.ts +58 -0
- package/dist/stores/persist.d.ts.map +1 -0
- package/dist/stores/rules.d.ts +485 -0
- package/dist/stores/rules.d.ts.map +1 -0
- package/dist/stores/settings.d.ts +36 -0
- package/dist/stores/settings.d.ts.map +1 -0
- package/dist/stores/ws.d.ts +66 -0
- package/dist/stores/ws.d.ts.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
import { MT5AccountStatus, MT5ChartBarSource, MT5CommissionMode, MT5CommissionVolumeType, MT5DealEntry, MT5ExecutionMode, MT5Interval, MT5MarketStatus, MT5OrderKind, MT5OrderStateName, MT5ServerState, MT5SyncPhase, MT5TradeMode, MT5TradeSide, KalshiFutureStatus, KalshiLifecycleStatus, KalshiServerStatus, KalshiSettlementResult } from '../../common/constants/mt5.constant';
|
|
2
|
+
import { SerializationFormat } from '../../common/constants/http.constant';
|
|
3
|
+
import { WS_EVENT_NAME } from '../../core/ws/ws.events';
|
|
4
|
+
/** CMS content item envelope. CT-specific fields live under `data`;
|
|
5
|
+
* `status` is the lifecycle field (draft/published/deleted). No `state`. */
|
|
6
|
+
export interface ContentItem<T = Record<string, unknown>> {
|
|
7
|
+
id: number;
|
|
8
|
+
uuid: string;
|
|
9
|
+
/** e.g. `"Mt5Account"`, `"LlmConversation"`. */
|
|
10
|
+
typeName: string;
|
|
11
|
+
data: T;
|
|
12
|
+
/** Lifecycle field: `"draft"` | `"published"` | `"deleted"` | CT-specific. */
|
|
13
|
+
status: string;
|
|
14
|
+
slug?: string | null;
|
|
15
|
+
version?: number;
|
|
16
|
+
parentId?: number | null;
|
|
17
|
+
sortOrder?: number;
|
|
18
|
+
/** ISO 8601. */
|
|
19
|
+
publishedAt?: string | null;
|
|
20
|
+
createdBy?: number | null;
|
|
21
|
+
updatedBy?: number | null;
|
|
22
|
+
/** ISO 8601. */
|
|
23
|
+
createdAt?: string;
|
|
24
|
+
updatedAt?: string;
|
|
25
|
+
}
|
|
26
|
+
/** `ContentListResponse` → GET /api/v1/content (1-based page/perPage). */
|
|
27
|
+
export interface ContentListResponse<T> {
|
|
28
|
+
items: T[];
|
|
29
|
+
total: number;
|
|
30
|
+
page: number;
|
|
31
|
+
perPage: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `PaginatedResponse` → GET /api/v1/contents (plural, read-only query path).
|
|
35
|
+
* Kept for reference; the CRUD service does not use it.
|
|
36
|
+
*/
|
|
37
|
+
export interface PaginatedResponse<T> {
|
|
38
|
+
items: T[];
|
|
39
|
+
totalCount: number;
|
|
40
|
+
limit: number;
|
|
41
|
+
offset: number;
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
pageInfo: PageInfo;
|
|
44
|
+
}
|
|
45
|
+
export interface PageInfo {
|
|
46
|
+
currentPage: number;
|
|
47
|
+
totalPages: number;
|
|
48
|
+
perPage: number;
|
|
49
|
+
}
|
|
50
|
+
/** Query params for GET /api/v1/content (FastAPI Query() aliases). */
|
|
51
|
+
export interface ContentQuery {
|
|
52
|
+
type?: string;
|
|
53
|
+
status?: string;
|
|
54
|
+
packId?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Batch UUID lookup (`?uuids=a&uuids=b&uuids=c` on the wire — ofetch
|
|
57
|
+
* serializes `string[]` as repeated `uuids=` query params, which the
|
|
58
|
+
* FastAPI handler accepts at `eaera_cms/core/content/routes.py:354-389`).
|
|
59
|
+
* Combines with `type` / `status` / `packId`. Caller should pass
|
|
60
|
+
* `perPage >= uuids.length` so the response covers the requested set
|
|
61
|
+
* in one page.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Prefer the filter DSL with the `in` operator on a natural
|
|
64
|
+
* key (e.g. `buildFilter([{ field: 'data.symbol', op: 'in', value: [...] }])`)
|
|
65
|
+
* — uuids are unstable references for cross-session data and the
|
|
66
|
+
* `in` filter composes with the other query params.
|
|
67
|
+
*/
|
|
68
|
+
uuids?: string[];
|
|
69
|
+
/** 1-based. */
|
|
70
|
+
page?: number;
|
|
71
|
+
/** 1-100. */
|
|
72
|
+
perPage?: number;
|
|
73
|
+
format?: SerializationFormat;
|
|
74
|
+
/**
|
|
75
|
+
* Filter expression (eaera-cms DSL string). Field names use the JSONB
|
|
76
|
+
* key as stored in PG — for the Mt5* CTs this is snake_case
|
|
77
|
+
* (``data.symbol``, ``data.mt5_ts``, ``data.profit_loss`` …). The
|
|
78
|
+
* response converts to camelCase via the CMS middleware, but the
|
|
79
|
+
* filter expression must use the storage casing.
|
|
80
|
+
*
|
|
81
|
+
* Operators (see {@link CONTENT_FILTER_OPERATOR} for the full set):
|
|
82
|
+
* comparison ``eq`` ``neq`` ``gt`` ``gte`` ``lt`` ``lte``; list ``in``
|
|
83
|
+
* ``not_in`` ``between``; null-check ``is_null`` ``is_not_null``;
|
|
84
|
+
* text-pattern ``contains`` ``starts_with`` ``ends_with`` ``regex``
|
|
85
|
+
* ``like`` ``ilike``; JSONB ``json_contains`` ``json_has_key``
|
|
86
|
+
* ``json_type``. Boolean composition with ``AND``, ``OR``, ``NOT`` +
|
|
87
|
+
* parentheses. A value containing whitespace must be double-quoted
|
|
88
|
+
* (e.g. ``data.category:eq:"CFDs on Stocks"``).
|
|
89
|
+
*
|
|
90
|
+
* For scalar conditions prefer the {@link buildFilter} helper, which
|
|
91
|
+
* joins conditions with ``AND`` and quotes whitespace values
|
|
92
|
+
* automatically.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* filter: 'data.symbol:eq:EURUSD AND data.mt5_ts:gte:2026-07-01'
|
|
96
|
+
* @example
|
|
97
|
+
* filter: 'data.login:eq:200223 AND data.entry:eq:OUT AND data.profit_loss:gte:50'
|
|
98
|
+
* @example
|
|
99
|
+
* filter: 'data.symbol:contains:USD AND data.volume:gt:0'
|
|
100
|
+
* @example
|
|
101
|
+
* filter: 'data.category:eq:"CFDs on Stocks"'
|
|
102
|
+
*/
|
|
103
|
+
filter?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Sort field. Built-in columns: ``created_at``, ``updated_at``,
|
|
106
|
+
* ``sort_order``. JSONB leaves are addressed without the ``data.``
|
|
107
|
+
* prefix (the BE auto-prefixes): ``mt5_ts``, ``mt5_ts_open``,
|
|
108
|
+
* ``mt5_ts_setup``, ``profit_loss``, ``symbol``, ``volume`` …
|
|
109
|
+
* Falls back to ``created_at`` on unknown values.
|
|
110
|
+
*/
|
|
111
|
+
sortBy?: string;
|
|
112
|
+
/** Sort direction. Case-insensitive. Default: ``'desc'``. */
|
|
113
|
+
sortDirection?: 'asc' | 'desc';
|
|
114
|
+
/**
|
|
115
|
+
* Per-CT query params forwarded verbatim to the BE (`?serverName=...&userId=...`
|
|
116
|
+
* via ofetch). The Mt5* pack accepts dozens of JSONB-leaf filters
|
|
117
|
+
* (`symbol`, `isFavorites`, `tradeMode`, `marketStatus`, …) — typing each
|
|
118
|
+
* one here would defeat the point of a generic query shape.
|
|
119
|
+
*
|
|
120
|
+
* The HTTP layer (`sdk.content.list`) spreads this object as the second
|
|
121
|
+
* ofetch argument; ofetch serialises unknown keys as `?key=value` query
|
|
122
|
+
* params, which the FastAPI handler accepts.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* fetchByType('Mt5Symbol', { serverName: MT5_SERVER_NAME.EAERA, tradeMode: 'FULL' })
|
|
126
|
+
* fetchByType('Mt5Watchlist', { userId: 42, isFavorites: true })
|
|
127
|
+
*/
|
|
128
|
+
[key: string]: unknown;
|
|
129
|
+
}
|
|
130
|
+
/** POST /api/v1/content body (`ContentCreateRequest`). */
|
|
131
|
+
export interface ContentCreatePayload<T = Record<string, unknown>> {
|
|
132
|
+
typeName: string;
|
|
133
|
+
data: T;
|
|
134
|
+
/** Default `"draft"`. */
|
|
135
|
+
status?: string;
|
|
136
|
+
slug?: string | null;
|
|
137
|
+
parentId?: number | null;
|
|
138
|
+
}
|
|
139
|
+
/** PUT /api/v1/content/{uuid} body (`ContentUpdateRequest`). */
|
|
140
|
+
export interface ContentUpdatePayload<T = Record<string, unknown>> {
|
|
141
|
+
data?: Partial<T>;
|
|
142
|
+
slug?: string | null;
|
|
143
|
+
}
|
|
144
|
+
/** A CT action declared on a content type (entry in `availableActions`). */
|
|
145
|
+
export interface ContentAction {
|
|
146
|
+
/** actionName, e.g. `"change_group"`, `"change_leverage"`. */
|
|
147
|
+
name: string;
|
|
148
|
+
/** Display label. */
|
|
149
|
+
label: string;
|
|
150
|
+
/** Resolved codeRef, e.g. `eaera_mt5.handlers.operational:change_group`. */
|
|
151
|
+
handler: string;
|
|
152
|
+
}
|
|
153
|
+
/** GET /api/v1/content/{uuid}/actions → `AvailableActionsResponse`. */
|
|
154
|
+
export interface AvailableActionsResponse {
|
|
155
|
+
contentUuid: string;
|
|
156
|
+
typeName: string;
|
|
157
|
+
status: string;
|
|
158
|
+
availableActions: ContentAction[];
|
|
159
|
+
}
|
|
160
|
+
/** POST /api/v1/content/{uuid}/actions/{actionName} body → `ActionInvokeRequest`. */
|
|
161
|
+
export interface ActionInvokePayload {
|
|
162
|
+
/** Action-specific payload. The dashboard writes nested camelCase keys
|
|
163
|
+
* (`{ newGroup: 'demo\\Group' }`, `{ newLeverage: 50 }`); the CMS
|
|
164
|
+
* `CamelToSnakeMiddleware` (`eaera_cms/core/request_casing.py`)
|
|
165
|
+
* recursively converts them to `new_group` / `new_leverage` before the
|
|
166
|
+
* handler reads them. Both casings work end-to-end because of that
|
|
167
|
+
* middleware — keep the dashboard source on camelCase for consistency
|
|
168
|
+
* with the rule-execution params shape. See
|
|
169
|
+
* `risk-rules-api-guide.md` §4.C for the full table. */
|
|
170
|
+
params?: Record<string, unknown>;
|
|
171
|
+
/** Optional UUIDv4 idempotency token. */
|
|
172
|
+
intentionId?: string;
|
|
173
|
+
/** Optional optimistic-concurrency guard. */
|
|
174
|
+
expectedVersion?: number;
|
|
175
|
+
}
|
|
176
|
+
/** ActionResponse → POST /api/v1/content/{uuid}/actions/{actionName}. */
|
|
177
|
+
export interface ActionResponse {
|
|
178
|
+
success: boolean;
|
|
179
|
+
output?: Record<string, unknown>;
|
|
180
|
+
error?: string;
|
|
181
|
+
/** Top-level guard-rejection details (api_references §1/§9.1:
|
|
182
|
+
* `{success: false, error, details: [...]}` on the HTTP 200 path). */
|
|
183
|
+
details?: unknown[];
|
|
184
|
+
durationMs: number;
|
|
185
|
+
}
|
|
186
|
+
/** `Mt5Server` (`pack.yaml`) — FEAT-006 (monitored-group list source). */
|
|
187
|
+
export type ServerState = MT5ServerState;
|
|
188
|
+
export interface Mt5ServerData {
|
|
189
|
+
/** Required, unique — used as the group source key. */
|
|
190
|
+
name: string;
|
|
191
|
+
endpoint: string;
|
|
192
|
+
login: number;
|
|
193
|
+
/** Format: `aes-256-gcm`. */
|
|
194
|
+
passwordEncrypted: string;
|
|
195
|
+
state: ServerState;
|
|
196
|
+
syncIntervalSeconds: number;
|
|
197
|
+
statementIntervalSeconds: number;
|
|
198
|
+
tasksEnabled: string[];
|
|
199
|
+
/** FEAT-004 symbol selector source. */
|
|
200
|
+
fxPairs: string[];
|
|
201
|
+
health: Record<string, unknown>;
|
|
202
|
+
lastError?: string | null;
|
|
203
|
+
deployedVersion?: string | null;
|
|
204
|
+
/**
|
|
205
|
+
* Broker-side UTC offset in seconds (e.g. `7200` for UTC+2, `25200` for
|
|
206
|
+
* UTC+7, `-18000` for UTC-5). The BE always populates this on every
|
|
207
|
+
* `Mt5Server` row — per-deployment brokers ship their own timezone without
|
|
208
|
+
* a code change. The FE consumes this to configure chart timezone
|
|
209
|
+
* (replaces the previously hardcoded `+7` offset).
|
|
210
|
+
*/
|
|
211
|
+
serverTimeOffsetSeconds: number;
|
|
212
|
+
}
|
|
213
|
+
export type Mt5Server = ContentItem<Mt5ServerData>;
|
|
214
|
+
/** `Mt5Account` (`pack.yaml`) — FEAT-003 (group/login), FEAT-005 (name). */
|
|
215
|
+
export type AccountStatus = MT5AccountStatus;
|
|
216
|
+
export interface Mt5AccountData {
|
|
217
|
+
/** FK to `Mt5Server.name`. */
|
|
218
|
+
serverName: string;
|
|
219
|
+
login: number;
|
|
220
|
+
/** FEAT-005 detail dialog "full name". */
|
|
221
|
+
name: string;
|
|
222
|
+
email?: string | null;
|
|
223
|
+
/** FEAT-003/005 row + FEAT-006 monitored list. */
|
|
224
|
+
group: string;
|
|
225
|
+
leverage: number;
|
|
226
|
+
currency: string;
|
|
227
|
+
balance: number;
|
|
228
|
+
equity: number;
|
|
229
|
+
margin: number;
|
|
230
|
+
marginFree: number;
|
|
231
|
+
marginLevel: number;
|
|
232
|
+
profit: number;
|
|
233
|
+
floating: number;
|
|
234
|
+
status: AccountStatus;
|
|
235
|
+
inSync: boolean;
|
|
236
|
+
rights: number;
|
|
237
|
+
enable: boolean;
|
|
238
|
+
tags: string[];
|
|
239
|
+
lastDealId?: number | null;
|
|
240
|
+
calcStatus: string;
|
|
241
|
+
/**
|
|
242
|
+
* Derived at sync from FEAT-007 `setting.product.trading`
|
|
243
|
+
* (`prediction_account_groups` / prefixes). Pred FE filters `eq:true`.
|
|
244
|
+
*/
|
|
245
|
+
isPredictionAccount?: boolean;
|
|
246
|
+
}
|
|
247
|
+
export type Mt5Account = ContentItem<Mt5AccountData>;
|
|
248
|
+
/**
|
|
249
|
+
* `Mt5Group` — inventory §4.14 / FEAT-009.
|
|
250
|
+
* Identity: `(data.serverName, data.group)`. State: `active ↔ archived`.
|
|
251
|
+
* `Mt5Account.data.group` is the natural FK into this CT.
|
|
252
|
+
*/
|
|
253
|
+
export type Mt5GroupTradeRight = 'swaps' | 'trailing' | 'experts' | 'expiration' | 'signals_all' | 'signals_own' | 'so_compensation' | 'so_fully_hedged' | 'fifo_close' | 'hedge_prohibit' | 'deal_cost' | 'so_compensation_credit' | (string & {});
|
|
254
|
+
/**
|
|
255
|
+
* Commission tier (`IMTConCommTier`).
|
|
256
|
+
* `mode` / `type` use {@link MT5_COMMISSION_MODE} / {@link MT5_COMMISSION_VOLUME_TYPE}.
|
|
257
|
+
*/
|
|
258
|
+
export interface MT5ConCommTier {
|
|
259
|
+
mode?: MT5CommissionMode;
|
|
260
|
+
type?: MT5CommissionVolumeType;
|
|
261
|
+
value?: number;
|
|
262
|
+
minimal?: number;
|
|
263
|
+
maximal?: number;
|
|
264
|
+
rangeFrom?: number;
|
|
265
|
+
rangeTo?: number;
|
|
266
|
+
currency?: string;
|
|
267
|
+
modeLabel?: string;
|
|
268
|
+
typeLabel?: string;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Group commission config (`IMTConCommission`) under `Mt5Group.data.commissions`.
|
|
272
|
+
* Mode ints / labels are raw wire values (no enums yet).
|
|
273
|
+
* **Pred v1:** assume one commission + one tier → `commissions[0].tiers[0]`.
|
|
274
|
+
*/
|
|
275
|
+
export interface MT5ConCommission {
|
|
276
|
+
mode?: number;
|
|
277
|
+
name?: string;
|
|
278
|
+
path?: string;
|
|
279
|
+
tiers?: MT5ConCommTier[];
|
|
280
|
+
reasons?: string[];
|
|
281
|
+
entryMode?: number;
|
|
282
|
+
modeLabel?: string;
|
|
283
|
+
rangeMode?: number;
|
|
284
|
+
actionMode?: number;
|
|
285
|
+
chargeMode?: number;
|
|
286
|
+
profitMode?: number;
|
|
287
|
+
reasonFlags?: number;
|
|
288
|
+
entryModeLabel?: string;
|
|
289
|
+
rangeModeLabel?: string;
|
|
290
|
+
actionModeLabel?: string;
|
|
291
|
+
chargeModeLabel?: string;
|
|
292
|
+
profitModeLabel?: string;
|
|
293
|
+
}
|
|
294
|
+
export interface Mt5GroupData {
|
|
295
|
+
serverName: string;
|
|
296
|
+
/** Full backslash-delimited group path, e.g. `real\EAERA\Global\Prediction`. */
|
|
297
|
+
group: string;
|
|
298
|
+
currency: string;
|
|
299
|
+
serverId?: number;
|
|
300
|
+
currencyDigits?: number;
|
|
301
|
+
marginCall?: number;
|
|
302
|
+
marginStopOut?: number;
|
|
303
|
+
marginSoMode?: number;
|
|
304
|
+
marginSoModeLabel?: string;
|
|
305
|
+
marginFreeModeLabel?: string;
|
|
306
|
+
marginFreeProfitModeLabel?: string;
|
|
307
|
+
marginModeLabel?: string;
|
|
308
|
+
marginFlags?: number;
|
|
309
|
+
marginFloatingLeverage?: number | string;
|
|
310
|
+
demoLeverage?: number;
|
|
311
|
+
demoDeposit?: number;
|
|
312
|
+
demoInactivityPeriod?: number;
|
|
313
|
+
tradeFlags?: number;
|
|
314
|
+
/** Decoded trade rights — FE gating: `hedge_prohibit`, `fifo_close`, … */
|
|
315
|
+
tradeRights?: Mt5GroupTradeRight[];
|
|
316
|
+
tradeInterestrate?: number;
|
|
317
|
+
tradeVirtualCredit?: number;
|
|
318
|
+
tradeTransferModeLabel?: string;
|
|
319
|
+
limitHistoryLabel?: number | string;
|
|
320
|
+
limitOrders?: number;
|
|
321
|
+
limitPositions?: number;
|
|
322
|
+
limitSymbols?: number;
|
|
323
|
+
permissions?: string[];
|
|
324
|
+
authModeLabel?: string;
|
|
325
|
+
authOtpModeLabel?: string;
|
|
326
|
+
authPasswordMin?: number;
|
|
327
|
+
company?: string;
|
|
328
|
+
companyPage?: string;
|
|
329
|
+
companyEmail?: string;
|
|
330
|
+
companySupportPage?: string;
|
|
331
|
+
companySupportEmail?: string;
|
|
332
|
+
companyCatalog?: string;
|
|
333
|
+
companyDepositPage?: string;
|
|
334
|
+
companyWithdrawalPage?: string;
|
|
335
|
+
reportsModeLabel?: string;
|
|
336
|
+
reportsFlagModes?: unknown;
|
|
337
|
+
reportsSmtp?: string;
|
|
338
|
+
reportsEmail?: string;
|
|
339
|
+
newsModeLabel?: string;
|
|
340
|
+
newsCategory?: string;
|
|
341
|
+
newsLangs?: number[];
|
|
342
|
+
mailModeLabel?: string;
|
|
343
|
+
/**
|
|
344
|
+
* Group commission configs (`MT5ConCommission`).
|
|
345
|
+
* Pred v1: `commissions[0].tiers[0]` only (one commission + one tier).
|
|
346
|
+
*/
|
|
347
|
+
commissions?: MT5ConCommission[];
|
|
348
|
+
/** Raw `IMTConGroup` snapshot (secrets stripped). */
|
|
349
|
+
mt5RawConfig?: Record<string, unknown>;
|
|
350
|
+
lastSyncedAt?: string;
|
|
351
|
+
}
|
|
352
|
+
export type Mt5Group = ContentItem<Mt5GroupData>;
|
|
353
|
+
/**
|
|
354
|
+
* `Mt5SyncState` (`pack.yaml`) — per-server sync lifecycle. One row per
|
|
355
|
+
* serverName; updated by the mt5 worker as it processes statements/deals/ticks.
|
|
356
|
+
*
|
|
357
|
+
* Fields reflect mt5 data-design §2.6.
|
|
358
|
+
*/
|
|
359
|
+
export interface Mt5SyncStateData {
|
|
360
|
+
/** FK to `Mt5Server.data.name`. */
|
|
361
|
+
serverName: string;
|
|
362
|
+
/** Current sync strategy. */
|
|
363
|
+
syncMode: string;
|
|
364
|
+
/** High-level phase — UI shows this as the headline status. */
|
|
365
|
+
phase: MT5SyncPhase;
|
|
366
|
+
/** Per-type status + progress counters. */
|
|
367
|
+
accounts?: {
|
|
368
|
+
status: string;
|
|
369
|
+
processed: number;
|
|
370
|
+
total: number;
|
|
371
|
+
};
|
|
372
|
+
deals?: {
|
|
373
|
+
status: string;
|
|
374
|
+
processed: number;
|
|
375
|
+
total: number;
|
|
376
|
+
};
|
|
377
|
+
ticks?: {
|
|
378
|
+
status: string;
|
|
379
|
+
processed: number;
|
|
380
|
+
total: number;
|
|
381
|
+
};
|
|
382
|
+
daily?: {
|
|
383
|
+
status: string;
|
|
384
|
+
processed: number;
|
|
385
|
+
total: number;
|
|
386
|
+
};
|
|
387
|
+
/** Cursor / checkpoint (id of last processed record). */
|
|
388
|
+
checkpoint?: string;
|
|
389
|
+
/** ISO 8601. */
|
|
390
|
+
startedAt?: string | null;
|
|
391
|
+
completedAt?: string | null;
|
|
392
|
+
/** Last error string (if phase === 'failed'). */
|
|
393
|
+
lastError?: string | null;
|
|
394
|
+
}
|
|
395
|
+
export type Mt5SyncState = ContentItem<Mt5SyncStateData>;
|
|
396
|
+
/**
|
|
397
|
+
* `ReportDefinition` (`pack.yaml`) — report template schema. The full schema
|
|
398
|
+
* is template-specific (configured per pack install); we expose the generic
|
|
399
|
+
* envelope as `Record<string, unknown>` until per-template shapes are modeled.
|
|
400
|
+
*/
|
|
401
|
+
export type ReportDefinitionData = Record<string, unknown>;
|
|
402
|
+
export type ReportDefinition = ContentItem<ReportDefinitionData>;
|
|
403
|
+
/**
|
|
404
|
+
* `LlmConversation` — AI conversation result with provenance. Created by the
|
|
405
|
+
* `generate_ai_summary` action on `Mt5Account`. Full schema is LLM-provider
|
|
406
|
+
* specific; exposed as a generic envelope until per-provider shapes are modeled.
|
|
407
|
+
*/
|
|
408
|
+
export type LlmConversationData = Record<string, unknown>;
|
|
409
|
+
export type LlmConversation = ContentItem<LlmConversationData>;
|
|
410
|
+
/**
|
|
411
|
+
* `KalshiServer` (FEAT-010) — Kalshi gateway config. Fields reflect mt5
|
|
412
|
+
* data-design §2.7.
|
|
413
|
+
*/
|
|
414
|
+
export interface KalshiServerData {
|
|
415
|
+
/** Required, unique — gateway name. */
|
|
416
|
+
name: string;
|
|
417
|
+
apiKeyId: string;
|
|
418
|
+
/** Encrypted private key blob (Kalshi API secret). */
|
|
419
|
+
apiPrivateKey: string;
|
|
420
|
+
baseUrl: string;
|
|
421
|
+
/** FK to `Mt5Server.data.name` — the gateway proxies to this mt5 server. */
|
|
422
|
+
mt5Server: string;
|
|
423
|
+
/** Lifecycle status. */
|
|
424
|
+
status: KalshiServerStatus;
|
|
425
|
+
syncInterval: number;
|
|
426
|
+
pricePollInterval: number;
|
|
427
|
+
/** Default spread applied to mirrored Kalshi markets, in basis points. */
|
|
428
|
+
defaultSpreadBps: number;
|
|
429
|
+
/** Kalshi categories to mirror (e.g. `['economics', 'sports']`). */
|
|
430
|
+
categories: string[];
|
|
431
|
+
}
|
|
432
|
+
export type KalshiServer = ContentItem<KalshiServerData>;
|
|
433
|
+
/**
|
|
434
|
+
* `KalshiEvent.data` — inventory §4.12.
|
|
435
|
+
* Identity: `data.eventTicker`. State: `open → closed → finalized`.
|
|
436
|
+
*/
|
|
437
|
+
export interface KalshiEventData {
|
|
438
|
+
/** Kalshi `event_ticker` (e.g. `KXBTC15M-26JUL291400`). */
|
|
439
|
+
eventTicker: string;
|
|
440
|
+
title?: string;
|
|
441
|
+
/** @deprecated Prefer `seriesTicker` → series.category (§4.12). */
|
|
442
|
+
category?: string;
|
|
443
|
+
subCategory?: string;
|
|
444
|
+
/** Parent series (`KXBTC15M`, `KXGOLDMON`, …). */
|
|
445
|
+
seriesTicker?: string;
|
|
446
|
+
/** When the underlying asset settles (ISO 8601). */
|
|
447
|
+
strikeDate?: string;
|
|
448
|
+
/** Cadence: `15M` / `1H` / `1D` / `W1` / `MON` / … */
|
|
449
|
+
strikePeriod?: string;
|
|
450
|
+
/** When trading stops on the event (ISO 8601). */
|
|
451
|
+
closeTime?: string;
|
|
452
|
+
status?: KalshiLifecycleStatus;
|
|
453
|
+
/** True if only one market in the event can settle YES. */
|
|
454
|
+
mutuallyExclusive?: boolean;
|
|
455
|
+
/** Per-market source-of-truth for resolution. */
|
|
456
|
+
settlementSources?: Record<string, unknown>[];
|
|
457
|
+
/** Free-form Kalshi product metadata. */
|
|
458
|
+
productMetadata?: Record<string, unknown>;
|
|
459
|
+
/** Event description (pack §2.2). */
|
|
460
|
+
description?: string;
|
|
461
|
+
/**
|
|
462
|
+
* Series cadence on KalshiEvent (pack §2.2 / §2.4):
|
|
463
|
+
* `fifteen_min` | `hourly` | `daily` | `weekly` | `monthly` | `quarterly` |
|
|
464
|
+
* `annual` | `one_off` | `custom`.
|
|
465
|
+
*/
|
|
466
|
+
frequency?: string;
|
|
467
|
+
/** Denormalized ladder size when present on Event. */
|
|
468
|
+
strikesCount?: number;
|
|
469
|
+
/** Always `0` on the event row — 24h volume is a trending/future concern. */
|
|
470
|
+
volume24hContracts?: number;
|
|
471
|
+
/** Cumulative traded contracts across child markets (pack §2.2). */
|
|
472
|
+
volumeContracts?: number;
|
|
473
|
+
lastUpdatedTs?: number;
|
|
474
|
+
/** Full Kalshi event JSON for audit / re-derivation. */
|
|
475
|
+
rawData?: Record<string, unknown>;
|
|
476
|
+
}
|
|
477
|
+
export type KalshiEvent = ContentItem<KalshiEventData>;
|
|
478
|
+
/**
|
|
479
|
+
* `KalshiFuture.data` — inventory §4.13 / pack §2.3.
|
|
480
|
+
* Identity: `data.marketTicker`. State: `active → closed → finalized`.
|
|
481
|
+
* Quotes are **integer cents (0–100)** — served verbatim from CMS.
|
|
482
|
+
*/
|
|
483
|
+
export interface KalshiFutureData {
|
|
484
|
+
/** Kalshi `ticker` (e.g. `KXWTI-26JUL2914-T83.99`). */
|
|
485
|
+
marketTicker: string;
|
|
486
|
+
/** Logical FK to `KalshiEvent.data.eventTicker`. */
|
|
487
|
+
eventTicker?: string;
|
|
488
|
+
seriesTicker?: string;
|
|
489
|
+
/** Series frequency (`daily`, `weekly`, …) — FEAT-015 cadence ladder source. */
|
|
490
|
+
cadence?: string;
|
|
491
|
+
/** `Crypto` / `Commodities` / `Economics` / etc. */
|
|
492
|
+
kalshiCategory?: string;
|
|
493
|
+
underlyingMt5Symbol?: string;
|
|
494
|
+
/** Default `1`. */
|
|
495
|
+
underlyingLeverage?: number;
|
|
496
|
+
title?: string;
|
|
497
|
+
yesSubTitle?: string;
|
|
498
|
+
noSubTitle?: string;
|
|
499
|
+
/** MT5 custom symbol (e.g. `KS-KXWTI-26JUL2914-T83.99`). */
|
|
500
|
+
mt5Symbol?: string;
|
|
501
|
+
serverName?: string;
|
|
502
|
+
/** `binary` | `scalar` — stored market type enum. */
|
|
503
|
+
marketType?: string;
|
|
504
|
+
/** Broker-spread-adjusted YES bid/ask — integer cents `0–100`. */
|
|
505
|
+
yesBidCents?: number;
|
|
506
|
+
yesAskCents?: number;
|
|
507
|
+
/** Chance % midpoint in cents; NO-side mirror per pack §1.2. */
|
|
508
|
+
yesPriceCents?: number;
|
|
509
|
+
noPriceCents?: number;
|
|
510
|
+
spreadCents?: number;
|
|
511
|
+
volume?: number;
|
|
512
|
+
volume24hContracts?: number;
|
|
513
|
+
/** Cumulative traded contracts (Kalshi `volume_fp`, pack §2.3). */
|
|
514
|
+
volumeContracts?: number;
|
|
515
|
+
openInterest?: number;
|
|
516
|
+
openTime?: string;
|
|
517
|
+
closeTime?: string;
|
|
518
|
+
expectedExpirationTime?: string;
|
|
519
|
+
/** Snapshot observation time (ISO-8601 UTC). */
|
|
520
|
+
quoteObservedAt?: string;
|
|
521
|
+
/** `0` or `100` after settle; unset while active. */
|
|
522
|
+
settlementValueCents?: number | null;
|
|
523
|
+
/** Settled outcome; `null` while active. */
|
|
524
|
+
result?: KalshiSettlementResult | null;
|
|
525
|
+
status?: KalshiFutureStatus;
|
|
526
|
+
settledAt?: string;
|
|
527
|
+
settlementTs?: string;
|
|
528
|
+
closedAt?: string;
|
|
529
|
+
/** Default `true`. When false the gateway stops syncing this market. */
|
|
530
|
+
enabled?: boolean;
|
|
531
|
+
/** Visibility flag for FE lists (`false` = hide). */
|
|
532
|
+
feIncluded?: boolean;
|
|
533
|
+
lastSyncedAt?: string;
|
|
534
|
+
/** Strike label for ladder rows (BE pack / `yes_sub_title` alias). */
|
|
535
|
+
strikeLabel?: string;
|
|
536
|
+
/** Min contracts per order (BE pack — prefer Mt5Symbol minLot in FE). */
|
|
537
|
+
minContract?: number;
|
|
538
|
+
/** Max contracts per order (BE pack — prefer Mt5Symbol maxLot in FE). */
|
|
539
|
+
maxContract?: number;
|
|
540
|
+
/** ADR-005 fee coefficient (default `0.07`). */
|
|
541
|
+
feeCoefficient?: number;
|
|
542
|
+
/** UI category slug when present on Future CT. */
|
|
543
|
+
category?: string;
|
|
544
|
+
/** Display badge for category chips. */
|
|
545
|
+
categoryBadge?: string;
|
|
546
|
+
/** `binary` | `scalar` | … when present on Event denorm. */
|
|
547
|
+
eventType?: string;
|
|
548
|
+
/** Ladder size hint when denormalized on Future/Event. */
|
|
549
|
+
strikesCount?: number;
|
|
550
|
+
}
|
|
551
|
+
export type KalshiFuture = ContentItem<KalshiFutureData>;
|
|
552
|
+
/** Per-order-type margin rates mirrored from MT5 ``MarginRateInitial`` / ``MarginRateMaintenance``. */
|
|
553
|
+
export interface Mt5MarginRateByType {
|
|
554
|
+
buy: number;
|
|
555
|
+
sell: number;
|
|
556
|
+
buyStop: number;
|
|
557
|
+
buyLimit: number;
|
|
558
|
+
sellStop: number;
|
|
559
|
+
sellLimit: number;
|
|
560
|
+
buyStopLimit: number;
|
|
561
|
+
sellStopLimit: number;
|
|
562
|
+
}
|
|
563
|
+
/** `Mt5Symbol` (FEAT-001 / FEAT-016). Full catalog mirror of MT5's ``ConSymbol``. */
|
|
564
|
+
export interface Mt5SymbolData {
|
|
565
|
+
serverName: string;
|
|
566
|
+
symbol: string;
|
|
567
|
+
fullSymbolName: string;
|
|
568
|
+
/** Breadcrumb path the broker exposes (e.g. ``['Forex', 'Majors']``). */
|
|
569
|
+
path: string[];
|
|
570
|
+
category: string;
|
|
571
|
+
baseCurrency: string;
|
|
572
|
+
quoteCurrency: string;
|
|
573
|
+
digits: number;
|
|
574
|
+
point: number;
|
|
575
|
+
tickSize: number;
|
|
576
|
+
tickValue: number;
|
|
577
|
+
contractSize: number;
|
|
578
|
+
minLot: number;
|
|
579
|
+
maxLot: number;
|
|
580
|
+
lotStep: number;
|
|
581
|
+
leverageDefault: number;
|
|
582
|
+
marginRateDefault: number;
|
|
583
|
+
/** Spread for anonymous / no-group viewers (int). */
|
|
584
|
+
spreadDefault: number;
|
|
585
|
+
/** ``{group_name: spread_int}``. Pick the entry matching ``Mt5Account.data.group``. */
|
|
586
|
+
spreadByGroup: Record<string, number>;
|
|
587
|
+
marginByGroup: Record<string, number>;
|
|
588
|
+
leverageByGroup: Record<string, number>;
|
|
589
|
+
/**
|
|
590
|
+
* ``{group_name: swap_long_float}`` — per-group long-swap rate
|
|
591
|
+
* (USD/lot/day). The MT5 broker usually surfaces this via the
|
|
592
|
+
* ``IMTConGroupSymbol::SwapLong`` field even when ``SpreadDiff``
|
|
593
|
+
* and ``MarginRate*`` are zero — so this map is the most reliable
|
|
594
|
+
* per-group financial diff for a webtrade chart. Empty on
|
|
595
|
+
* brokers without per-group swap overrides.
|
|
596
|
+
*/
|
|
597
|
+
swapLongByGroup: Record<string, number>;
|
|
598
|
+
/**
|
|
599
|
+
* ``{group_name: swap_short_float}`` — per-group short-swap rate
|
|
600
|
+
* (USD/lot/day).
|
|
601
|
+
*/
|
|
602
|
+
swapShortByGroup: Record<string, number>;
|
|
603
|
+
swapLong: number;
|
|
604
|
+
swapShort: number;
|
|
605
|
+
swapRollover3days: number;
|
|
606
|
+
commissionRule: string;
|
|
607
|
+
tradeMode: MT5TradeMode;
|
|
608
|
+
executionMode: MT5ExecutionMode;
|
|
609
|
+
fills: number;
|
|
610
|
+
tradingSession: Array<{
|
|
611
|
+
session: string;
|
|
612
|
+
open: string;
|
|
613
|
+
close: string;
|
|
614
|
+
}>;
|
|
615
|
+
expiration?: string;
|
|
616
|
+
marketStatus: MT5MarketStatus;
|
|
617
|
+
listOrder: number;
|
|
618
|
+
isVisible: boolean;
|
|
619
|
+
backendNote?: string;
|
|
620
|
+
/** ISO-8601 last sync time (worker writes). */
|
|
621
|
+
lastSyncedAt?: string;
|
|
622
|
+
/** MT5 ``CalcMode`` enum (0 forex · 1 futures · 2 cfd · 3 cfdindex · 4 cfdleverage · 5 forex_no_leverage · 32 exch_stocks · 33 exch_futures · 34 exch_futures_forts · 35 exch_options · 37 exch_bonds · 64 serv_collateral). */
|
|
623
|
+
calcMode?: number;
|
|
624
|
+
/** Human label for ``calcMode`` (e.g. ``"cfd"``). */
|
|
625
|
+
calcModeLabel?: string;
|
|
626
|
+
/** Currency margin is charged in (``CurrencyMargin``). */
|
|
627
|
+
marginCurrency?: string;
|
|
628
|
+
/** Fixed initial-margin override per lot; ``0`` = use the calc-mode formula. */
|
|
629
|
+
marginInitial?: number;
|
|
630
|
+
/** Fixed maintenance margin per lot (``0`` = none). */
|
|
631
|
+
marginMaintenance?: number;
|
|
632
|
+
/** Initial margin rate per order type; ``0`` entries fall back to ``marginLong`` / ``marginShort``. */
|
|
633
|
+
marginRateInitialByType?: Mt5MarginRateByType;
|
|
634
|
+
/** Maintenance margin rate per order type (same fallback rule). */
|
|
635
|
+
marginRateMaintenanceByType?: Mt5MarginRateByType;
|
|
636
|
+
/** Directional initial margin rates (``MarginLong`` / ``MarginShort``). */
|
|
637
|
+
marginLong?: number;
|
|
638
|
+
marginShort?: number;
|
|
639
|
+
/** Hedged (overlapping) margin rate — hedging accounts only. */
|
|
640
|
+
marginHedged?: number;
|
|
641
|
+
/** MT5 margin-calculation flags (bit 0 ``CHECK_PROCESS`` · bit 1 ``CHECK_SLTP``). */
|
|
642
|
+
marginFlags?: number;
|
|
643
|
+
/** Per-pending-type margin overrides (``0`` = none). */
|
|
644
|
+
marginLimit?: number;
|
|
645
|
+
marginStop?: number;
|
|
646
|
+
marginStopLimit?: number;
|
|
647
|
+
/** Bond face value (``FaceValue``, calc mode 37). */
|
|
648
|
+
faceValue?: number;
|
|
649
|
+
/** Max total volume per direction (positions + pending orders), lots; ``0`` = unlimited. */
|
|
650
|
+
volumeLimit?: number;
|
|
651
|
+
/** Raw 1/10000-lot wire volumes (``VolumeLimit`` / ``VolumeMax`` / ``VolumeMin`` / ``VolumeStep``). */
|
|
652
|
+
volumeLimitRaw?: number;
|
|
653
|
+
volumeMaxRaw?: number;
|
|
654
|
+
volumeMinRaw?: number;
|
|
655
|
+
volumeStepRaw?: number;
|
|
656
|
+
/** Instant-execution auto-request threshold, lots (``0`` = none). */
|
|
657
|
+
ieVolumeMax?: number;
|
|
658
|
+
/** Per-account-group volume grid overrides (lot space). */
|
|
659
|
+
volumeLimitByGroup?: Record<string, number>;
|
|
660
|
+
volumeMaxByGroup?: Record<string, number>;
|
|
661
|
+
volumeMinByGroup?: Record<string, number>;
|
|
662
|
+
volumeStepByGroup?: Record<string, number>;
|
|
663
|
+
/** ``{group_name: tradable}`` — group-scoped tradability of the symbol. */
|
|
664
|
+
tradableByGroup?: Record<string, boolean>;
|
|
665
|
+
/** Order types this symbol allows (``market``, ``limit``, ``stop``, ``stop_limit``, ``sl``, ``tp``, ``close_by``). */
|
|
666
|
+
allowedOrderTypes?: string[];
|
|
667
|
+
/** Verbatim raw MT5 ``ConSymbol`` config snapshot (opaque passthrough). */
|
|
668
|
+
mt5RawConfig?: Record<string, unknown>;
|
|
669
|
+
}
|
|
670
|
+
export type Mt5Symbol = ContentItem<Mt5SymbolData>;
|
|
671
|
+
/** `Mt5Category` (FEAT-001 §US2). */
|
|
672
|
+
export interface Mt5CategoryData {
|
|
673
|
+
serverName: string;
|
|
674
|
+
name: string;
|
|
675
|
+
label: string;
|
|
676
|
+
path: string[];
|
|
677
|
+
/** Denormalised — fast list rendering on the FE. */
|
|
678
|
+
symbols: string[];
|
|
679
|
+
sortOrder: number;
|
|
680
|
+
/** Built-in = broker-defined (read-only). False = admin-created (editable). */
|
|
681
|
+
isBuiltin: boolean;
|
|
682
|
+
isVisible: boolean;
|
|
683
|
+
/** Account groups this category is available for. Empty array = category is
|
|
684
|
+
* not available for any account (admin-marked hidden). The FE derives the
|
|
685
|
+
* scope from the selected account's `group` and filters the visible list
|
|
686
|
+
* accordingly — see `symbolStore.fetchMarketCategories`. */
|
|
687
|
+
groups: string[];
|
|
688
|
+
}
|
|
689
|
+
export type Mt5Category = ContentItem<Mt5CategoryData>;
|
|
690
|
+
/** `Mt5Watchlist` (FEAT-001 §US4–§US5). Per-user symbol list. */
|
|
691
|
+
export interface Mt5WatchlistData {
|
|
692
|
+
userId: number;
|
|
693
|
+
serverName: string;
|
|
694
|
+
name: string;
|
|
695
|
+
label: string;
|
|
696
|
+
/**
|
|
697
|
+
* Ordered symbol NAMES (e.g. ``['EURUSD', 'AAPL']``) — preserves
|
|
698
|
+
* drag-drop reordering. Rows written before the name convention may still
|
|
699
|
+
* hold symbol UUIDs; consumers detect + migrate them on read
|
|
700
|
+
* (see webtrade `symbolStore._resolveWatchlistSymbolNames`).
|
|
701
|
+
*/
|
|
702
|
+
symbols: string[];
|
|
703
|
+
/** True only on the row with ``name === 'favorites'``. */
|
|
704
|
+
isFavorites: boolean;
|
|
705
|
+
isBuiltin: boolean;
|
|
706
|
+
sortOrder: number;
|
|
707
|
+
detail?: boolean;
|
|
708
|
+
}
|
|
709
|
+
export type Mt5Watchlist = ContentItem<Mt5WatchlistData>;
|
|
710
|
+
/** `Mt5ChartBar` (FEAT-002 / FEAT-013 §US1). OHLC bar mirrored from ClickHouse or built from live ticks. */
|
|
711
|
+
export interface Mt5ChartBarData {
|
|
712
|
+
serverName: string;
|
|
713
|
+
symbol: string;
|
|
714
|
+
/** Canonical interval: `M1` | `M5` | … | `MN1`. */
|
|
715
|
+
interval: MT5Interval;
|
|
716
|
+
/** ISO-8601 server time at open of the bar. */
|
|
717
|
+
mt5Ts: string;
|
|
718
|
+
open: number;
|
|
719
|
+
high: number;
|
|
720
|
+
low: number;
|
|
721
|
+
close: number;
|
|
722
|
+
volume: number;
|
|
723
|
+
tickVolume: number;
|
|
724
|
+
spread: number;
|
|
725
|
+
source: MT5ChartBarSource;
|
|
726
|
+
isCorrection: boolean;
|
|
727
|
+
}
|
|
728
|
+
export type Mt5ChartBar = ContentItem<Mt5ChartBarData>;
|
|
729
|
+
/** `Mt5PositionHistory` (FEAT-008 §history tab). */
|
|
730
|
+
export interface Mt5PositionHistoryData {
|
|
731
|
+
serverName: string;
|
|
732
|
+
login: number;
|
|
733
|
+
positionId: number;
|
|
734
|
+
/** ISO-8601 server time. */
|
|
735
|
+
mt5TsOpen: string;
|
|
736
|
+
/** ISO-8601 server time. */
|
|
737
|
+
mt5TsClose?: string | null;
|
|
738
|
+
symbol: string;
|
|
739
|
+
type: MT5TradeSide;
|
|
740
|
+
volume: number;
|
|
741
|
+
openPrice: number;
|
|
742
|
+
closePrice: number;
|
|
743
|
+
stopLoss: number;
|
|
744
|
+
takeProfit: number;
|
|
745
|
+
commission: number;
|
|
746
|
+
fee: number;
|
|
747
|
+
swap: number;
|
|
748
|
+
profitLoss: number;
|
|
749
|
+
comment: string;
|
|
750
|
+
currency: string;
|
|
751
|
+
balanceAfter?: number | null;
|
|
752
|
+
}
|
|
753
|
+
export type Mt5PositionHistory = ContentItem<Mt5PositionHistoryData>;
|
|
754
|
+
/** `Mt5OrderHistory` (FEAT-008 §history tab). */
|
|
755
|
+
export interface Mt5OrderHistoryData {
|
|
756
|
+
serverName: string;
|
|
757
|
+
login: number;
|
|
758
|
+
orderId: number;
|
|
759
|
+
/** ISO-8601 server time. */
|
|
760
|
+
mt5TsSetup: string;
|
|
761
|
+
/** ISO-8601 server time, terminal state. */
|
|
762
|
+
mt5TsDone?: string | null;
|
|
763
|
+
symbol: string;
|
|
764
|
+
type: MT5OrderKind;
|
|
765
|
+
side: MT5TradeSide;
|
|
766
|
+
volume: number;
|
|
767
|
+
executedPrice: number;
|
|
768
|
+
limitPrice: number;
|
|
769
|
+
stopPrice: number;
|
|
770
|
+
stopLoss: number;
|
|
771
|
+
takeProfit: number;
|
|
772
|
+
/**
|
|
773
|
+
* Decoded MT5 `state_str` (e.g. `FILLED`, `CANCELED`, `PARTIAL`). Use the
|
|
774
|
+
* `MT5OrderStateNameOrUnknown` escape hatch when comparing wire values that
|
|
775
|
+
* may include broker-introduced states not yet modelled.
|
|
776
|
+
*/
|
|
777
|
+
status: MT5OrderStateName | string;
|
|
778
|
+
comment: string;
|
|
779
|
+
}
|
|
780
|
+
export type Mt5OrderHistory = ContentItem<Mt5OrderHistoryData>;
|
|
781
|
+
/** `Mt5DealHistory` (FEAT-008 §history tab). Per executed transaction. */
|
|
782
|
+
export interface Mt5DealHistoryData {
|
|
783
|
+
serverName: string;
|
|
784
|
+
login: number;
|
|
785
|
+
dealId: number;
|
|
786
|
+
orderId: number;
|
|
787
|
+
positionId: number;
|
|
788
|
+
/** ISO-8601 server time. */
|
|
789
|
+
mt5Ts: string;
|
|
790
|
+
symbol: string;
|
|
791
|
+
entry: MT5DealEntry;
|
|
792
|
+
action: MT5TradeSide;
|
|
793
|
+
volume: number;
|
|
794
|
+
price: number;
|
|
795
|
+
commission: number;
|
|
796
|
+
fee: number;
|
|
797
|
+
swap: number;
|
|
798
|
+
profitLoss: number;
|
|
799
|
+
comment: string;
|
|
800
|
+
}
|
|
801
|
+
export type Mt5DealHistory = ContentItem<Mt5DealHistoryData>;
|
|
802
|
+
/** `Mt5Drawing` (FEAT-006 §drawings). User-created chart annotation, per (user, symbol). */
|
|
803
|
+
export interface Mt5DrawingData {
|
|
804
|
+
userId: number;
|
|
805
|
+
serverName: string;
|
|
806
|
+
symbol: string;
|
|
807
|
+
/** Client UUID for the drawing — used to disambiguate duplicates. */
|
|
808
|
+
drawingKey: string;
|
|
809
|
+
drawType: string;
|
|
810
|
+
/** Type-specific shape — points / colors / anchors. Opaque to the SDK. */
|
|
811
|
+
data: Record<string, unknown>;
|
|
812
|
+
color: string;
|
|
813
|
+
lineWidth: number;
|
|
814
|
+
fillEnabled: boolean;
|
|
815
|
+
locked: boolean;
|
|
816
|
+
}
|
|
817
|
+
export type Mt5Drawing = ContentItem<Mt5DrawingData>;
|
|
818
|
+
/** Per-symbol tick envelope carried over WS topic ``symbol:<server>:<SYMBOL>``. */
|
|
819
|
+
export interface SymbolTickPayload {
|
|
820
|
+
event: typeof WS_EVENT_NAME.SYMBOL_TICK | typeof WS_EVENT_NAME.LAST_TICK;
|
|
821
|
+
symbol: string;
|
|
822
|
+
server: string;
|
|
823
|
+
bid: number;
|
|
824
|
+
ask: number;
|
|
825
|
+
last: number;
|
|
826
|
+
volume: number;
|
|
827
|
+
spread: number;
|
|
828
|
+
/** ISO-8601 server time. */
|
|
829
|
+
timestamp: string;
|
|
830
|
+
publisher: string;
|
|
831
|
+
}
|
|
832
|
+
//# sourceMappingURL=content.type.d.ts.map
|