Skip to content

Commit

Permalink
Add config for stockToIgnore
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag-roy committed Feb 28, 2023
1 parent 2764872 commit eb6aac3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const stocksToExclude = [
'NIFTY',
'BANKNIFTY',
'ADANIENT',
'ADANIPORTS',
'FINNIFTY',
'MIDCPNIFTY',
];
3 changes: 2 additions & 1 deletion src/pages/api/refreshData.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { stocksToExclude } from '@/config';
import { kc } from '@/globals/kc';
import { mapInstrument } from '@/utils/api';
import { NextApiHandler } from 'next';
Expand All @@ -6,7 +7,7 @@ import { writeFileSync } from 'node:fs';
const handler: NextApiHandler = async (req, res) => {
const nfoInstruments = await kc.getInstruments(['NFO']);
const filteredNfoInstruments = nfoInstruments.filter(
(i) => i.instrument_type === 'FUT' && !i.tradingsymbol.includes('NIFTY')
(i) => i.instrument_type === 'FUT' && !stocksToExclude.includes(i.name)
);

const uniqueNames = new Set(filteredNfoInstruments.map((i) => i.name));
Expand Down

0 comments on commit eb6aac3

Please sign in to comment.