hedgequantx 1.8.13 → 1.8.14
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/pages/algo/one-account.js +11 -18
package/package.json
CHANGED
|
@@ -71,34 +71,27 @@ const oneAccountMenu = async (service) => {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* Symbol selection
|
|
74
|
+
* Symbol selection - same as copy-trading
|
|
75
75
|
*/
|
|
76
76
|
const selectSymbol = async (service, account) => {
|
|
77
|
-
const spinner = ora({ text: 'Loading
|
|
77
|
+
const spinner = ora({ text: 'Loading symbols...', color: 'yellow' }).start();
|
|
78
78
|
|
|
79
79
|
const contractsResult = await service.getContracts();
|
|
80
|
-
if (!contractsResult.success) {
|
|
80
|
+
if (!contractsResult.success || !contractsResult.contracts?.length) {
|
|
81
81
|
spinner.fail('Failed to load contracts');
|
|
82
82
|
return null;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
// Normalize contract structure - API returns { name: "ESH6", description: "E-mini S&P 500..." }
|
|
86
|
+
const contracts = contractsResult.contracts.map(c => ({
|
|
87
|
+
...c,
|
|
88
|
+
symbol: c.name || c.symbol,
|
|
89
|
+
name: c.description || c.name || c.symbol
|
|
90
|
+
}));
|
|
86
91
|
|
|
87
|
-
|
|
88
|
-
const categories = {};
|
|
89
|
-
for (const c of contractsResult.contracts) {
|
|
90
|
-
const cat = c.group || 'Other';
|
|
91
|
-
if (!categories[cat]) categories[cat] = [];
|
|
92
|
-
categories[cat].push(c);
|
|
93
|
-
}
|
|
92
|
+
spinner.succeed(`Found ${contracts.length} contracts`);
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
const options = [];
|
|
97
|
-
for (const [cat, contracts] of Object.entries(categories)) {
|
|
98
|
-
for (const c of contracts.slice(0, 10)) {
|
|
99
|
-
options.push({ label: `[${cat}] ${c.name || c.symbol}`, value: c });
|
|
100
|
-
}
|
|
101
|
-
}
|
|
94
|
+
const options = contracts.map(c => ({ label: c.name, value: c }));
|
|
102
95
|
options.push({ label: '< Back', value: 'back' });
|
|
103
96
|
|
|
104
97
|
const contract = await prompts.selectOption('Select Symbol:', options);
|