work on clean up and switched all to use eodSearchCode
This commit is contained in:
parent
d68268b722
commit
e341cc0226
19 changed files with 206 additions and 127 deletions
|
|
@ -1 +0,0 @@
|
|||
../../../node_modules
|
||||
|
|
@ -130,11 +130,9 @@ export async function fetchCorporateActions(
|
|||
}
|
||||
|
||||
// Build URL based on action type
|
||||
// Use utility function to handle US symbols and EUFUND special case
|
||||
const exchangeSuffix = getEodExchangeSuffix(exchange, country);
|
||||
|
||||
// eodSearchCode already contains the symbol with exchange suffix (e.g., AAPL.US)
|
||||
const endpoint = actionType === 'dividends' ? 'div' : 'splits';
|
||||
const url = new URL(`https://eodhd.com/api/${endpoint}/${symbol}.${exchangeSuffix}`);
|
||||
const url = new URL(`https://eodhd.com/api/${endpoint}/${eodSearchCode}`);
|
||||
url.searchParams.append('api_token', apiKey);
|
||||
url.searchParams.append('fmt', 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -139,18 +139,17 @@ export async function fetchBulkFundamentals(
|
|||
throw new Error('EOD API key not configured');
|
||||
}
|
||||
|
||||
// Group symbols by actual exchange for API endpoint, but use country for symbol suffix
|
||||
// Group symbols by actual exchange for API endpoint
|
||||
// eodSearchCode already contains the symbol with exchange suffix (e.g., AAPL.US)
|
||||
const exchangeGroups = symbolDocs.reduce((acc, symbolDoc) => {
|
||||
const symbol = symbolDoc.Code;
|
||||
const exchange = symbolDoc.eodExchange || symbolDoc.Exchange;
|
||||
const country = symbolDoc.Country;
|
||||
const eodSearchCode = symbolDoc.eodSearchCode;
|
||||
|
||||
if (!acc[exchange]) {
|
||||
acc[exchange] = [];
|
||||
}
|
||||
// Use utility function to handle US symbols and EUFUND special case
|
||||
const exchangeSuffix = getEodExchangeSuffix(exchange, country);
|
||||
acc[exchange].push(`${symbol}.${exchangeSuffix}`);
|
||||
// eodSearchCode already has the correct format (e.g., AAPL.US)
|
||||
acc[exchange].push(eodSearchCode);
|
||||
return acc;
|
||||
}, {} as Record<string, string[]>);
|
||||
|
||||
|
|
@ -309,10 +308,8 @@ export async function fetchSingleFundamentals(
|
|||
}
|
||||
|
||||
// Build URL for single fundamentals endpoint
|
||||
// Use utility function to handle US symbols and EUFUND special case
|
||||
const exchangeSuffix = getEodExchangeSuffix(exchange, country);
|
||||
|
||||
const url = new URL(`https://eodhd.com/api/fundamentals/${symbol}.${exchangeSuffix}`);
|
||||
// eodSearchCode already contains the symbol with exchange suffix (e.g., AAPL.US)
|
||||
const url = new URL(`https://eodhd.com/api/fundamentals/${eodSearchCode}`);
|
||||
url.searchParams.append('api_token', apiKey);
|
||||
url.searchParams.append('fmt', 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ export async function crawlIntraday(
|
|||
finished: updateData.finished
|
||||
};
|
||||
} catch (error) {
|
||||
logger.error('Failed to crawl intraday data', { error, symbol, exchange, interval });
|
||||
logger.error('Failed to crawl intraday data', { error, eodSearchCode, interval });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import { createEODOperationRegistry } from './shared';
|
|||
],
|
||||
})
|
||||
export class EodHandler extends BaseHandler<DataIngestionServices> {
|
||||
public operationRegistry: OperationRegistry;
|
||||
public operationRegistry!: OperationRegistry;
|
||||
|
||||
constructor(services: any) {
|
||||
super(services);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import { createQMOperationRegistry } from './shared/operation-provider';
|
|||
@Handler('qm')
|
||||
@Disabled() // Disable by default, enable specific operations as needed
|
||||
export class QMHandler extends BaseHandler<DataIngestionServices> {
|
||||
public operationRegistry: OperationRegistry;
|
||||
public operationRegistry!: OperationRegistry;
|
||||
|
||||
constructor(services: any) {
|
||||
super(services); // Handler name read from @Handler decorator
|
||||
|
|
|
|||
|
|
@ -7,11 +7,10 @@ import { BaseOperationProvider } from './BaseOperationProvider';
|
|||
import { OperationTracker } from './OperationTracker';
|
||||
import type {
|
||||
OperationComponentOptions,
|
||||
OperationUpdate,
|
||||
StaleSymbolOptions,
|
||||
BulkOperationUpdate,
|
||||
OperationConfig,
|
||||
OperationStats,
|
||||
OperationConfig
|
||||
OperationUpdate,
|
||||
StaleSymbolOptions
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue