hedgequantx 2.6.161 → 2.6.163

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.
Files changed (57) hide show
  1. package/package.json +1 -1
  2. package/src/menus/ai-agent-connect.js +181 -0
  3. package/src/menus/ai-agent-models.js +219 -0
  4. package/src/menus/ai-agent-oauth.js +292 -0
  5. package/src/menus/ai-agent-ui.js +141 -0
  6. package/src/menus/ai-agent.js +88 -1489
  7. package/src/pages/algo/copy-engine.js +449 -0
  8. package/src/pages/algo/copy-trading.js +11 -543
  9. package/src/pages/algo/smart-logs-data.js +218 -0
  10. package/src/pages/algo/smart-logs.js +9 -214
  11. package/src/pages/algo/ui-constants.js +144 -0
  12. package/src/pages/algo/ui-summary.js +184 -0
  13. package/src/pages/algo/ui.js +42 -526
  14. package/src/pages/stats-calculations.js +191 -0
  15. package/src/pages/stats-ui.js +381 -0
  16. package/src/pages/stats.js +14 -507
  17. package/src/services/ai/client-analysis.js +194 -0
  18. package/src/services/ai/client-models.js +333 -0
  19. package/src/services/ai/client.js +6 -489
  20. package/src/services/ai/index.js +2 -257
  21. package/src/services/ai/providers/direct-providers.js +323 -0
  22. package/src/services/ai/providers/index.js +8 -472
  23. package/src/services/ai/providers/other-providers.js +104 -0
  24. package/src/services/ai/proxy-install.js +249 -0
  25. package/src/services/ai/proxy-manager.js +29 -411
  26. package/src/services/ai/proxy-remote.js +161 -0
  27. package/src/services/ai/supervisor-optimize.js +215 -0
  28. package/src/services/ai/supervisor-sync.js +178 -0
  29. package/src/services/ai/supervisor.js +50 -515
  30. package/src/services/ai/validation.js +250 -0
  31. package/src/services/hqx-server-events.js +110 -0
  32. package/src/services/hqx-server-handlers.js +217 -0
  33. package/src/services/hqx-server-latency.js +136 -0
  34. package/src/services/hqx-server.js +51 -403
  35. package/src/services/position-constants.js +28 -0
  36. package/src/services/position-exit-logic.js +174 -0
  37. package/src/services/position-manager.js +90 -629
  38. package/src/services/position-momentum.js +206 -0
  39. package/src/services/projectx/accounts.js +142 -0
  40. package/src/services/projectx/index.js +40 -289
  41. package/src/services/projectx/trading.js +180 -0
  42. package/src/services/rithmic/contracts.js +218 -0
  43. package/src/services/rithmic/handlers.js +2 -208
  44. package/src/services/rithmic/index.js +28 -712
  45. package/src/services/rithmic/latency-tracker.js +182 -0
  46. package/src/services/rithmic/market-data-decoders.js +229 -0
  47. package/src/services/rithmic/market-data.js +1 -278
  48. package/src/services/rithmic/orders-fast.js +246 -0
  49. package/src/services/rithmic/orders.js +1 -251
  50. package/src/services/rithmic/proto-decoders.js +403 -0
  51. package/src/services/rithmic/protobuf.js +7 -443
  52. package/src/services/rithmic/specs.js +146 -0
  53. package/src/services/rithmic/trade-history.js +254 -0
  54. package/src/services/strategy/hft-signal-calc.js +147 -0
  55. package/src/services/strategy/hft-tick.js +33 -133
  56. package/src/services/tradovate/index.js +6 -119
  57. package/src/services/tradovate/orders.js +145 -0
@@ -6,479 +6,15 @@
6
6
  * No hardcoded model lists allowed (see RULES.md)
7
7
  */
8
8
 
