fixing up db's and data-service
This commit is contained in:
parent
aca98fdce4
commit
71f9b0a886
9 changed files with 211 additions and 19 deletions
|
|
@ -321,7 +321,7 @@ async function searchQMSymbolsAPI(query: string): Promise<string[]> {
|
|||
}
|
||||
|
||||
const symbols = await response.json();
|
||||
const client = getMongoDBClient();
|
||||
const mongoClient = getMongoDBClient();
|
||||
const updatedSymbols = symbols.map((symbol: any) => {
|
||||
return {
|
||||
...symbol,
|
||||
|
|
@ -329,7 +329,7 @@ async function searchQMSymbolsAPI(query: string): Promise<string[]> {
|
|||
symbol: symbol.symbol.split(':')[0], // Extract symbol from "symbol:exchange"
|
||||
};
|
||||
});
|
||||
await client.batchUpsert('qmSymbols', updatedSymbols, ['qmSearchCode']);
|
||||
await mongoClient.batchUpsert('qmSymbols', updatedSymbols, ['qmSearchCode']);
|
||||
const exchanges: Exchange[] = [];
|
||||
for (const symbol of symbols) {
|
||||
if (!exchanges.some(ex => ex.exchange === symbol.exchange)) {
|
||||
|
|
@ -342,7 +342,7 @@ async function searchQMSymbolsAPI(query: string): Promise<string[]> {
|
|||
});
|
||||
}
|
||||
}
|
||||
await client.batchUpsert('qmExchanges', exchanges, ['exchange']);
|
||||
await mongoClient.batchUpsert('qmExchanges', exchanges, ['exchange']);
|
||||
session.successfulCalls++;
|
||||
session.lastUsed = new Date();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue