nse-bse-api 0.1.0
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/LICENSE +21 -0
- package/README.md +194 -0
- package/dist/bse/BSE.d.ts +141 -0
- package/dist/bse/BSE.d.ts.map +1 -0
- package/dist/bse/BSE.js +453 -0
- package/dist/bse/BSE.js.map +1 -0
- package/dist/bse/constants/index.d.ts +341 -0
- package/dist/bse/constants/index.d.ts.map +1 -0
- package/dist/bse/constants/index.js +341 -0
- package/dist/bse/constants/index.js.map +1 -0
- package/dist/bse/index.d.ts +12 -0
- package/dist/bse/index.d.ts.map +1 -0
- package/dist/bse/index.js +16 -0
- package/dist/bse/index.js.map +1 -0
- package/dist/bse/types/index.d.ts +120 -0
- package/dist/bse/types/index.d.ts.map +1 -0
- package/dist/bse/types/index.js +20 -0
- package/dist/bse/types/index.js.map +1 -0
- package/dist/bse/utils/SymbolParser.d.ts +16 -0
- package/dist/bse/utils/SymbolParser.d.ts.map +1 -0
- package/dist/bse/utils/SymbolParser.js +58 -0
- package/dist/bse/utils/SymbolParser.js.map +1 -0
- package/dist/bse/utils/helpers.d.ts +21 -0
- package/dist/bse/utils/helpers.d.ts.map +1 -0
- package/dist/bse/utils/helpers.js +77 -0
- package/dist/bse/utils/helpers.js.map +1 -0
- package/dist/bse/utils/throttle.d.ts +4 -0
- package/dist/bse/utils/throttle.d.ts.map +1 -0
- package/dist/bse/utils/throttle.js +38 -0
- package/dist/bse/utils/throttle.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/nse/api/corporate-api.d.ts +30 -0
- package/dist/nse/api/corporate-api.d.ts.map +1 -0
- package/dist/nse/api/corporate-api.js +90 -0
- package/dist/nse/api/corporate-api.js.map +1 -0
- package/dist/nse/api/download-api.d.ts +42 -0
- package/dist/nse/api/download-api.d.ts.map +1 -0
- package/dist/nse/api/download-api.js +144 -0
- package/dist/nse/api/download-api.js.map +1 -0
- package/dist/nse/api/equity-api.d.ts +50 -0
- package/dist/nse/api/equity-api.d.ts.map +1 -0
- package/dist/nse/api/equity-api.js +103 -0
- package/dist/nse/api/equity-api.js.map +1 -0
- package/dist/nse/api/historical-api.d.ts +34 -0
- package/dist/nse/api/historical-api.d.ts.map +1 -0
- package/dist/nse/api/historical-api.js +126 -0
- package/dist/nse/api/historical-api.js.map +1 -0
- package/dist/nse/api/index.d.ts +11 -0
- package/dist/nse/api/index.d.ts.map +1 -0
- package/dist/nse/api/index.js +11 -0
- package/dist/nse/api/index.js.map +1 -0
- package/dist/nse/api/ipo-api.d.ts +26 -0
- package/dist/nse/api/ipo-api.d.ts.map +1 -0
- package/dist/nse/api/ipo-api.js +46 -0
- package/dist/nse/api/ipo-api.js.map +1 -0
- package/dist/nse/api/market-api.d.ts +34 -0
- package/dist/nse/api/market-api.d.ts.map +1 -0
- package/dist/nse/api/market-api.js +58 -0
- package/dist/nse/api/market-api.js.map +1 -0
- package/dist/nse/api/options-api.d.ts +35 -0
- package/dist/nse/api/options-api.d.ts.map +1 -0
- package/dist/nse/api/options-api.js +207 -0
- package/dist/nse/api/options-api.js.map +1 -0
- package/dist/nse/constants/index.d.ts +29 -0
- package/dist/nse/constants/index.d.ts.map +1 -0
- package/dist/nse/constants/index.js +43 -0
- package/dist/nse/constants/index.js.map +1 -0
- package/dist/nse/http/http-client.d.ts +38 -0
- package/dist/nse/http/http-client.d.ts.map +1 -0
- package/dist/nse/http/http-client.js +164 -0
- package/dist/nse/http/http-client.js.map +1 -0
- package/dist/nse/index.d.ts +19 -0
- package/dist/nse/index.d.ts.map +1 -0
- package/dist/nse/index.js +24 -0
- package/dist/nse/index.js.map +1 -0
- package/dist/nse/nse/nse-client.d.ts +85 -0
- package/dist/nse/nse/nse-client.d.ts.map +1 -0
- package/dist/nse/nse/nse-client.js +105 -0
- package/dist/nse/nse/nse-client.js.map +1 -0
- package/dist/nse/types/index.d.ts +123 -0
- package/dist/nse/types/index.d.ts.map +1 -0
- package/dist/nse/types/index.js +5 -0
- package/dist/nse/types/index.js.map +1 -0
- package/dist/nse/utils/date-formatter.d.ts +36 -0
- package/dist/nse/utils/date-formatter.d.ts.map +1 -0
- package/dist/nse/utils/date-formatter.js +70 -0
- package/dist/nse/utils/date-formatter.js.map +1 -0
- package/dist/nse/utils/file-operations.d.ts +16 -0
- package/dist/nse/utils/file-operations.d.ts.map +1 -0
- package/dist/nse/utils/file-operations.js +74 -0
- package/dist/nse/utils/file-operations.js.map +1 -0
- package/dist/nse/utils/index.d.ts +6 -0
- package/dist/nse/utils/index.d.ts.map +1 -0
- package/dist/nse/utils/index.js +6 -0
- package/dist/nse/utils/index.js.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist-cjs/bse/BSE.js +493 -0
- package/dist-cjs/bse/BSE.js.map +1 -0
- package/dist-cjs/bse/constants/index.js +352 -0
- package/dist-cjs/bse/constants/index.js.map +1 -0
- package/dist-cjs/bse/index.js +36 -0
- package/dist-cjs/bse/index.js.map +1 -0
- package/dist-cjs/bse/types/index.js +26 -0
- package/dist-cjs/bse/types/index.js.map +1 -0
- package/dist-cjs/bse/utils/SymbolParser.js +62 -0
- package/dist-cjs/bse/utils/SymbolParser.js.map +1 -0
- package/dist-cjs/bse/utils/helpers.js +117 -0
- package/dist-cjs/bse/utils/helpers.js.map +1 -0
- package/dist-cjs/bse/utils/throttle.js +42 -0
- package/dist-cjs/bse/utils/throttle.js.map +1 -0
- package/dist-cjs/index.js +54 -0
- package/dist-cjs/index.js.map +1 -0
- package/dist-cjs/nse/api/corporate-api.js +94 -0
- package/dist-cjs/nse/api/corporate-api.js.map +1 -0
- package/dist-cjs/nse/api/download-api.js +151 -0
- package/dist-cjs/nse/api/download-api.js.map +1 -0
- package/dist-cjs/nse/api/equity-api.js +107 -0
- package/dist-cjs/nse/api/equity-api.js.map +1 -0
- package/dist-cjs/nse/api/historical-api.js +130 -0
- package/dist-cjs/nse/api/historical-api.js.map +1 -0
- package/dist-cjs/nse/api/index.js +21 -0
- package/dist-cjs/nse/api/index.js.map +1 -0
- package/dist-cjs/nse/api/ipo-api.js +50 -0
- package/dist-cjs/nse/api/ipo-api.js.map +1 -0
- package/dist-cjs/nse/api/market-api.js +62 -0
- package/dist-cjs/nse/api/market-api.js.map +1 -0
- package/dist-cjs/nse/api/options-api.js +211 -0
- package/dist-cjs/nse/api/options-api.js.map +1 -0
- package/dist-cjs/nse/constants/index.js +46 -0
- package/dist-cjs/nse/constants/index.js.map +1 -0
- package/dist-cjs/nse/http/http-client.js +171 -0
- package/dist-cjs/nse/http/http-client.js.map +1 -0
- package/dist-cjs/nse/index.js +50 -0
- package/dist-cjs/nse/index.js.map +1 -0
- package/dist-cjs/nse/nse/nse-client.js +109 -0
- package/dist-cjs/nse/nse/nse-client.js.map +1 -0
- package/dist-cjs/nse/types/index.js +6 -0
- package/dist-cjs/nse/types/index.js.map +1 -0
- package/dist-cjs/nse/utils/date-formatter.js +80 -0
- package/dist-cjs/nse/utils/date-formatter.js.map +1 -0
- package/dist-cjs/nse/utils/file-operations.js +82 -0
- package/dist-cjs/nse/utils/file-operations.js.map +1 -0
- package/dist-cjs/nse/utils/index.js +22 -0
- package/dist-cjs/nse/utils/index.js.map +1 -0
- package/dist-cjs/package.json +3 -0
- package/dist-cjs/types/index.js +47 -0
- package/dist-cjs/types/index.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options and derivatives API methods for NSE
|
|
3
|
+
*/
|
|
4
|
+
import { BASE_URL } from "../constants/index.js";
|
|
5
|
+
import { OPTION_INDICES } from "../constants/index.js";
|
|
6
|
+
import { formatDateExpiry } from "../utils/date-formatter.js";
|
|
7
|
+
export class OptionsApi {
|
|
8
|
+
httpClient;
|
|
9
|
+
constructor(httpClient) {
|
|
10
|
+
this.httpClient = httpClient;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get F&O lot sizes
|
|
14
|
+
*/
|
|
15
|
+
async getFnoLots() {
|
|
16
|
+
const url = "https://nsearchives.nseindia.com/content/fo/fo_mktlots.csv";
|
|
17
|
+
// Try to get as JSON first, fallback to text
|
|
18
|
+
let csv;
|
|
19
|
+
try {
|
|
20
|
+
const res = await this.httpClient.request(url);
|
|
21
|
+
csv = typeof res === "string" ? res : "";
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
csv = "";
|
|
25
|
+
}
|
|
26
|
+
if (!csv) {
|
|
27
|
+
csv = await this.httpClient.getTextResponse(url);
|
|
28
|
+
}
|
|
29
|
+
const lines = csv.trim().split(/\r?\n/);
|
|
30
|
+
const lots = {};
|
|
31
|
+
for (const line of lines) {
|
|
32
|
+
const parts = line.split(",");
|
|
33
|
+
if (parts.length < 4)
|
|
34
|
+
continue;
|
|
35
|
+
const sym = parts[1]?.trim();
|
|
36
|
+
const lot = Number(parts[3]?.trim());
|
|
37
|
+
if (!sym || !Number.isFinite(lot))
|
|
38
|
+
continue;
|
|
39
|
+
lots[sym] = lot;
|
|
40
|
+
}
|
|
41
|
+
return lots;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get option chain data
|
|
45
|
+
*/
|
|
46
|
+
async getOptionChain(symbol) {
|
|
47
|
+
const isIndex = OPTION_INDICES.includes(symbol.toLowerCase());
|
|
48
|
+
const url = isIndex
|
|
49
|
+
? `${BASE_URL}/option-chain-indices`
|
|
50
|
+
: `${BASE_URL}/option-chain-equities`;
|
|
51
|
+
return await this.httpClient.request(url, { symbol: symbol.toUpperCase() });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get filtered option chain data with only essential information for LLM processing
|
|
55
|
+
* Reduces data volume by ~90% while retaining key metrics
|
|
56
|
+
*/
|
|
57
|
+
async getFilteredOptionChain(symbol, strikeRange = 10) {
|
|
58
|
+
const fullData = await this.getOptionChain(symbol);
|
|
59
|
+
const underlying = fullData.records.underlyingValue;
|
|
60
|
+
// Calculate ATM strike
|
|
61
|
+
const strikes = fullData.records.data.map((item) => item.strikePrice);
|
|
62
|
+
const atmStrike = strikes.reduce((prev, curr) => Math.abs(curr - underlying) < Math.abs(prev - underlying) ? curr : prev);
|
|
63
|
+
// Filter strikes within range of ATM
|
|
64
|
+
const minStrike = atmStrike - (strikeRange * 50); // Assuming 50 point intervals
|
|
65
|
+
const maxStrike = atmStrike + (strikeRange * 50);
|
|
66
|
+
const filteredData = fullData.records.data.filter((item) => item.strikePrice >= minStrike && item.strikePrice <= maxStrike);
|
|
67
|
+
// Extract only essential fields
|
|
68
|
+
const essentialData = filteredData.map((item) => ({
|
|
69
|
+
strikePrice: item.strikePrice,
|
|
70
|
+
expiryDate: item.expiryDate,
|
|
71
|
+
CE: item.CE ? {
|
|
72
|
+
lastPrice: item.CE.lastPrice,
|
|
73
|
+
change: item.CE.change,
|
|
74
|
+
pChange: item.CE.pChange,
|
|
75
|
+
openInterest: item.CE.openInterest,
|
|
76
|
+
changeinOpenInterest: item.CE.changeinOpenInterest,
|
|
77
|
+
impliedVolatility: item.CE.impliedVolatility
|
|
78
|
+
} : null,
|
|
79
|
+
PE: item.PE ? {
|
|
80
|
+
lastPrice: item.PE.lastPrice,
|
|
81
|
+
change: item.PE.change,
|
|
82
|
+
pChange: item.PE.pChange,
|
|
83
|
+
openInterest: item.PE.openInterest,
|
|
84
|
+
changeinOpenInterest: item.PE.changeinOpenInterest,
|
|
85
|
+
impliedVolatility: item.PE.impliedVolatility
|
|
86
|
+
} : null
|
|
87
|
+
}));
|
|
88
|
+
return {
|
|
89
|
+
symbol: symbol.toUpperCase(),
|
|
90
|
+
underlyingValue: underlying,
|
|
91
|
+
atmStrike: atmStrike,
|
|
92
|
+
timestamp: fullData.records.timestamp,
|
|
93
|
+
strikeRange: `${minStrike}-${maxStrike}`,
|
|
94
|
+
totalStrikes: essentialData.length,
|
|
95
|
+
data: essentialData
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Calculate max pain for option chain
|
|
100
|
+
*/
|
|
101
|
+
static calculateMaxPain(optionChain, expiryDate) {
|
|
102
|
+
const painMap = {};
|
|
103
|
+
const expiryDateStr = formatDateExpiry(expiryDate);
|
|
104
|
+
for (const x of optionChain.records.data) {
|
|
105
|
+
if (x.expiryDate !== expiryDateStr)
|
|
106
|
+
continue;
|
|
107
|
+
const expiryStrike = x.strikePrice;
|
|
108
|
+
let pain = 0;
|
|
109
|
+
for (const y of optionChain.records.data) {
|
|
110
|
+
if (y.expiryDate !== expiryDateStr)
|
|
111
|
+
continue;
|
|
112
|
+
const diff = expiryStrike - y.strikePrice;
|
|
113
|
+
if (diff > 0 && y.CE)
|
|
114
|
+
pain += -diff * y.CE.openInterest;
|
|
115
|
+
if (diff < 0 && y.PE)
|
|
116
|
+
pain += diff * y.PE.openInterest;
|
|
117
|
+
}
|
|
118
|
+
painMap[expiryStrike] = pain;
|
|
119
|
+
}
|
|
120
|
+
const strikes = Object.keys(painMap).map(Number);
|
|
121
|
+
return strikes.sort((a, b) => painMap[b] - painMap[a])[0];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get futures expiry dates
|
|
125
|
+
*/
|
|
126
|
+
async getFuturesExpiry(index = "nifty") {
|
|
127
|
+
const indexMap = {
|
|
128
|
+
banknifty: "nifty_bank_fut",
|
|
129
|
+
finnifty: "finnifty_fut",
|
|
130
|
+
nifty: "nse50_fut",
|
|
131
|
+
niftyit: "niftyit_fut"
|
|
132
|
+
};
|
|
133
|
+
const idx = indexMap[index] || "nse50_fut";
|
|
134
|
+
const res = await this.httpClient.request(`${BASE_URL}/liveEquity-derivatives`, { index: idx });
|
|
135
|
+
const data = res.data.map((i) => i.expiryDate);
|
|
136
|
+
return data.sort((a, b) => new Date(a.replace(/-/g, "/")).getTime() - new Date(b.replace(/-/g, "/")).getTime());
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Compile option chain with calculated metrics
|
|
140
|
+
*/
|
|
141
|
+
async compileOptionChain(symbol, expiryDate) {
|
|
142
|
+
const data = await this.getOptionChain(symbol);
|
|
143
|
+
const chain = {};
|
|
144
|
+
const expiryDateStr = formatDateExpiry(expiryDate);
|
|
145
|
+
const oc = {
|
|
146
|
+
expiry: expiryDateStr,
|
|
147
|
+
timestamp: data.records.timestamp,
|
|
148
|
+
};
|
|
149
|
+
const strike1 = data.filtered.data[0].strikePrice;
|
|
150
|
+
const strike2 = data.filtered.data[1].strikePrice;
|
|
151
|
+
const multiple = strike1 - strike2;
|
|
152
|
+
const underlying = data.records.underlyingValue;
|
|
153
|
+
oc.underlying = underlying;
|
|
154
|
+
oc.atm = multiple * Math.round(underlying / multiple);
|
|
155
|
+
let maxCoi = 0;
|
|
156
|
+
let maxPoi = 0;
|
|
157
|
+
let totalCoi = 0;
|
|
158
|
+
let totalPoi = 0;
|
|
159
|
+
let maxCoiStrike = 0;
|
|
160
|
+
let maxPoiStrike = 0;
|
|
161
|
+
for (const idx of data.records.data) {
|
|
162
|
+
if (idx.expiryDate !== expiryDateStr)
|
|
163
|
+
continue;
|
|
164
|
+
const strike = String(idx.strikePrice);
|
|
165
|
+
if (!chain[strike])
|
|
166
|
+
chain[strike] = { pe: {}, ce: {} };
|
|
167
|
+
let poi = 0;
|
|
168
|
+
let coi = 0;
|
|
169
|
+
if (idx.PE) {
|
|
170
|
+
const { openInterest, lastPrice, chg, impliedVolatility } = idx.PE;
|
|
171
|
+
poi = openInterest;
|
|
172
|
+
chain[strike].pe = { last: lastPrice, oi: poi, chg, iv: impliedVolatility };
|
|
173
|
+
totalPoi += poi;
|
|
174
|
+
if (poi > maxPoi) {
|
|
175
|
+
maxPoi = poi;
|
|
176
|
+
maxPoiStrike = Number(strike);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
chain[strike].pe = { last: 0, oi: 0, chg: 0, iv: 0 };
|
|
181
|
+
}
|
|
182
|
+
if (idx.CE) {
|
|
183
|
+
const { openInterest, lastPrice, chg, impliedVolatility } = idx.CE;
|
|
184
|
+
coi = openInterest;
|
|
185
|
+
chain[strike].ce = { last: lastPrice, oi: coi, chg, iv: impliedVolatility };
|
|
186
|
+
totalCoi += coi;
|
|
187
|
+
if (coi > maxCoi) {
|
|
188
|
+
maxCoi = coi;
|
|
189
|
+
maxCoiStrike = Number(strike);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
chain[strike].ce = { last: 0, oi: 0, chg: 0, iv: 0 };
|
|
194
|
+
}
|
|
195
|
+
chain[strike].pcr = poi === 0 || coi === 0 ? null : Number((poi / coi).toFixed(2));
|
|
196
|
+
}
|
|
197
|
+
oc.maxpain = OptionsApi.calculateMaxPain(data, expiryDate);
|
|
198
|
+
oc.maxCoi = maxCoiStrike;
|
|
199
|
+
oc.maxPoi = maxPoiStrike;
|
|
200
|
+
oc.coiTotal = totalCoi;
|
|
201
|
+
oc.poiTotal = totalPoi;
|
|
202
|
+
oc.pcr = Number((totalPoi / totalCoi).toFixed(2));
|
|
203
|
+
oc.chain = chain;
|
|
204
|
+
return oc;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=options-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-api.js","sourceRoot":"","sources":["../../../src/nse/api/options-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,OAAO,UAAU;IACD;IAApB,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C;;OAEG;IACH,KAAK,CAAC,UAAU;Q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AAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACrF,CAAC;QAED,EAAE,CAAC,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC3D,EAAE,CAAC,MAAM,GAAG,YAAY,CAAC;QACzB,EAAE,CAAC,MAAM,GAAG,YAAY,CAAC;QACzB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACvB,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC;QAEjB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants and configuration values for NSE API
|
|
3
|
+
*/
|
|
4
|
+
export declare const NSE_VERSION = "0.1.0";
|
|
5
|
+
export declare const SEGMENT_EQUITY: "equities";
|
|
6
|
+
export declare const SEGMENT_SME: "sme";
|
|
7
|
+
export declare const SEGMENT_MF: "mf";
|
|
8
|
+
export declare const SEGMENT_DEBT: "debt";
|
|
9
|
+
export declare const HOLIDAY_CLEARING: "clearing";
|
|
10
|
+
export declare const HOLIDAY_TRADING: "trading";
|
|
11
|
+
export declare const FNO_BANK: "banknifty";
|
|
12
|
+
export declare const FNO_NIFTY: "nifty";
|
|
13
|
+
export declare const FNO_FINNIFTY: "finnifty";
|
|
14
|
+
export declare const FNO_IT: "niftyit";
|
|
15
|
+
export declare const UDIFF_SWITCH_DATE: Date;
|
|
16
|
+
export declare const OPTION_INDICES: readonly ["banknifty", "nifty", "finnifty", "niftyit"];
|
|
17
|
+
export declare const BASE_URL = "https://www.nseindia.com/api";
|
|
18
|
+
export declare const ARCHIVE_URL = "https://nsearchives.nseindia.com";
|
|
19
|
+
export declare const DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/118.0";
|
|
20
|
+
export declare const DEFAULT_HEADERS: {
|
|
21
|
+
readonly "User-Agent": "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/118.0";
|
|
22
|
+
readonly Accept: "*/*";
|
|
23
|
+
readonly "Accept-Language": "en-US,en;q=0.5";
|
|
24
|
+
readonly "Accept-Encoding": "gzip, deflate";
|
|
25
|
+
readonly Referer: "https://www.nseindia.com/get-quotes/equity?symbol=HDFCBANK";
|
|
26
|
+
};
|
|
27
|
+
export declare const DEFAULT_TIMEOUT = 15000;
|
|
28
|
+
export declare const PRIME_URL = "https://www.nseindia.com/option-chain";
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nse/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,WAAW,UAAU,CAAC;AAGnC,eAAO,MAAM,cAAc,EAAG,UAAmB,CAAC;AAClD,eAAO,MAAM,WAAW,EAAG,KAAc,CAAC;AAC1C,eAAO,MAAM,UAAU,EAAG,IAAa,CAAC;AACxC,eAAO,MAAM,YAAY,EAAG,MAAe,CAAC;AAG5C,eAAO,MAAM,gBAAgB,EAAG,UAAmB,CAAC;AACpD,eAAO,MAAM,eAAe,EAAG,SAAkB,CAAC;AAGlD,eAAO,MAAM,QAAQ,EAAG,WAAoB,CAAC;AAC7C,eAAO,MAAM,SAAS,EAAG,OAAgB,CAAC;AAC1C,eAAO,MAAM,YAAY,EAAG,UAAmB,CAAC;AAChD,eAAO,MAAM,MAAM,EAAG,SAAkB,CAAC;AAGzC,eAAO,MAAM,iBAAiB,MAAyB,CAAC;AAGxD,eAAO,MAAM,cAAc,wDAKjB,CAAC;AAGX,eAAO,MAAM,QAAQ,iCAAiC,CAAC;AACvD,eAAO,MAAM,WAAW,qCAAqC,CAAC;AAG9D,eAAO,MAAM,kBAAkB,yEAAyE,CAAC;AAEzG,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAC;AAGX,eAAO,MAAM,eAAe,QAAQ,CAAC;AAGrC,eAAO,MAAM,SAAS,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants and configuration values for NSE API
|
|
3
|
+
*/
|
|
4
|
+
export const NSE_VERSION = "0.1.0";
|
|
5
|
+
// Market segments
|
|
6
|
+
export const SEGMENT_EQUITY = "equities";
|
|
7
|
+
export const SEGMENT_SME = "sme";
|
|
8
|
+
export const SEGMENT_MF = "mf";
|
|
9
|
+
export const SEGMENT_DEBT = "debt";
|
|
10
|
+
// Holiday types
|
|
11
|
+
export const HOLIDAY_CLEARING = "clearing";
|
|
12
|
+
export const HOLIDAY_TRADING = "trading";
|
|
13
|
+
// F&O indices
|
|
14
|
+
export const FNO_BANK = "banknifty";
|
|
15
|
+
export const FNO_NIFTY = "nifty";
|
|
16
|
+
export const FNO_FINNIFTY = "finnifty";
|
|
17
|
+
export const FNO_IT = "niftyit";
|
|
18
|
+
// Important dates
|
|
19
|
+
export const UDIFF_SWITCH_DATE = new Date("2024-07-08");
|
|
20
|
+
// Option indices array
|
|
21
|
+
export const OPTION_INDICES = [
|
|
22
|
+
FNO_BANK,
|
|
23
|
+
FNO_NIFTY,
|
|
24
|
+
FNO_FINNIFTY,
|
|
25
|
+
FNO_IT,
|
|
26
|
+
];
|
|
27
|
+
// API URLs
|
|
28
|
+
export const BASE_URL = "https://www.nseindia.com/api";
|
|
29
|
+
export const ARCHIVE_URL = "https://nsearchives.nseindia.com";
|
|
30
|
+
// HTTP headers
|
|
31
|
+
export const DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/118.0";
|
|
32
|
+
export const DEFAULT_HEADERS = {
|
|
33
|
+
"User-Agent": DEFAULT_USER_AGENT,
|
|
34
|
+
Accept: "*/*",
|
|
35
|
+
"Accept-Language": "en-US,en;q=0.5",
|
|
36
|
+
"Accept-Encoding": "gzip, deflate",
|
|
37
|
+
Referer: "https://www.nseindia.com/get-quotes/equity?symbol=HDFCBANK",
|
|
38
|
+
};
|
|
39
|
+
// Default timeout
|
|
40
|
+
export const DEFAULT_TIMEOUT = 15000;
|
|
41
|
+
// Cookie priming URL
|
|
42
|
+
export const PRIME_URL = "https://www.nseindia.com/option-chain";
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nse/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC,kBAAkB;AAClB,MAAM,CAAC,MAAM,cAAc,GAAG,UAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAc,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAa,CAAC;AACxC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAe,CAAC;AAE5C,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAmB,CAAC;AACpD,MAAM,CAAC,MAAM,eAAe,GAAG,SAAkB,CAAC;AAElD,cAAc;AACd,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAoB,CAAC;AAC7C,MAAM,CAAC,MAAM,SAAS,GAAG,OAAgB,CAAC;AAC1C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAmB,CAAC;AAChD,MAAM,CAAC,MAAM,MAAM,GAAG,SAAkB,CAAC;AAEzC,kBAAkB;AAClB,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;AAExD,uBAAuB;AACvB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,MAAM;CACE,CAAC;AAEX,WAAW;AACX,MAAM,CAAC,MAAM,QAAQ,GAAG,8BAA8B,CAAC;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAE9D,eAAe;AACf,MAAM,CAAC,MAAM,kBAAkB,GAAG,sEAAsE,CAAC;AAEzG,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,YAAY,EAAE,kBAAkB;IAChC,MAAM,EAAE,KAAK;IACb,iBAAiB,EAAE,gBAAgB;IACnC,iBAAiB,EAAE,eAAe;IAClC,OAAO,EAAE,4DAA4D;CAC7D,CAAC;AAEX,kBAAkB;AAClB,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,qBAAqB;AACrB,MAAM,CAAC,MAAM,SAAS,GAAG,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client management for NSE API
|
|
3
|
+
*/
|
|
4
|
+
export declare class HttpClient {
|
|
5
|
+
private axiosClient?;
|
|
6
|
+
private gotClient?;
|
|
7
|
+
private jar;
|
|
8
|
+
private cookiePath;
|
|
9
|
+
private cookiesPrimed;
|
|
10
|
+
private server;
|
|
11
|
+
private timeout;
|
|
12
|
+
constructor(downloadDir: string, server: boolean, timeout: number);
|
|
13
|
+
/**
|
|
14
|
+
* Load cookies from disk
|
|
15
|
+
*/
|
|
16
|
+
private loadCookies;
|
|
17
|
+
/**
|
|
18
|
+
* Save cookies to disk
|
|
19
|
+
*/
|
|
20
|
+
saveCookies(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Prime cookies by visiting NSE homepage
|
|
23
|
+
*/
|
|
24
|
+
private primeCookies;
|
|
25
|
+
/**
|
|
26
|
+
* Make HTTP request and return JSON response
|
|
27
|
+
*/
|
|
28
|
+
request(url: string, params?: Record<string, unknown>): Promise<any>;
|
|
29
|
+
/**
|
|
30
|
+
* Download file from URL
|
|
31
|
+
*/
|
|
32
|
+
downloadFile(url: string, folder: string): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Get text response from URL
|
|
35
|
+
*/
|
|
36
|
+
getTextResponse(url: string): Promise<string>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../src/nse/http/http-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,qBAAa,UAAU;IACrB,OAAO,CAAC,WAAW,CAAC,CAAgB;IACpC,OAAO,CAAC,SAAS,CAAC,CAAM;IACxB,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;IAmCjE;;OAEG;IACH,OAAO,CAAC,WAAW;IAWnB;;OAEG;IACH,WAAW,IAAI,IAAI;IASnB;;OAEG;YACW,YAAY;IAgB1B;;OAEG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IA4B1E;;OAEG;IACG,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA8BhE;;OAEG;IACG,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAapD"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client management for NSE API
|
|
3
|
+
*/
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import axios from "axios";
|
|
7
|
+
import { wrapper as axiosCookieJarSupport } from "axios-cookiejar-support";
|
|
8
|
+
import got from "got";
|
|
9
|
+
import { CookieJar } from "tough-cookie";
|
|
10
|
+
import { DEFAULT_HEADERS, PRIME_URL } from "../constants/index.js";
|
|
11
|
+
import { saveStreamToFile } from "../utils/file-operations.js";
|
|
12
|
+
export class HttpClient {
|
|
13
|
+
axiosClient;
|
|
14
|
+
gotClient;
|
|
15
|
+
jar;
|
|
16
|
+
cookiePath;
|
|
17
|
+
cookiesPrimed = false;
|
|
18
|
+
server;
|
|
19
|
+
timeout;
|
|
20
|
+
constructor(downloadDir, server, timeout) {
|
|
21
|
+
this.server = server;
|
|
22
|
+
this.timeout = timeout;
|
|
23
|
+
// Set up cookie jar and load from disk
|
|
24
|
+
this.cookiePath = path.join(downloadDir, server ? "nse_cookies_http2.json" : "nse_cookies_http1.json");
|
|
25
|
+
this.jar = new CookieJar();
|
|
26
|
+
this.loadCookies();
|
|
27
|
+
if (server) {
|
|
28
|
+
// got with HTTP/2
|
|
29
|
+
this.gotClient = got.extend({
|
|
30
|
+
http2: true,
|
|
31
|
+
headers: DEFAULT_HEADERS,
|
|
32
|
+
cookieJar: this.jar,
|
|
33
|
+
timeout: { request: this.timeout },
|
|
34
|
+
throwHttpErrors: false,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// axios with cookie jar
|
|
39
|
+
const ax = axios.create({
|
|
40
|
+
headers: DEFAULT_HEADERS,
|
|
41
|
+
timeout: this.timeout,
|
|
42
|
+
decompress: true,
|
|
43
|
+
validateStatus: () => true,
|
|
44
|
+
});
|
|
45
|
+
axiosCookieJarSupport(ax);
|
|
46
|
+
ax.defaults.jar = this.jar;
|
|
47
|
+
this.axiosClient = ax;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Load cookies from disk
|
|
52
|
+
*/
|
|
53
|
+
loadCookies() {
|
|
54
|
+
if (!fs.existsSync(this.cookiePath))
|
|
55
|
+
return;
|
|
56
|
+
try {
|
|
57
|
+
const data = JSON.parse(fs.readFileSync(this.cookiePath, "utf8"));
|
|
58
|
+
this.jar = CookieJar.fromJSON(data);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Ignore cookie loading errors
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Save cookies to disk
|
|
66
|
+
*/
|
|
67
|
+
saveCookies() {
|
|
68
|
+
try {
|
|
69
|
+
const json = this.jar.toJSON();
|
|
70
|
+
fs.writeFileSync(this.cookiePath, JSON.stringify(json), "utf8");
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// Ignore cookie saving errors
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Prime cookies by visiting NSE homepage
|
|
78
|
+
*/
|
|
79
|
+
async primeCookies() {
|
|
80
|
+
if (this.cookiesPrimed)
|
|
81
|
+
return;
|
|
82
|
+
try {
|
|
83
|
+
if (this.server && this.gotClient) {
|
|
84
|
+
await this.gotClient.get(PRIME_URL);
|
|
85
|
+
}
|
|
86
|
+
else if (this.axiosClient) {
|
|
87
|
+
await this.axiosClient.get(PRIME_URL);
|
|
88
|
+
}
|
|
89
|
+
this.cookiesPrimed = true;
|
|
90
|
+
this.saveCookies();
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Ignore priming failures; subsequent requests may still succeed
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Make HTTP request and return JSON response
|
|
98
|
+
*/
|
|
99
|
+
async request(url, params) {
|
|
100
|
+
await this.primeCookies();
|
|
101
|
+
if (this.server && this.gotClient) {
|
|
102
|
+
const res = await this.gotClient.get(url, {
|
|
103
|
+
searchParams: params,
|
|
104
|
+
});
|
|
105
|
+
if (res.statusCode < 200 || res.statusCode >= 300) {
|
|
106
|
+
throw new Error(`${url} ${res.statusCode}: ${res.statusMessage}`);
|
|
107
|
+
}
|
|
108
|
+
return JSON.parse(res.body);
|
|
109
|
+
}
|
|
110
|
+
if (this.axiosClient) {
|
|
111
|
+
const res = await this.axiosClient.get(url, { params });
|
|
112
|
+
if (res.status < 200 || res.status >= 300) {
|
|
113
|
+
throw new Error(`${url} ${res.status}: ${res.statusText}`);
|
|
114
|
+
}
|
|
115
|
+
return res.data;
|
|
116
|
+
}
|
|
117
|
+
throw new Error("HTTP client not initialized");
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Download file from URL
|
|
121
|
+
*/
|
|
122
|
+
async downloadFile(url, folder) {
|
|
123
|
+
const fname = path.join(folder, path.basename(new URL(url).pathname));
|
|
124
|
+
await this.primeCookies();
|
|
125
|
+
if (this.server && this.gotClient) {
|
|
126
|
+
const res = await this.gotClient.get(url, { responseType: "buffer" });
|
|
127
|
+
const contentType = res.headers["content-type"];
|
|
128
|
+
if (contentType && String(contentType).includes("text/html")) {
|
|
129
|
+
throw new Error("NSE file is unavailable or not yet updated.");
|
|
130
|
+
}
|
|
131
|
+
fs.writeFileSync(fname, res.body);
|
|
132
|
+
}
|
|
133
|
+
else if (this.axiosClient) {
|
|
134
|
+
const res = await this.axiosClient.get(url, { responseType: "stream" });
|
|
135
|
+
const contentType = res.headers["content-type"];
|
|
136
|
+
if (contentType && contentType.includes("text/html")) {
|
|
137
|
+
throw new Error("NSE file is unavailable or not yet updated.");
|
|
138
|
+
}
|
|
139
|
+
await saveStreamToFile(res.data, fname);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
throw new Error("HTTP client not initialized");
|
|
143
|
+
}
|
|
144
|
+
return fname;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get text response from URL
|
|
148
|
+
*/
|
|
149
|
+
async getTextResponse(url) {
|
|
150
|
+
await this.primeCookies();
|
|
151
|
+
if (this.server && this.gotClient) {
|
|
152
|
+
const res = await this.gotClient.get(url, { responseType: "text" });
|
|
153
|
+
return res.body;
|
|
154
|
+
}
|
|
155
|
+
else if (this.axiosClient) {
|
|
156
|
+
const res = await this.axiosClient.get(url, { responseType: "text" });
|
|
157
|
+
return res.data;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
throw new Error("HTTP client not initialized");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=http-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../../src/nse/http/http-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAmB,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,OAAO,UAAU;IACb,WAAW,CAAiB;IAC5B,SAAS,CAAO;IAChB,GAAG,CAAY;IACf,UAAU,CAAS;IACnB,aAAa,GAAG,KAAK,CAAC;IACtB,MAAM,CAAU;IAChB,OAAO,CAAS;IAExB,YAAY,WAAmB,EAAE,MAAe,EAAE,OAAe;QAC/D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,uCAAuC;QACvC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CACzB,WAAW,EACX,MAAM,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,wBAAwB,CAC7D,CAAC;QACF,IAAI,CAAC,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,WAAW,EAAE,CAAC;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3
|
+
*
|
|
4
|
+
* Re-exports all NSE functionality from the original nseapi package
|
|
5
|
+
*/
|
|
6
|
+
export { NSEClient } from "./nse/nse-client.js";
|
|
7
|
+
export * from "./types/index.js";
|
|
8
|
+
export * from "./constants/index.js";
|
|
9
|
+
export * from "./utils/date-formatter.js";
|
|
10
|
+
export * from "./utils/file-operations.js";
|
|
11
|
+
export { EquityApi } from "./api/equity-api.js";
|
|
12
|
+
export { OptionsApi } from "./api/options-api.js";
|
|
13
|
+
export { HistoricalApi } from "./api/historical-api.js";
|
|
14
|
+
export { CorporateApi } from "./api/corporate-api.js";
|
|
15
|
+
export { IpoApi } from "./api/ipo-api.js";
|
|
16
|
+
export { MarketApi } from "./api/market-api.js";
|
|
17
|
+
export { DownloadApi } from "./api/download-api.js";
|
|
18
|
+
export { HttpClient } from "./http/http-client.js";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nse/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NSE API Module
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all NSE functionality from the original nseapi package
|
|
5
|
+
*/
|
|
6
|
+
// Main NSE client
|
|
7
|
+
export { NSEClient } from "./nse/nse-client.js";
|
|
8
|
+
// Export types for TypeScript users
|
|
9
|
+
export * from "./types/index.js";
|
|
10
|
+
// Export constants
|
|
11
|
+
export * from "./constants/index.js";
|
|
12
|
+
// Export utilities
|
|
13
|
+
export * from "./utils/date-formatter.js";
|
|
14
|
+
export * from "./utils/file-operations.js";
|
|
15
|
+
// Export API modules for advanced usage
|
|
16
|
+
export { EquityApi } from "./api/equity-api.js";
|
|
17
|
+
export { OptionsApi } from "./api/options-api.js";
|
|
18
|
+
export { HistoricalApi } from "./api/historical-api.js";
|
|
19
|
+
export { CorporateApi } from "./api/corporate-api.js";
|
|
20
|
+
export { IpoApi } from "./api/ipo-api.js";
|
|
21
|
+
export { MarketApi } from "./api/market-api.js";
|
|
22
|
+
export { DownloadApi } from "./api/download-api.js";
|
|
23
|
+
export { HttpClient } from "./http/http-client.js";
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nse/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,kBAAkB;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,oCAAoC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,mBAAmB;AACnB,cAAc,sBAAsB,CAAC;AAErC,mBAAmB;AACnB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAE3C,wCAAwC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|