removed unified exchange
This commit is contained in:
parent
265e10a658
commit
f69c7b034b
3 changed files with 4 additions and 49 deletions
|
|
@ -162,19 +162,15 @@ export class EnhancedSyncManager {
|
|||
// Start transaction for atomic operations
|
||||
await this.postgresClient.query('BEGIN');
|
||||
|
||||
// 1. Sync from unified exchanges collection (primary source)
|
||||
const unifiedResult = await this.syncUnifiedExchanges();
|
||||
this.mergeResults(result, unifiedResult);
|
||||
|
||||
// 2. Sync from EOD exchanges (comprehensive global data)
|
||||
// 1. Sync from EOD exchanges (comprehensive global data)
|
||||
const eodResult = await this.syncEODExchanges();
|
||||
this.mergeResults(result, eodResult);
|
||||
|
||||
// 3. Sync from IB exchanges (detailed asset information)
|
||||
// 2. Sync from IB exchanges (detailed asset information)
|
||||
const ibResult = await this.syncIBExchanges();
|
||||
this.mergeResults(result, ibResult);
|
||||
|
||||
// 4. Update sync status
|
||||
// 3. Update sync status
|
||||
await this.updateSyncStatus('all', 'exchanges', result.processed);
|
||||
|
||||
await this.postgresClient.query('COMMIT');
|
||||
|
|
@ -418,33 +414,6 @@ export class EnhancedSyncManager {
|
|||
logger.info(`Loaded ${this.exchangeCache.size} exchanges into cache`);
|
||||
}
|
||||
|
||||
private async syncUnifiedExchanges(): Promise<SyncResult> {
|
||||
const db = this.getMongoDatabase();
|
||||
const exchanges = await db.collection('exchanges').find({}).toArray();
|
||||
const result: SyncResult = { processed: 0, created: 0, updated: 0, skipped: 0, errors: 0 };
|
||||
|
||||
for (const exchange of exchanges) {
|
||||
try {
|
||||
// Create provider exchange mapping for unified collection
|
||||
await this.createProviderExchangeMapping(
|
||||
'unified', // provider
|
||||
exchange.sourceCode || exchange.code,
|
||||
exchange.sourceName || exchange.name,
|
||||
exchange.sourceRegion,
|
||||
null, // currency not in unified
|
||||
0.9 // high confidence for unified mappings
|
||||
);
|
||||
|
||||
result.processed++;
|
||||
result.created++; // Count as created mapping
|
||||
} catch (error) {
|
||||
logger.error('Failed to process unified exchange', { error, exchange });
|
||||
result.errors++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async syncEODExchanges(): Promise<SyncResult> {
|
||||
const db = this.getMongoDatabase();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue