hedgequantx 2.7.15 → 2.7.17
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/package.json +1 -1
- package/src/app.js +10 -10
- package/src/lib/data.js +245 -471
- package/src/lib/m/s1-models.js +173 -0
- package/src/lib/m/s1.js +354 -735
- package/src/menus/dashboard.js +8 -5
- package/src/lib/api.js +0 -198
- package/src/lib/api2.js +0 -353
- package/src/lib/core.js +0 -539
- package/src/lib/core2.js +0 -341
- package/src/lib/data2.js +0 -492
- package/src/lib/decoder.js +0 -599
- package/src/lib/m/s2.js +0 -34
- package/src/lib/n/r1.js +0 -454
- package/src/lib/n/r2.js +0 -514
- package/src/lib/n/r3.js +0 -631
- package/src/lib/n/r4.js +0 -401
- package/src/lib/n/r5.js +0 -335
- package/src/lib/n/r6.js +0 -425
- package/src/lib/n/r7.js +0 -530
- package/src/lib/o/l1.js +0 -44
- package/src/lib/o/l2.js +0 -427
- package/src/lib/python-bridge.js +0 -206
package/src/lib/n/r7.js
DELETED
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rithmic Constants
|
|
3
|
-
* All PropFirms, Gateways, Template IDs, and Configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// =============================================================================
|
|
7
|
-
// RITHMIC GATEWAYS
|
|
8
|
-
// =============================================================================
|
|
9
|
-
const RITHMIC_GATEWAYS = {
|
|
10
|
-
// Production Gateways
|
|
11
|
-
CHICAGO: 'wss://rprotocol.rithmic.com:443',
|
|
12
|
-
EUROPE: 'wss://rprotocol-ie.rithmic.com:443',
|
|
13
|
-
FRANKFURT: 'wss://rprotocol-de.rithmic.com:443',
|
|
14
|
-
SINGAPORE: 'wss://rprotocol-sg.rithmic.com:443',
|
|
15
|
-
SYDNEY: 'wss://rprotocol-au.rithmic.com:443',
|
|
16
|
-
TOKYO: 'wss://rprotocol-jp.rithmic.com:443',
|
|
17
|
-
|
|
18
|
-
// Test/Paper Gateways
|
|
19
|
-
TEST: 'wss://rituz00100.rithmic.com:443',
|
|
20
|
-
PAPER: 'wss://ritpa00100.rithmic.com:443', // Main paper gateway
|
|
21
|
-
PAPER_ALT: 'wss://ritpa11120.11.rithmic.com:443'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// =============================================================================
|
|
25
|
-
// PROPFIRM CONFIGURATIONS
|
|
26
|
-
// =============================================================================
|
|
27
|
-
const RITHMIC_PROPFIRMS = {
|
|
28
|
-
// Apex Trader Funding
|
|
29
|
-
'apex': {
|
|
30
|
-
systemName: 'Apex',
|
|
31
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
32
|
-
displayName: 'Apex Trader Funding',
|
|
33
|
-
isPaper: true
|
|
34
|
-
},
|
|
35
|
-
'apex_rithmic': {
|
|
36
|
-
systemName: 'Apex',
|
|
37
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
38
|
-
displayName: 'Apex Trader Funding',
|
|
39
|
-
isPaper: true
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
// TopstepTrader (Rithmic version)
|
|
43
|
-
'topsteptrader': {
|
|
44
|
-
systemName: 'TopstepTrader',
|
|
45
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
46
|
-
displayName: 'TopstepTrader (Rithmic)',
|
|
47
|
-
isPaper: true
|
|
48
|
-
},
|
|
49
|
-
'topstep_r': {
|
|
50
|
-
systemName: 'TopstepTrader',
|
|
51
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
52
|
-
displayName: 'TopstepTrader (Rithmic)',
|
|
53
|
-
isPaper: true
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
// Bulenox (Rithmic version)
|
|
57
|
-
'bulenox_r': {
|
|
58
|
-
systemName: 'Bulenox',
|
|
59
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
60
|
-
displayName: 'Bulenox (Rithmic)',
|
|
61
|
-
isPaper: true
|
|
62
|
-
},
|
|
63
|
-
'rithmic-bulenox': {
|
|
64
|
-
systemName: 'Bulenox',
|
|
65
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
66
|
-
displayName: 'Bulenox (Rithmic)',
|
|
67
|
-
isPaper: true
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
// MES Capital
|
|
71
|
-
'mescapital': {
|
|
72
|
-
systemName: 'MES Capital',
|
|
73
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
74
|
-
displayName: 'MES Capital',
|
|
75
|
-
isPaper: true
|
|
76
|
-
},
|
|
77
|
-
'mes-capital': {
|
|
78
|
-
systemName: 'MES Capital',
|
|
79
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
80
|
-
displayName: 'MES Capital',
|
|
81
|
-
isPaper: true
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
// Earn2Trade
|
|
85
|
-
'earn2trade': {
|
|
86
|
-
systemName: 'Earn2Trade',
|
|
87
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
88
|
-
displayName: 'Earn2Trade',
|
|
89
|
-
isPaper: true
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
// TradeFundrr
|
|
93
|
-
'tradefundrr': {
|
|
94
|
-
systemName: 'TradeFundrr',
|
|
95
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
96
|
-
displayName: 'TradeFundrr',
|
|
97
|
-
isPaper: true
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
// The Trading Pit
|
|
101
|
-
'thetradingpit': {
|
|
102
|
-
systemName: 'TheTradingPit',
|
|
103
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
104
|
-
displayName: 'The Trading Pit',
|
|
105
|
-
isPaper: true
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
// Funded Futures Network
|
|
109
|
-
'fundedfutures': {
|
|
110
|
-
systemName: 'FundedFuturesNetwork',
|
|
111
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
112
|
-
displayName: 'Funded Futures Network',
|
|
113
|
-
isPaper: true
|
|
114
|
-
},
|
|
115
|
-
'fundedfuturesnetwork': {
|
|
116
|
-
systemName: 'FundedFuturesNetwork',
|
|
117
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
118
|
-
displayName: 'Funded Futures Network',
|
|
119
|
-
isPaper: true
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
// PropShop Trader
|
|
123
|
-
'propshop': {
|
|
124
|
-
systemName: 'PropShopTrader',
|
|
125
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
126
|
-
displayName: 'PropShop Trader',
|
|
127
|
-
isPaper: true
|
|
128
|
-
},
|
|
129
|
-
'propshoptrader': {
|
|
130
|
-
systemName: 'PropShopTrader',
|
|
131
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
132
|
-
displayName: 'PropShop Trader',
|
|
133
|
-
isPaper: true
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
// 4PropTrader
|
|
137
|
-
'4proptrader': {
|
|
138
|
-
systemName: '4PropTrader',
|
|
139
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
140
|
-
displayName: '4PropTrader',
|
|
141
|
-
isPaper: true
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
// DayTraders.com
|
|
145
|
-
'daytraders': {
|
|
146
|
-
systemName: 'DayTraders',
|
|
147
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
148
|
-
displayName: 'DayTraders.com',
|
|
149
|
-
isPaper: true
|
|
150
|
-
},
|
|
151
|
-
'rithmic-daytraders': {
|
|
152
|
-
systemName: 'DayTraders',
|
|
153
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
154
|
-
displayName: 'DayTraders.com',
|
|
155
|
-
isPaper: true
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
// 10X Futures
|
|
159
|
-
'10xfutures': {
|
|
160
|
-
systemName: '10XFutures',
|
|
161
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
162
|
-
displayName: '10X Futures',
|
|
163
|
-
isPaper: true
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
// Lucid Trading
|
|
167
|
-
'lucidtrading': {
|
|
168
|
-
systemName: 'LucidTrading',
|
|
169
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
170
|
-
displayName: 'Lucid Trading',
|
|
171
|
-
isPaper: true
|
|
172
|
-
},
|
|
173
|
-
'rithmic-lucidtrading': {
|
|
174
|
-
systemName: 'LucidTrading',
|
|
175
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
176
|
-
displayName: 'Lucid Trading',
|
|
177
|
-
isPaper: true
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
// Thrive Trading
|
|
181
|
-
'thrivetrading': {
|
|
182
|
-
systemName: 'ThriveTrading',
|
|
183
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
184
|
-
displayName: 'Thrive Trading',
|
|
185
|
-
isPaper: true
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
// Legends Trading
|
|
189
|
-
'legendstrading': {
|
|
190
|
-
systemName: 'LegendsTrading',
|
|
191
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
192
|
-
displayName: 'Legends Trading',
|
|
193
|
-
isPaper: true
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
// TradeSea
|
|
197
|
-
'tradesea': {
|
|
198
|
-
systemName: 'TradeSea',
|
|
199
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
200
|
-
displayName: 'TradeSea',
|
|
201
|
-
isPaper: true
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
// UProfit
|
|
205
|
-
'uprofit': {
|
|
206
|
-
systemName: 'UProfit',
|
|
207
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
208
|
-
displayName: 'UProfit',
|
|
209
|
-
isPaper: true
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
// FastTrack Trading
|
|
213
|
-
'fasttracktrading': {
|
|
214
|
-
systemName: 'FastTrackTrading',
|
|
215
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
216
|
-
displayName: 'FastTrack Trading',
|
|
217
|
-
isPaper: true
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
// My Funded Futures
|
|
221
|
-
'myfundedfutures': {
|
|
222
|
-
systemName: 'MyFundedFutures',
|
|
223
|
-
gateway: RITHMIC_GATEWAYS.CHICAGO,
|
|
224
|
-
displayName: 'My Funded Futures',
|
|
225
|
-
isPaper: true
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
// Rithmic Test (for development)
|
|
229
|
-
'rithmic_test': {
|
|
230
|
-
systemName: 'Rithmic Test',
|
|
231
|
-
gateway: RITHMIC_GATEWAYS.TEST,
|
|
232
|
-
displayName: 'Rithmic Test',
|
|
233
|
-
isPaper: true
|
|
234
|
-
},
|
|
235
|
-
'rithmic-test': {
|
|
236
|
-
systemName: 'Rithmic Test',
|
|
237
|
-
gateway: RITHMIC_GATEWAYS.TEST,
|
|
238
|
-
displayName: 'Rithmic Test',
|
|
239
|
-
isPaper: true
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
// =============================================================================
|
|
244
|
-
// TEMPLATE IDS (Protobuf message types)
|
|
245
|
-
// =============================================================================
|
|
246
|
-
const TEMPLATE_IDS = {
|
|
247
|
-
// Login/Logout
|
|
248
|
-
REQUEST_LOGIN: 10,
|
|
249
|
-
RESPONSE_LOGIN: 11,
|
|
250
|
-
REQUEST_LOGOUT: 12,
|
|
251
|
-
RESPONSE_LOGOUT: 13,
|
|
252
|
-
|
|
253
|
-
// Heartbeat
|
|
254
|
-
REQUEST_HEARTBEAT: 18,
|
|
255
|
-
RESPONSE_HEARTBEAT: 19,
|
|
256
|
-
|
|
257
|
-
// System Info
|
|
258
|
-
REQUEST_RITHMIC_SYSTEM_INFO: 16,
|
|
259
|
-
RESPONSE_RITHMIC_SYSTEM_INFO: 17,
|
|
260
|
-
|
|
261
|
-
// Login Info
|
|
262
|
-
REQUEST_LOGIN_INFO: 300,
|
|
263
|
-
RESPONSE_LOGIN_INFO: 301,
|
|
264
|
-
|
|
265
|
-
// Market Data
|
|
266
|
-
REQUEST_MARKET_DATA_UPDATE: 100,
|
|
267
|
-
RESPONSE_MARKET_DATA_UPDATE: 101,
|
|
268
|
-
LAST_TRADE: 150,
|
|
269
|
-
BEST_BID_OFFER: 151,
|
|
270
|
-
|
|
271
|
-
// Orders
|
|
272
|
-
REQUEST_NEW_ORDER: 312,
|
|
273
|
-
RESPONSE_NEW_ORDER: 313,
|
|
274
|
-
REQUEST_MODIFY_ORDER: 314,
|
|
275
|
-
RESPONSE_MODIFY_ORDER: 315,
|
|
276
|
-
REQUEST_CANCEL_ORDER: 316,
|
|
277
|
-
RESPONSE_CANCEL_ORDER: 317,
|
|
278
|
-
REQUEST_CANCEL_ALL_ORDERS: 346,
|
|
279
|
-
RESPONSE_CANCEL_ALL_ORDERS: 347,
|
|
280
|
-
|
|
281
|
-
// Order Notifications
|
|
282
|
-
// Note: 351 is RithmicOrderNotification (internal), 352 is ExchangeOrderNotification (from exchange)
|
|
283
|
-
RITHMIC_ORDER_NOTIFICATION: 351,
|
|
284
|
-
EXCHANGE_ORDER_NOTIFICATION: 352,
|
|
285
|
-
|
|
286
|
-
// Order Updates Subscription
|
|
287
|
-
REQUEST_SUBSCRIBE_FOR_ORDER_UPDATES: 308,
|
|
288
|
-
RESPONSE_SUBSCRIBE_FOR_ORDER_UPDATES: 309,
|
|
289
|
-
|
|
290
|
-
// Show Orders
|
|
291
|
-
REQUEST_SHOW_ORDERS: 320,
|
|
292
|
-
RESPONSE_SHOW_ORDERS: 321,
|
|
293
|
-
|
|
294
|
-
// Trade Routes
|
|
295
|
-
REQUEST_TRADE_ROUTES: 310,
|
|
296
|
-
RESPONSE_TRADE_ROUTES: 311,
|
|
297
|
-
|
|
298
|
-
// Accounts
|
|
299
|
-
REQUEST_ACCOUNT_LIST: 302,
|
|
300
|
-
RESPONSE_ACCOUNT_LIST: 303,
|
|
301
|
-
|
|
302
|
-
// P&L
|
|
303
|
-
REQUEST_PNL_POSITION_SNAPSHOT: 400,
|
|
304
|
-
RESPONSE_PNL_POSITION_SNAPSHOT: 401,
|
|
305
|
-
REQUEST_PNL_POSITION_UPDATES: 402,
|
|
306
|
-
RESPONSE_PNL_POSITION_UPDATES: 403,
|
|
307
|
-
ACCOUNT_PNL_POSITION_UPDATE: 450,
|
|
308
|
-
INSTRUMENT_PNL_POSITION_UPDATE: 451,
|
|
309
|
-
|
|
310
|
-
// History
|
|
311
|
-
REQUEST_SHOW_ORDER_HISTORY: 220,
|
|
312
|
-
RESPONSE_SHOW_ORDER_HISTORY: 221,
|
|
313
|
-
REQUEST_SHOW_ORDER_HISTORY_DATES: 222,
|
|
314
|
-
RESPONSE_SHOW_ORDER_HISTORY_DATES: 223,
|
|
315
|
-
REQUEST_SHOW_ORDER_HISTORY_SUMMARY: 224,
|
|
316
|
-
RESPONSE_SHOW_ORDER_HISTORY_SUMMARY: 225,
|
|
317
|
-
|
|
318
|
-
// Tick Bar Replay
|
|
319
|
-
REQUEST_TICK_BAR_REPLAY: 206,
|
|
320
|
-
RESPONSE_TICK_BAR_REPLAY: 207
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
// =============================================================================
|
|
324
|
-
// INFRA TYPES (Plant types)
|
|
325
|
-
// =============================================================================
|
|
326
|
-
const INFRA_TYPES = {
|
|
327
|
-
TICKER_PLANT: 1, // Market data
|
|
328
|
-
ORDER_PLANT: 2, // Orders and accounts
|
|
329
|
-
HISTORY_PLANT: 3, // Historical data
|
|
330
|
-
PNL_PLANT: 4, // P&L and positions
|
|
331
|
-
REPOSITORY_PLANT: 5 // Symbol search
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
// =============================================================================
|
|
335
|
-
// ORDER TYPES
|
|
336
|
-
// =============================================================================
|
|
337
|
-
const ORDER_TYPES = {
|
|
338
|
-
TRANSACTION_TYPE: {
|
|
339
|
-
BUY: 1,
|
|
340
|
-
SELL: 2
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
DURATION: {
|
|
344
|
-
DAY: 1,
|
|
345
|
-
GTC: 2,
|
|
346
|
-
IOC: 3,
|
|
347
|
-
FOK: 4
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
PRICE_TYPE: {
|
|
351
|
-
LIMIT: 1,
|
|
352
|
-
MARKET: 2,
|
|
353
|
-
STOP_LIMIT: 3,
|
|
354
|
-
STOP_MARKET: 4,
|
|
355
|
-
MARKET_IF_TOUCHED: 5,
|
|
356
|
-
LIMIT_IF_TOUCHED: 6
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
ORDER_PLACEMENT: {
|
|
360
|
-
MANUAL: 1,
|
|
361
|
-
AUTO: 2
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
// =============================================================================
|
|
366
|
-
// NOTIFICATION TYPES (ExchangeOrderNotification)
|
|
367
|
-
// =============================================================================
|
|
368
|
-
const NOTIFY_TYPES = {
|
|
369
|
-
STATUS: 1,
|
|
370
|
-
MODIFY: 2,
|
|
371
|
-
CANCEL: 3,
|
|
372
|
-
TRIGGER: 4,
|
|
373
|
-
FILL: 5,
|
|
374
|
-
REJECT: 6,
|
|
375
|
-
NOT_MODIFIED: 7,
|
|
376
|
-
NOT_CANCELLED: 8,
|
|
377
|
-
GENERIC: 9
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
// =============================================================================
|
|
381
|
-
// RITHMIC NOTIFICATION TYPES (RithmicOrderNotification - template 351)
|
|
382
|
-
// =============================================================================
|
|
383
|
-
const RITHMIC_NOTIFY_TYPES = {
|
|
384
|
-
ORDER_RCVD_FROM_CLNT: 1,
|
|
385
|
-
MODIFY_RCVD_FROM_CLNT: 2,
|
|
386
|
-
CANCEL_RCVD_FROM_CLNT: 3,
|
|
387
|
-
OPEN_PENDING: 4,
|
|
388
|
-
MODIFY_PENDING: 5,
|
|
389
|
-
CANCEL_PENDING: 6,
|
|
390
|
-
ORDER_RCVD_BY_EXCH_GTWY: 7,
|
|
391
|
-
MODIFY_RCVD_BY_EXCH_GTWY: 8,
|
|
392
|
-
CANCEL_RCVD_BY_EXCH_GTWY: 9,
|
|
393
|
-
ORDER_SENT_TO_EXCH: 10,
|
|
394
|
-
MODIFY_SENT_TO_EXCH: 11,
|
|
395
|
-
CANCEL_SENT_TO_EXCH: 12,
|
|
396
|
-
OPEN: 13,
|
|
397
|
-
MODIFIED: 14,
|
|
398
|
-
COMPLETE: 15, // Order completed/filled
|
|
399
|
-
MODIFICATION_FAILED: 16,
|
|
400
|
-
CANCELLATION_FAILED: 17,
|
|
401
|
-
TRIGGER_PENDING: 18,
|
|
402
|
-
GENERIC: 19,
|
|
403
|
-
LINK_ORDERS_FAILED: 20
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
// =============================================================================
|
|
407
|
-
// EXCHANGES
|
|
408
|
-
// =============================================================================
|
|
409
|
-
const EXCHANGES = {
|
|
410
|
-
CME: 'CME',
|
|
411
|
-
CBOT: 'CBOT',
|
|
412
|
-
NYMEX: 'NYMEX',
|
|
413
|
-
COMEX: 'COMEX',
|
|
414
|
-
EUREX: 'EUREX',
|
|
415
|
-
ICE: 'ICE'
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
// =============================================================================
|
|
419
|
-
// HELPER FUNCTIONS
|
|
420
|
-
// =============================================================================
|
|
421
|
-
// NO STATIC SYMBOL DATA - All contract info comes from Rithmic API
|
|
422
|
-
// P&L comes from PNL_PLANT - no local tick calculations needed
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Get PropFirm configuration by name
|
|
426
|
-
*/
|
|
427
|
-
function getPropFirmConfig(propfirmName) {
|
|
428
|
-
if (!propfirmName) return null;
|
|
429
|
-
|
|
430
|
-
const normalized = propfirmName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
431
|
-
|
|
432
|
-
// Direct key match
|
|
433
|
-
if (RITHMIC_PROPFIRMS[normalized]) {
|
|
434
|
-
return RITHMIC_PROPFIRMS[normalized];
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// Check all keys for partial match
|
|
438
|
-
for (const [key, config] of Object.entries(RITHMIC_PROPFIRMS)) {
|
|
439
|
-
const keyNorm = key.replace(/[^a-z0-9]/g, '');
|
|
440
|
-
// Check if input contains key or key contains input
|
|
441
|
-
if (normalized.includes(keyNorm) || keyNorm.includes(normalized)) {
|
|
442
|
-
return config;
|
|
443
|
-
}
|
|
444
|
-
// Also check displayName
|
|
445
|
-
if (config.displayName) {
|
|
446
|
-
const displayNorm = config.displayName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
447
|
-
if (normalized.includes(displayNorm) || displayNorm.includes(normalized)) {
|
|
448
|
-
return config;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
return null;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Check if a propfirm is Rithmic-based
|
|
458
|
-
*/
|
|
459
|
-
function isRithmicPropFirm(propfirmName) {
|
|
460
|
-
return getPropFirmConfig(propfirmName) !== null;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Get all supported Rithmic PropFirms
|
|
465
|
-
*/
|
|
466
|
-
function getSupportedPropFirms() {
|
|
467
|
-
const unique = new Map();
|
|
468
|
-
for (const [key, config] of Object.entries(RITHMIC_PROPFIRMS)) {
|
|
469
|
-
if (!unique.has(config.systemName)) {
|
|
470
|
-
unique.set(config.systemName, {
|
|
471
|
-
id: key,
|
|
472
|
-
...config
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
return Array.from(unique.values());
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Build Rithmic symbol from base + expiration
|
|
481
|
-
* @param {string} base - Base symbol (e.g., 'MNQ')
|
|
482
|
-
* @param {string} month - Month code (e.g., 'H' for March)
|
|
483
|
-
* @param {string} year - Year (e.g., '5' for 2025)
|
|
484
|
-
*/
|
|
485
|
-
function buildRithmicSymbol(base, month, year) {
|
|
486
|
-
// Rithmic uses single digit year (e.g., MNQH6 for March 2026)
|
|
487
|
-
const y = String(year).slice(-1);
|
|
488
|
-
return `${base.toUpperCase()}${month.toUpperCase()}${y}`;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Get current front month symbol
|
|
493
|
-
*/
|
|
494
|
-
function getCurrentFrontMonth(baseSymbol) {
|
|
495
|
-
const now = new Date();
|
|
496
|
-
const month = now.getMonth();
|
|
497
|
-
const year = now.getFullYear() % 100;
|
|
498
|
-
|
|
499
|
-
// Quarterly expiration months for index futures
|
|
500
|
-
const quarterlyMonths = ['H', 'M', 'U', 'Z']; // Mar, Jun, Sep, Dec
|
|
501
|
-
const quarterIndex = Math.floor(month / 3);
|
|
502
|
-
let frontMonth = quarterlyMonths[quarterIndex];
|
|
503
|
-
let frontYear = year;
|
|
504
|
-
|
|
505
|
-
// If we're past expiration (3rd Friday), use next quarter
|
|
506
|
-
const dayOfMonth = now.getDate();
|
|
507
|
-
if (dayOfMonth > 15 && [2, 5, 8, 11].includes(month)) {
|
|
508
|
-
const nextIdx = (quarterIndex + 1) % 4;
|
|
509
|
-
frontMonth = quarterlyMonths[nextIdx];
|
|
510
|
-
if (nextIdx === 0) frontYear++;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
return buildRithmicSymbol(baseSymbol, frontMonth, frontYear);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
module.exports = {
|
|
517
|
-
RITHMIC_GATEWAYS,
|
|
518
|
-
RITHMIC_PROPFIRMS,
|
|
519
|
-
TEMPLATE_IDS,
|
|
520
|
-
INFRA_TYPES,
|
|
521
|
-
ORDER_TYPES,
|
|
522
|
-
NOTIFY_TYPES,
|
|
523
|
-
RITHMIC_NOTIFY_TYPES,
|
|
524
|
-
EXCHANGES,
|
|
525
|
-
getPropFirmConfig,
|
|
526
|
-
isRithmicPropFirm,
|
|
527
|
-
getSupportedPropFirms,
|
|
528
|
-
buildRithmicSymbol,
|
|
529
|
-
getCurrentFrontMonth
|
|
530
|
-
};
|
package/src/lib/o/l1.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* L1 - Logging utilities
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const MSGS = {
|
|
6
|
-
info: ['Processing', 'Analyzing', 'Checking', 'Monitoring', 'Updating'],
|
|
7
|
-
signal: ['Signal detected', 'Entry point found', 'Condition met', 'Trigger active'],
|
|
8
|
-
trade: ['Order placed', 'Position opened', 'Trade executed', 'Entry confirmed'],
|
|
9
|
-
close: ['Position closed', 'Exit complete', 'Trade finished', 'Order filled']
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function getLog(type, data = {}) {
|
|
13
|
-
const msgs = MSGS[type] || MSGS.info;
|
|
14
|
-
const msg = msgs[Math.floor(Math.random() * msgs.length)];
|
|
15
|
-
return { type, message: msg, data, timestamp: Date.now() };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getSignalLog(dir, sym, conf, strat) {
|
|
19
|
-
return {
|
|
20
|
-
type: 'signal',
|
|
21
|
-
message: `${dir.toUpperCase()} ${sym}`,
|
|
22
|
-
details: `${conf.toFixed(0)}% | ${strat}`,
|
|
23
|
-
timestamp: Date.now()
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function getTradeLog(dir, sym, price, size) {
|
|
28
|
-
return {
|
|
29
|
-
type: 'trade',
|
|
30
|
-
message: `${dir.toUpperCase()} ${size} ${sym} @ ${price}`,
|
|
31
|
-
timestamp: Date.now()
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getCloseLog(pnl, sym) {
|
|
36
|
-
const type = pnl >= 0 ? 'win' : 'loss';
|
|
37
|
-
return {
|
|
38
|
-
type,
|
|
39
|
-
message: `Closed ${sym}: ${pnl >= 0 ? '+' : ''}$${pnl.toFixed(2)}`,
|
|
40
|
-
timestamp: Date.now()
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
module.exports = { getLog, getSignalLog, getTradeLog, getCloseLog, MSGS };
|