9
- const PROVIDERS = {
10
- // ========== UNIFIED PROVIDERS (RECOMMENDED) ==========
11
- openrouter: {
12
- id: 'openrouter',
13
- name: 'OPENROUTER (RECOMMENDED)',
14
- description: '1 API key for 100+ models',
15
- category: 'unified',
16
- models: [], // Fetched from API at runtime
17
- defaultModel: null, // Will use first model from API
18
- options: [
19
- {
20
- id: 'api_key',
21
- label: 'API KEY',
22
- description: [
23
- 'Get key at openrouter.ai/keys',
24
- 'Access to Claude, GPT-4, Gemini, Llama & more',
25
- 'Pay-per-use, no subscriptions'
26
- ],
27
- fields: ['apiKey'],
28
- url: 'https://openrouter.ai/keys'
29
- }
30
- ],
31
- endpoint: 'https://openrouter.ai/api/v1'
32
- },
33
-
34
- // ========== DIRECT PROVIDERS ==========
35
- anthropic: {
36
- id: 'anthropic',
37
- name: 'CLAUDE (ANTHROPIC)',
38
- description: 'Pro/Max or API Key',
39
- category: 'direct',
40
- models: [], // Fetched from API at runtime
41
- defaultModel: null, // Will use first model from API
42
- options: [
43
- {
44
- id: 'oauth_max',
45
- label: 'CLAUDE PRO/MAX (OAUTH)',
46
- description: [
47
- 'Login with your Claude subscription',
48
- 'Unlimited usage with your plan'
49
- ],
50
- fields: ['oauth'],
51
- authType: 'oauth'
52
- },
53
- {
54
- id: 'api_key',
55
- label: 'API KEY (PAY-PER-USE)',
56
- description: [
57
- 'Get key at console.anthropic.com',
58
- '~$0.10 per trading session'
59
- ],
60
- fields: ['apiKey'],
61
- url: 'https://console.anthropic.com/settings/keys'
62
- }
63
- ],
64
- endpoint: 'https://api.anthropic.com/v1'
65
- },
66
-
67
- openai: {
68
- id: 'openai',
69
- name: 'OPENAI (GPT-4/5)',
70
- description: 'Plus/Pro or API Key',
71
- category: 'direct',
72
- models: [], // Fetched from API at runtime
73
- defaultModel: null, // Will use first model from API
74
- options: [
75
- {
76
- id: 'oauth_plus',
77
- label: 'PLUS/PRO SUBSCRIPTION (OAUTH)',
78
- description: [
79
- 'Login with your ChatGPT account',
80
- 'Unlimited with your plan'
81
- ],
82
- fields: ['oauth'],
83
- authType: 'oauth'
84
- },
85
- {
86
- id: 'api_key',
87
- label: 'API KEY (PAY-PER-USE)',
88
- description: [
89
- 'Get key at platform.openai.com',
90
- '~$0.15 per trading session'
91
- ],
92
- fields: ['apiKey'],
93
- url: 'https://platform.openai.com/api-keys'
94
- }
95
- ],
96
- endpoint: 'https://api.openai.com/v1'
97
- },
98
-
99
- gemini: {
100
- id: 'gemini',
101
- name: 'GEMINI (GOOGLE)',
102
- description: 'Advanced or API Key',
103
- category: 'direct',
104
- models: [], // Fetched from API at runtime
105
- defaultModel: null, // Will use first model from API
106
- options: [
107
- {
108
- id: 'oauth_advanced',
109
- label: 'ADVANCED SUBSCRIPTION (OAUTH)',
110
- description: [
111
- 'Login with your Google account',
112
- 'Unlimited with your plan'
113
- ],
114
- fields: ['oauth'],
115
- authType: 'oauth'
116
- },
117
- {
118
- id: 'api_key',
119
- label: 'API KEY (FREE TIER)',
120
- description: [
121
- 'Get key at aistudio.google.com',
122
- 'Free tier: 60 requests/min'
123
- ],
124
- fields: ['apiKey'],
125
- url: 'https://aistudio.google.com/apikey'
126
- }
127
- ],
128
- endpoint: 'https://generativelanguage.googleapis.com/v1'
129
- },
130
-
131
- deepseek: {
132
- id: 'deepseek',
133
- name: 'DEEPSEEK',
134
- description: 'Very cheap & capable',
135
- category: 'direct',
136
- models: [], // Fetched from API at runtime
137
- defaultModel: null, // Will use first model from API
138
- options: [
139
- {
140
- id: 'api_key',
141
- label: 'API KEY (VERY CHEAP)',
142
- description: [
143
- 'Get key at platform.deepseek.com',
144
- '~$0.02 per trading session'
145
- ],
146
- fields: ['apiKey'],
147
- url: 'https://platform.deepseek.com'
148
- }
149
- ],
150
- endpoint: 'https://api.deepseek.com/v1'
151
- },
152
-
153
- groq: {
154
- id: 'groq',
155
- name: 'GROQ',
156
- description: 'Ultra fast inference',
157
- category: 'direct',
158
- models: [], // Fetched from API at runtime
159
- defaultModel: null, // Will use first model from API
160
- options: [
161
- {
162
- id: 'api_key',
163
- label: 'API KEY (FREE TIER)',
164
- description: [
165
- 'Get key at console.groq.com',
166
- 'Generous free tier',
167
- 'Ultra low latency'
168
- ],
169
- fields: ['apiKey'],
170
- url: 'https://console.groq.com/keys'
171
- }
172
- ],
173
- endpoint: 'https://api.groq.com/openai/v1'
174
- },
175
-
176
- xai: {
177
- id: 'xai',
178
- name: 'GROK (XAI)',
179
- description: 'Elon Musk\'s Grok AI',
180
- category: 'direct',
181
- models: [], // Fetched from API at runtime
182
- defaultModel: null, // Will use first model from API
183
- options: [
184
- {
185
- id: 'api_key',
186
- label: 'API KEY',
187
- description: [
188
- 'Get key at console.x.ai',
189
- 'Grok models from xAI'
190
- ],
191
- fields: ['apiKey'],
192
- url: 'https://console.x.ai'
193
- }
194
- ],
195
- endpoint: 'https://api.x.ai/v1'
196
- },
197
-
198
- mistral: {
199
- id: 'mistral',
200
- name: 'MISTRAL',
201
- description: 'European AI leader',
202
- category: 'direct',
203
- models: [], // Fetched from API at runtime
204
- defaultModel: null, // Will use first model from API
205
- options: [
206
- {
207
- id: 'api_key',
208
- label: 'API KEY',
209
- description: [
210
- 'Get key at console.mistral.ai',
211
- 'Fast European models'
212
- ],
213
- fields: ['apiKey'],
214
- url: 'https://console.mistral.ai'
215
- }
216
- ],
217
- endpoint: 'https://api.mistral.ai/v1'
218
- },
219
-
220
- perplexity: {
221
- id: 'perplexity',
222
- name: 'PERPLEXITY',
223
- description: 'Real-time web search AI',
224
- category: 'direct',
225
- models: [], // Fetched from API at runtime
226
- defaultModel: null, // Will use first model from API
227
- options: [
228
- {
229
- id: 'api_key',
230
- label: 'API KEY',
231
- description: [
232
- 'Get key at perplexity.ai/settings/api',
233
- 'Real-time market news & data',
234
- 'Web search integrated'
235
- ],
236
- fields: ['apiKey'],
237
- url: 'https://www.perplexity.ai/settings/api'
238
- }
239
- ],
240
- endpoint: 'https://api.perplexity.ai'
241
- },
242
-
243
- together: {
244
- id: 'together',
245
- name: 'TOGETHER AI',
246
- description: 'Open source models, fast & cheap',
247
- category: 'direct',
248
- models: [], // Fetched from API at runtime
249
- defaultModel: null, // Will use first model from API
250
- options: [
251
- {
252
- id: 'api_key',
253
- label: 'API KEY',
254
- description: [
255
- 'Get key at api.together.xyz',
256
- '100+ open source models',
257
- 'Fast inference, good pricing'
258
- ],
259
- fields: ['apiKey'],
260
- url: 'https://api.together.xyz/settings/api-keys'
261
- }
262
- ],
263
- endpoint: 'https://api.together.xyz/v1'
264
- },
265
-
266
- iflow: {
267
- id: 'iflow',
268
- name: 'IFLOW',
269
- description: 'Subscription (OAuth)',
270
- category: 'direct',
271
- models: [], // Fetched from API at runtime
272
- defaultModel: null, // Will use first model from API
273
- options: [
274
- {
275
- id: 'oauth_sub',
276
- label: 'SUBSCRIPTION (OAUTH)',
277
- description: [
278
- 'Login with your iFlow account',
279
- 'Access to DeepSeek, Kimi, GLM & more'
280
- ],
281
- fields: ['oauth'],
282
- authType: 'oauth'
283
- }
284
- ],
285
- endpoint: 'https://api.iflow.com/v1'
286
- },
287
-
9
+ const { DIRECT_PROVIDERS } = require('./direct-providers');
10
+ const { UNIFIED_PROVIDERS, LOCAL_PROVIDERS, CUSTOM_PROVIDERS } = require('./other-providers');
288
11
 
289
- qwen: {
290
- id: 'qwen',
291
- name: 'QWEN (ALIBABA)',
292
- description: 'Chat subscription or API Key',
293
- category: 'direct',
294
- models: [], // Fetched from API at runtime
295
- defaultModel: null, // Will use first model from API
296
- options: [
297
- {
298
- id: 'oauth_chat',
299
- label: 'CHAT SUBSCRIPTION (OAUTH)',
300
- description: [
301
- 'Login with your Qwen account',
302
- 'Unlimited with your plan'
303
- ],
304
- fields: ['oauth'],
305
- authType: 'oauth'
306
- },
307
- {
308
- id: 'api_key',
309
- label: 'API KEY (DASHSCOPE)',
310
- description: [
311
- 'Get key at dashscope.aliyun.com',
312
- 'Qwen2.5 models',
313
- 'Very competitive pricing'
314
- ],
315
- fields: ['apiKey'],
316
- url: 'https://dashscope.console.aliyun.com/apiKey'
317
- }
318
- ],
319
- endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1'
320
- },
321
-
322
- moonshot: {
323
- id: 'moonshot',
324
- name: 'MOONSHOT (KIMI)',
325
- description: '200K context window',
326
- category: 'direct',
327
- models: [], // Fetched from API at runtime
328
- defaultModel: null, // Will use first model from API
329
- options: [
330
- {
331
- id: 'api_key',
332
- label: 'API KEY',
333
- description: [
334
- 'Get key at platform.moonshot.cn',
335
- 'Up to 200K context',
336
- 'Good for long documents'
337
- ],
338
- fields: ['apiKey'],
339
- url: 'https://platform.moonshot.cn/console/api-keys'
340
- }
341
- ],
342
- endpoint: 'https://api.moonshot.cn/v1'
343
- },
344
-
345
- yi: {
346
- id: 'yi',
347
- name: '01.AI (YI)',
348
- description: 'Yi models by Kai-Fu Lee',
349
- category: 'direct',
350
- models: [], // Fetched from API at runtime
351
- defaultModel: null, // Will use first model from API
352
- options: [
353
- {
354
- id: 'api_key',
355
- label: 'API KEY',
356
- description: [
357
- 'Get key at platform.01.ai',
358
- 'Yi-Large: GPT-4 level',
359
- 'Affordable pricing'
360
- ],
361
- fields: ['apiKey'],
362
- url: 'https://platform.01.ai'
363
- }
364
- ],
365
- endpoint: 'https://api.01.ai/v1'
366
- },
367
-
368
- zhipu: {
369
- id: 'zhipu',
370
- name: 'ZHIPU AI (GLM)',
371
- description: 'ChatGLM models',
372
- category: 'direct',
373
- models: [], // Fetched from API at runtime
374
- defaultModel: null, // Will use first model from API
375
- options: [
376
- {
377
- id: 'api_key',
378
- label: 'API KEY',
379
- description: [
380
- 'Get key at open.bigmodel.cn',
381
- 'ChatGLM-4 models',
382
- 'Strong multilingual'
383
- ],
384
- fields: ['apiKey'],
385
- url: 'https://open.bigmodel.cn/usercenter/apikeys'
386
- }
387
- ],
388
- endpoint: 'https://open.bigmodel.cn/api/paas/v4'
389
- },
390
-
391
- baichuan: {
392
- id: 'baichuan',
393
- name: 'BAICHUAN',
394
- description: 'Multilingual AI model',
395
- category: 'direct',
396
- models: [], // Fetched from API at runtime
397
- defaultModel: null, // Will use first model from API
398
- options: [
399
- {
400
- id: 'api_key',
401
- label: 'API KEY',
402
- description: [
403
- 'Get key at platform.baichuan-ai.com',
404
- 'Strong multilingual support',
405
- 'Competitive pricing'
406
- ],
407
- fields: ['apiKey'],
408
- url: 'https://platform.baichuan-ai.com/console/apikey'
409
- }
410
- ],
411
- endpoint: 'https://api.baichuan-ai.com/v1'
412
- },
413
-
414
- // ========== LOCAL / FREE ==========
415
- ollama: {
416
- id: 'ollama',
417
- name: 'OLLAMA (LOCAL - FREE)',
418
- description: '100% free, runs locally',
419
- category: 'local',
420
- models: [], // Fetched from local API at runtime
421
- defaultModel: null, // Will use first model from API
422
- options: [
423
- {
424
- id: 'local',
425
- label: 'LOCAL INSTALLATION (FREE)',
426
- description: [
427
- 'Download at ollama.ai',
428
- '100% free, no API key needed',
429
- 'Run: ollama pull llama3.1'
430
- ],
431
- fields: ['endpoint'],
432
- url: 'https://ollama.ai',
433
- defaultEndpoint: 'http://localhost:11434'
434
- }
435
- ]
436
- },
437
-
438
- lmstudio: {
439
- id: 'lmstudio',
440
- name: 'LM STUDIO (LOCAL - FREE)',
441
- description: 'Local with GUI',
442
- category: 'local',
443
- models: [], // Fetched from local API at runtime
444
- defaultModel: null, // Will use first model from API
445
- options: [
446
- {
447
- id: 'local',
448
- label: 'LOCAL SERVER (FREE)',
449
- description: [
450
- 'Download at lmstudio.ai',
451
- 'GUI for local models',
452
- 'OpenAI-compatible API'
453
- ],
454
- fields: ['endpoint'],
455
- url: 'https://lmstudio.ai',
456
- defaultEndpoint: 'http://localhost:1234/v1'
457
- }
458
- ]
459
- },
460
-
461
- // ========== CUSTOM ==========
462
- custom: {
463
- id: 'custom',
464
- name: 'CUSTOM ENDPOINT',
465
- description: 'Any OpenAI-compatible API',
466
- category: 'custom',
467
- models: [], // User must specify model
468
- defaultModel: null,
469
- options: [
470
- {
471
- id: 'custom',
472
- label: 'CUSTOM OPENAI-COMPATIBLE API',
473
- description: [
474
- 'Self-hosted models',
475
- 'vLLM, TGI, etc.',
476
- 'Any OpenAI-compatible endpoint'
477
- ],
478
- fields: ['endpoint', 'apiKey', 'model']
479
- }
480
- ]
481
- }
12
+ // Combine all providers
13
+ const PROVIDERS = {
14
+ ...UNIFIED_PROVIDERS,
15
+ ...DIRECT_PROVIDERS,
16
+ ...LOCAL_PROVIDERS,
17
+ ...CUSTOM_PROVIDERS,
482
18
  };
483
19
 
484
20
  /**
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Other AI Providers Configuration
3
+ * @module services/ai/providers/other-providers
4
+ *
5
+ * Unified, local, and custom provider configurations
6
+ */
7
+
8
+ const UNIFIED_PROVIDERS = {
9
+ openrouter: {
10
+ id: 'openrouter',
11
+ name: 'OPENROUTER (RECOMMENDED)',
12
+ description: '1 API key for 100+ models',
13
+ category: 'unified',
14
+ models: [],
15
+ defaultModel: null,
16
+ options: [
17
+ {
18
+ id: 'api_key',
19
+ label: 'API KEY',
20
+ description: [
21
+ 'Get key at openrouter.ai/keys',
22
+ 'Access to Claude, GPT-4, Gemini, Llama & more',
23
+ 'Pay-per-use, no subscriptions'
24
+ ],
25
+ fields: ['apiKey'],
26
+ url: 'https://openrouter.ai/keys'
27
+ }
28
+ ],
29
+ endpoint: 'https://openrouter.ai/api/v1'
30
+ },
31
+ };
32
+
33
+ const LOCAL_PROVIDERS = {
34
+ ollama: {
35
+ id: 'ollama',
36
+ name: 'OLLAMA (LOCAL - FREE)',
37
+ description: '100% free, runs locally',
38
+ category: 'local',
39
+ models: [],
40
+ defaultModel: null,
41
+ options: [
42
+ {
43
+ id: 'local',
44
+ label: 'LOCAL INSTALLATION (FREE)',
45
+ description: [
46
+ 'Download at ollama.ai',
47
+ '100% free, no API key needed',
48
+ 'Run: ollama pull llama3.1'
49
+ ],
50
+ fields: ['endpoint'],
51
+ url: 'https://ollama.ai',
52
+ defaultEndpoint: 'http://localhost:11434'
53
+ }
54
+ ]
55
+ },
56
+
57
+ lmstudio: {
58
+ id: 'lmstudio',
59
+ name: 'LM STUDIO (LOCAL - FREE)',
60
+ description: 'Local with GUI',
61
+ category: 'local',
62
+ models: [],
63
+ defaultModel: null,
64
+ options: [
65
+ {
66
+ id: 'local',
67
+ label: 'LOCAL SERVER (FREE)',
68
+ description: [
69
+ 'Download at lmstudio.ai',
70
+ 'GUI for local models',
71
+ 'OpenAI-compatible API'
72
+ ],
73
+ fields: ['endpoint'],
74
+ url: 'https://lmstudio.ai',
75
+ defaultEndpoint: 'http://localhost:1234/v1'
76
+ }
77
+ ]
78
+ },
79
+ };
80
+
81
+ const CUSTOM_PROVIDERS = {
82
+ custom: {
83
+ id: 'custom',
84
+ name: 'CUSTOM ENDPOINT',
85
+ description: 'Any OpenAI-compatible API',
86
+ category: 'custom',
87
+ models: [],
88
+ defaultModel: null,
89
+ options: [
90
+ {
91
+ id: 'custom',
92
+ label: 'CUSTOM OPENAI-COMPATIBLE API',
93
+ description: [
94
+ 'Self-hosted models',
95
+ 'vLLM, TGI, etc.',
96
+ 'Any OpenAI-compatible endpoint'
97
+ ],
98
+ fields: ['endpoint', 'apiKey', 'model']
99
+ }
100
+ ]
101
+ }
102
+ };
103
+
104
+ module.exports = { UNIFIED_PROVIDERS, LOCAL_PROVIDERS, CUSTOM_PROVIDERS };