hedgequantx 1.8.4 → 1.8.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -137,26 +137,46 @@ const copyTradingMenu = async () => {
137
137
  });
138
138
  };
139
139
 
140
+ // Cached contracts from API
141
+ let cachedContracts = null;
142
+
140
143
  /**
141
- * Symbol selection helper
144
+ * Get contracts from ProjectX API (shared for all services)
145
+ */
146
+ const getContractsFromAPI = async () => {
147
+ if (cachedContracts) return cachedContracts;
148
+
149
+ // Find a ProjectX connection to get contracts from API
150
+ const allConns = connections.getAll();
151
+ const projectxConn = allConns.find(c => c.type === 'projectx');
152
+
153
+ if (projectxConn && typeof projectxConn.service.getContracts === 'function') {
154
+ const result = await projectxConn.service.getContracts();
155
+ if (result.success && result.contracts?.length > 0) {
156
+ cachedContracts = result.contracts;
157
+ return cachedContracts;
158
+ }
159
+ }
160
+
161
+ return null;
162
+ };
163
+
164
+ /**
165
+ * Symbol selection helper - uses API contracts for all services
142
166
  */
143
167
  const selectSymbol = async (service, label) => {
144
168
  try {
145
- let contracts = [];
169
+ // Always use contracts from ProjectX API for consistency
170
+ let contracts = await getContractsFromAPI();
146
171
 
147
- if (typeof service.getContracts === 'function') {
172
+ // Fallback to service's own contracts if no ProjectX available
173
+ if (!contracts && typeof service.getContracts === 'function') {
148
174
  const result = await service.getContracts();
149
175
  if (result.success && result.contracts?.length > 0) {
150
176
  contracts = result.contracts;
151
177
  }
152
178
  }
153
179
 
154
- if (contracts.length === 0 && typeof service.searchContracts === 'function') {
155
- const searchResult = await service.searchContracts('ES');
156
- if (Array.isArray(searchResult)) contracts = searchResult;
157
- else if (searchResult?.contracts) contracts = searchResult.contracts;
158
- }
159
-
160
180
  if (!contracts || contracts.length === 0) {
161
181
  console.log(chalk.red(' No contracts available'));
162
182
  return null;
@@ -216,17 +216,16 @@ class RithmicService extends EventEmitter {
216
216
  * For now, returns common futures contracts that are available on Rithmic
217
217
  */
218
218
  async getContracts() {
219
- // These are the standard Rithmic contract symbols
220
- // In production, this should connect to TICKER_PLANT
219
+ // Standard futures contracts - same list as ProjectX for consistency
221
220
  const contracts = [
222
221
  { symbol: 'ESH5', name: 'E-mini S&P 500 (Mar 25)', exchange: 'CME' },
223
222
  { symbol: 'NQH5', name: 'E-mini NASDAQ-100 (Mar 25)', exchange: 'CME' },
224
223
  { symbol: 'MESH5', name: 'Micro E-mini S&P 500 (Mar 25)', exchange: 'CME' },
225
224
  { symbol: 'MNQH5', name: 'Micro E-mini NASDAQ-100 (Mar 25)', exchange: 'CME' },
226
- { symbol: 'RTYH5', name: 'E-mini Russell 2000 (Mar 25)', exchange: 'CME' },
227
- { symbol: 'YMH5', name: 'E-mini Dow Jones (Mar 25)', exchange: 'CBOT' },
228
225
  { symbol: 'CLG5', name: 'Crude Oil (Feb 25)', exchange: 'NYMEX' },
229
226
  { symbol: 'GCG5', name: 'Gold (Feb 25)', exchange: 'COMEX' },
227
+ { symbol: 'RTYH5', name: 'E-mini Russell 2000 (Mar 25)', exchange: 'CME' },
228
+ { symbol: 'YMH5', name: 'E-mini Dow Jones (Mar 25)', exchange: 'CBOT' },
230
229
  { symbol: 'SIH5', name: 'Silver (Mar 25)', exchange: 'COMEX' },
231
230
  { symbol: 'NGG5', name: 'Natural Gas (Feb 25)', exchange: 'NYMEX' },
232
231
  ];