borsajs 0.1.1 → 0.1.2

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/README.en.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  **[Türkçe](README.md) | [English](README.en.md)**
4
4
 
5
- > **TypeScript/JavaScript port of [borsapy](https://github.com/saidsurucu/borsapy)** - Inspired by the Python version.
6
-
7
- A TypeScript/JavaScript data library for Turkish financial markets. yfinance-like API for BIST stocks, forex, crypto, investment funds, and economic data.
5
+ A TypeScript/JavaScript data library for Turkey financial markets. yfinance-like API for BIST stocks, forex, crypto, investment funds, and economic data.
8
6
 
9
7
  ## Installation
10
8
 
@@ -15,32 +13,29 @@ npm install borsajs
15
13
  ## Quick Start
16
14
 
17
15
  ```typescript
18
- import { Ticker, FX, Crypto, Fund, Inflation, download } from 'borsajs';
16
+ import { Ticker, FX, Crypto, Fund, Inflation, symbols, cryptoSymbols } from 'borsajs';
19
17
 
20
18
  // Stock data
21
19
  const stock = new Ticker('THYAO');
22
20
  const info = await stock.getInfo();
23
- const history = await stock.getHistory({ period: '1mo' });
21
+ // { symbol: 'THYAO', last: 274.25, change: 5.75, changePercent: 2.14, ... }
24
22
 
25
23
  // Forex
26
24
  const usd = new FX('USD');
27
25
  const rate = await usd.getCurrent();
26
+ // → { symbol: 'USD', last: 43.02, updateTime: '2026-01-02T20:59:58.000Z' }
28
27
 
29
28
  // Crypto
30
29
  const btc = new Crypto('BTCTRY');
31
30
  const price = await btc.getCurrent();
31
+ // → { symbol: 'BTCTRY', last: 3839080, bid: 3839136, ask: 3840481, ... }
32
32
 
33
- // Investment fund
34
- const fund = new Fund('AAK');
35
- const fundInfo = await fund.getInfo();
36
-
37
- // Inflation
38
- const inflation = new Inflation();
39
- const latest = await inflation.getLatest();
40
- const calculation = await inflation.calculate(100000, '2020-01', '2024-01');
33
+ // Symbol lists
34
+ const stockList = symbols(); // → ['AKBNK', 'ARCLK', 'ASELS', ...] (80 stocks)
35
+ const cryptoList = await cryptoSymbols(); // → ['BTCTRY', 'ETHTRY', ...] (173 pairs)
41
36
  ```
42
37
 
43
- ## Modules
38
+ ## API Reference
44
39
 
45
40
  ### Ticker (Stocks)
46
41
 
@@ -48,62 +43,122 @@ const calculation = await inflation.calculate(100000, '2020-01', '2024-01');
48
43
  import { Ticker } from 'borsajs';
49
44
 
50
45
  const stock = new Ticker('THYAO');
51
-
52
- // Current info
53
46
  const info = await stock.getInfo();
54
- console.log(info.last); // Last price
55
- console.log(info.change); // Change
56
- console.log(info.changePercent); // Change %
57
-
58
- // Price history
59
- const daily = await stock.getHistory({ period: '1mo' });
60
- const hourly = await stock.getHistory({ period: '5d', interval: '1h' });
61
- const weekly = await stock.getHistory({ period: '1y', interval: '1wk' });
62
47
  ```
63
48
 
64
- ### Index
49
+ **Response:**
50
+ ```json
51
+ {
52
+ "symbol": "THYAO",
53
+ "last": 274.25,
54
+ "open": 271,
55
+ "high": 274.25,
56
+ "low": 269.75,
57
+ "close": 268.5,
58
+ "volume": 7853192164.25,
59
+ "change": 5.75,
60
+ "changePercent": 2.14,
61
+ "updateTime": "2026-01-01T21:00:00.000Z",
62
+ "type": "stock"
63
+ }
64
+ ```
65
65
 
66
+ **History:**
66
67
  ```typescript
67
- import { Index, indices } from 'borsajs';
68
-
69
- // Available indices
70
- console.log(indices()); // ['XU100', 'XU050', ...]
68
+ const history = await stock.getHistory({ period: '5d', interval: '1d' });
69
+ ```
71
70
 
72
- // Index data
73
- const xu100 = new Index('XU100');
74
- const info = await xu100.getInfo();
75
- const history = await xu100.getHistory({ period: '1mo' });
71
+ ```json
72
+ [
73
+ {
74
+ "date": "2026-01-01T21:00:00.000Z",
75
+ "open": 271,
76
+ "high": 274.25,
77
+ "low": 269.75,
78
+ "close": 274.25,
79
+ "volume": 7853192164.25
80
+ }
81
+ ]
76
82
  ```
77
83
 
78
84
  ### FX (Forex & Commodities)
79
85
 
80
86
  ```typescript
81
- import { FX } from 'borsajs';
87
+ import { FX, fxSymbols } from 'borsajs';
88
+
89
+ console.log(fxSymbols);
90
+ // → ['USD', 'EUR', 'GBP', 'JPY', 'CHF', 'CAD', 'AUD', 'gram-altin', 'ceyrek-altin', ...]
82
91
 
83
- // Exchange rates
84
92
  const usd = new FX('USD');
85
93
  const current = await usd.getCurrent();
86
- const history = await usd.getHistory({ period: '1mo' });
87
-
88
- // Gold
89
- const gold = new FX('gram-altin');
90
- const quarter = new FX('ceyrek-altin');
94
+ ```
91
95
 
92
- // Other: EUR, GBP, CHF, gumus (silver), BRENT, WTI
96
+ **Response:**
97
+ ```json
98
+ {
99
+ "symbol": "USD",
100
+ "last": 43.0237,
101
+ "open": 0,
102
+ "high": 0,
103
+ "low": 0,
104
+ "updateTime": "2026-01-02T20:59:58.000Z"
105
+ }
93
106
  ```
94
107
 
95
108
  ### Crypto
96
109
 
97
110
  ```typescript
98
- import { Crypto, cryptoPairs } from 'borsajs';
111
+ import { Crypto, cryptoSymbols } from 'borsajs';
99
112
 
100
- // Available pairs
101
- const pairs = await cryptoPairs(); // ['BTCTRY', 'ETHTRY', ...]
113
+ const pairs = await cryptoSymbols('TRY');
114
+ // ['BTCTRY', 'ETHTRY', 'XRPTRY', ...] (173 pairs)
102
115
 
103
- // Bitcoin/TRY
104
116
  const btc = new Crypto('BTCTRY');
105
117
  const current = await btc.getCurrent();
106
- const history = await btc.getHistory({ period: '1mo' });
118
+ ```
119
+
120
+ **Response:**
121
+ ```json
122
+ {
123
+ "symbol": "BTCTRY",
124
+ "last": 3839080,
125
+ "open": 3822360,
126
+ "high": 3891234,
127
+ "low": 3793804,
128
+ "bid": 3839136,
129
+ "ask": 3840481,
130
+ "volume": 36.22,
131
+ "change": 18121,
132
+ "changePercent": 0.44,
133
+ "timestamp": 1767432414317
134
+ }
135
+ ```
136
+
137
+ ### Index
138
+
139
+ ```typescript
140
+ import { Index, indexSymbols } from 'borsajs';
141
+
142
+ console.log(indexSymbols);
143
+ // → ['XU100', 'XU050', 'XU030', 'XBANK', 'XUSIN', ...]
144
+
145
+ const xu100 = new Index('XU100');
146
+ const info = await xu100.getInfo();
147
+ ```
148
+
149
+ **Response:**
150
+ ```json
151
+ {
152
+ "symbol": "XU100",
153
+ "last": 11498.38,
154
+ "open": 11296.52,
155
+ "high": 11498.38,
156
+ "low": 11296.52,
157
+ "change": 236.86,
158
+ "changePercent": 2.1,
159
+ "name": "BIST 100",
160
+ "type": "index"
161
+ }
107
162
  ```
108
163
 
109
164
  ### Fund (Investment Funds)
@@ -111,14 +166,22 @@ const history = await btc.getHistory({ period: '1mo' });
111
166
  ```typescript
112
167
  import { Fund, searchFunds } from 'borsajs';
113
168
 
114
- // Search funds
115
- const results = await searchFunds('bank');
116
-
117
- // Fund data
118
- const fund = new Fund('AAK');
169
+ const results = await searchFunds('ak', 3);
170
+ const fund = new Fund('AOY');
119
171
  const info = await fund.getInfo();
120
- const history = await fund.getHistory({ period: '1mo' });
121
- const performance = await fund.getPerformance();
172
+ ```
173
+
174
+ **Response:**
175
+ ```json
176
+ {
177
+ "fundCode": "AOY",
178
+ "name": "AK PORTFÖY ALTERNATİF ENERJİ YABANCI HİSSE SENEDİ FONU",
179
+ "price": 0.30568,
180
+ "fundSize": 785933047.54,
181
+ "investorCount": 34267,
182
+ "dailyReturn": -0.993,
183
+ "return1y": 77.59
184
+ }
122
185
  ```
123
186
 
124
187
  ### Inflation
@@ -127,48 +190,62 @@ const performance = await fund.getPerformance();
127
190
  import { Inflation } from 'borsajs';
128
191
 
129
192
  const inflation = new Inflation();
130
-
131
- // Latest CPI data
132
193
  const latest = await inflation.getLatest();
133
- const cpi = await inflation.getTufe({ limit: 12 });
194
+ const calc = await inflation.calculate(100000, '2020-01', '2024-01');
195
+ ```
134
196
 
135
- // PPI data
136
- const ppi = await inflation.getUfe({ limit: 12 });
197
+ **Response (Latest):**
198
+ ```json
199
+ {
200
+ "date": "2025-10-31",
201
+ "yearMonth": "11-2025",
202
+ "yearlyInflation": 31.07,
203
+ "monthlyInflation": 0.87,
204
+ "type": "TUFE"
205
+ }
206
+ ```
137
207
 
138
- // Inflation calculator
139
- const result = await inflation.calculate(100000, '2020-01', '2024-01');
140
- console.log(`100,000 TL -> ${result.finalValue.toLocaleString()} TL`);
208
+ **Response (Calculate):**
209
+ ```json
210
+ {
211
+ "startDate": "2020-01",
212
+ "endDate": "2024-01",
213
+ "initialValue": 100000,
214
+ "finalValue": 444399.15,
215
+ "totalYears": 4,
216
+ "totalChange": 344.4,
217
+ "avgYearlyInflation": 45.19
218
+ }
141
219
  ```
142
220
 
143
- ### VIOP (Derivatives)
221
+ ### Symbols
144
222
 
145
223
  ```typescript
146
- import { VIOP } from 'borsajs';
224
+ import { symbols, searchSymbols, cryptoSymbols, fxSymbols, indexSymbols } from 'borsajs';
147
225
 
148
- const viop = new VIOP();
226
+ // Stock symbols
227
+ const stocks = symbols(); // → 80 stocks
228
+ const banks = searchSymbols('BNK'); // → ['AKBNK', 'YKBNK', 'SKBNK']
149
229
 
150
- // Futures
151
- const futures = await viop.getFutures();
152
- const stockFutures = await viop.getStockFutures();
153
- const indexFutures = await viop.getIndexFutures();
230
+ // Crypto symbols
231
+ const crypto = await cryptoSymbols('TRY'); // → 173 pairs
154
232
 
155
- // Options
156
- const options = await viop.getOptions();
233
+ // FX symbols
234
+ console.log(fxSymbols); // 19 currencies/commodities
157
235
 
158
- // By symbol
159
- const thyaoDerivatives = await viop.getBySymbol('THYAO');
236
+ // Index symbols
237
+ console.log(indexSymbols); // 19 indices
160
238
  ```
161
239
 
162
- ### Companies
240
+ ### VIOP (Derivatives)
163
241
 
164
242
  ```typescript
165
- import { companies, searchCompanies } from 'borsajs';
166
-
167
- // All companies
168
- const all = await companies();
243
+ import { VIOP } from 'borsajs';
169
244
 
170
- // Search companies
171
- const banks = await searchCompanies('bank');
245
+ const viop = new VIOP();
246
+ const futures = await viop.getFutures();
247
+ const options = await viop.getOptions();
248
+ const thyao = await viop.getBySymbol('THYAO');
172
249
  ```
173
250
 
174
251
  ### Download (Multiple Tickers)
@@ -176,16 +253,8 @@ const banks = await searchCompanies('bank');
176
253
  ```typescript
177
254
  import { download, Tickers } from 'borsajs';
178
255
 
179
- // Download multiple tickers
180
256
  const data = await download(['THYAO', 'GARAN', 'AKBNK'], { period: '1mo' });
181
- console.log(data['THYAO']); // THYAO's OHLCV data
182
-
183
- // Tickers class
184
- const tickers = new Tickers('THYAO GARAN AKBNK');
185
- for (const [symbol, ticker] of tickers) {
186
- const info = await ticker.getInfo();
187
- console.log(`${symbol}: ${info.last}`);
188
- }
257
+ console.log(data['THYAO']); // THYAO's OHLCV data
189
258
  ```
190
259
 
191
260
  ## Data Sources
@@ -201,19 +270,13 @@ This library accesses publicly available data from the following sources:
201
270
  | Fund | TEFAS | [tefas.gov.tr](https://www.tefas.gov.tr/) | Investment fund data |
202
271
  | Inflation | TCMB | [tcmb.gov.tr](https://www.tcmb.gov.tr/) | Inflation data |
203
272
  | VIOP | İş Yatırım | [isyatirim.com.tr](https://www.isyatirim.com.tr/) | Futures and options |
204
- | Companies | KAP | [kap.org.tr](https://www.kap.org.tr/) | Company information |
205
273
 
206
274
  ## ⚠️ Important Notices
207
275
 
208
- ### About Data Sources
209
- Data accessed through this library belongs to the third-party sources listed above. The data is subject to the respective terms of service of each provider.
210
-
211
276
  ### Commercial Use
212
277
  **This library is intended for personal and educational use only.**
213
278
 
214
- For commercial use:
215
- - You must obtain explicit permission from the respective data source providers
216
- - The authors of this library are not responsible for any unauthorized commercial use of data
279
+ For commercial use, you must obtain explicit permission from the respective data source providers.
217
280
 
218
281
  ### Reference Project
219
282
  This project is a TypeScript port of the [borsapy](https://github.com/saidsurucu/borsapy) Python library.
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  **[Türkçe](README.md) | [English](README.en.md)**
4
4
 
5
- > **TypeScript/JavaScript port of [borsapy](https://github.com/saidsurucu/borsapy)** - Python versiyonundan ilham alınarak geliştirilmiştir.
6
-
7
- Türk finansal piyasaları için TypeScript/JavaScript veri kütüphanesi. BIST hisseleri, döviz, kripto, yatırım fonları ve ekonomik veriler için yfinance benzeri API.
5
+ Türkiye finansal piyasaları için TypeScript/JavaScript veri kütüphanesi. BIST hisseleri, döviz, kripto, yatırım fonları ve ekonomik veriler için finansal veri kaynaklarından veri çeken kütüphanedir.
8
6
 
9
7
  ## Kurulum
10
8
 
@@ -15,29 +13,187 @@ npm install borsajs
15
13
  ## Hızlı Başlangıç
16
14
 
17
15
  ```typescript
18
- import { Ticker, FX, Crypto, Fund, Inflation, download } from 'borsajs';
16
+ import { Ticker, FX, Crypto, Fund, Inflation, symbols, cryptoSymbols } from 'borsajs';
19
17
 
20
- // Hisse senedi verisi
18
+ // Hisse senedi
21
19
  const stock = new Ticker('THYAO');
22
20
  const info = await stock.getInfo();
23
- const history = await stock.getHistory({ period: '1mo' });
21
+ // { symbol: 'THYAO', last: 274.25, change: 5.75, changePercent: 2.14, ... }
24
22
 
25
23
  // Döviz
26
24
  const usd = new FX('USD');
27
25
  const rate = await usd.getCurrent();
26
+ // → { symbol: 'USD', last: 43.02, updateTime: '2026-01-02T20:59:58.000Z' }
28
27
 
29
28
  // Kripto
30
29
  const btc = new Crypto('BTCTRY');
31
30
  const price = await btc.getCurrent();
31
+ // → { symbol: 'BTCTRY', last: 3839080, bid: 3839136, ask: 3840481, ... }
32
+
33
+ // Sembol listeleri
34
+ const stockList = symbols(); // → ['AKBNK', 'ARCLK', 'ASELS', ...] (80 hisse)
35
+ const cryptoList = await cryptoSymbols(); // → ['BTCTRY', 'ETHTRY', ...] (173 çift)
36
+ ```
37
+
38
+ ## API Referansı
39
+
40
+ ### Ticker (Hisse Senedi)
41
+
42
+ ```typescript
43
+ import { Ticker } from 'borsajs';
44
+
45
+ const stock = new Ticker('THYAO');
46
+ const info = await stock.getInfo();
47
+ ```
48
+
49
+ **Response:**
50
+ ```json
51
+ {
52
+ "symbol": "THYAO",
53
+ "last": 274.25,
54
+ "open": 271,
55
+ "high": 274.25,
56
+ "low": 269.75,
57
+ "close": 268.5,
58
+ "volume": 7853192164.25,
59
+ "change": 5.75,
60
+ "changePercent": 2.14,
61
+ "updateTime": "2026-01-01T21:00:00.000Z",
62
+ "type": "stock"
63
+ }
64
+ ```
65
+
66
+ ### FX (Döviz & Emtia)
67
+
68
+ ```typescript
69
+ import { FX, fxSymbols } from 'borsajs';
70
+
71
+ console.log(fxSymbols);
72
+ // → ['USD', 'EUR', 'GBP', 'JPY', 'CHF', 'CAD', 'AUD', 'gram-altin', 'ceyrek-altin', ...]
73
+
74
+ const usd = new FX('USD');
75
+ const current = await usd.getCurrent();
76
+ ```
77
+
78
+ **Response:**
79
+ ```json
80
+ {
81
+ "symbol": "USD",
82
+ "last": 43.0237,
83
+ "open": 0,
84
+ "high": 0,
85
+ "low": 0,
86
+ "updateTime": "2026-01-02T20:59:58.000Z"
87
+ }
88
+ ```
89
+
90
+ ### Crypto (Kripto Para)
91
+
92
+ ```typescript
93
+ import { Crypto, cryptoSymbols } from 'borsajs';
94
+
95
+ const pairs = await cryptoSymbols('TRY');
96
+ // → ['BTCTRY', 'ETHTRY', 'XRPTRY', ...] (173 çift)
97
+
98
+ const btc = new Crypto('BTCTRY');
99
+ const current = await btc.getCurrent();
100
+ ```
101
+
102
+ **Response:**
103
+ ```json
104
+ {
105
+ "symbol": "BTCTRY",
106
+ "last": 3839080,
107
+ "open": 3822360,
108
+ "high": 3891234,
109
+ "low": 3793804,
110
+ "bid": 3839136,
111
+ "ask": 3840481,
112
+ "volume": 36.22,
113
+ "change": 18121,
114
+ "changePercent": 0.44,
115
+ "timestamp": 1767432414317
116
+ }
117
+ ```
118
+
119
+ ### Index (Endeksler)
120
+
121
+ ```typescript
122
+ import { Index, indexSymbols } from 'borsajs';
32
123
 
33
- // Yatırım fonu
34
- const fund = new Fund('AAK');
35
- const fundInfo = await fund.getInfo();
124
+ console.log(indexSymbols);
125
+ // ['XU100', 'XU050', 'XU030', 'XBANK', 'XUSIN', ...]
126
+
127
+ const xu100 = new Index('XU100');
128
+ const info = await xu100.getInfo();
129
+ ```
130
+
131
+ **Response:**
132
+ ```json
133
+ {
134
+ "symbol": "XU100",
135
+ "last": 11498.38,
136
+ "open": 11296.52,
137
+ "high": 11498.38,
138
+ "low": 11296.52,
139
+ "change": 236.86,
140
+ "changePercent": 2.1,
141
+ "name": "BIST 100",
142
+ "type": "index"
143
+ }
144
+ ```
145
+
146
+ ### Inflation (Enflasyon)
147
+
148
+ ```typescript
149
+ import { Inflation } from 'borsajs';
36
150
 
37
- // Enflasyon
38
151
  const inflation = new Inflation();
39
152
  const latest = await inflation.getLatest();
40
- const calculation = await inflation.calculate(100000, '2020-01', '2024-01');
153
+ const calc = await inflation.calculate(100000, '2020-01', '2024-01');
154
+ ```
155
+
156
+ **Response (Latest):**
157
+ ```json
158
+ {
159
+ "date": "2025-10-31",
160
+ "yearMonth": "11-2025",
161
+ "yearlyInflation": 31.07,
162
+ "monthlyInflation": 0.87,
163
+ "type": "TUFE"
164
+ }
165
+ ```
166
+
167
+ **Response (Calculate):**
168
+ ```json
169
+ {
170
+ "startDate": "2020-01",
171
+ "endDate": "2024-01",
172
+ "initialValue": 100000,
173
+ "finalValue": 444399.15,
174
+ "totalYears": 4,
175
+ "totalChange": 344.4,
176
+ "avgYearlyInflation": 45.19
177
+ }
178
+ ```
179
+
180
+ ### Symbols (Sembol Listeleri)
181
+
182
+ ```typescript
183
+ import { symbols, searchSymbols, cryptoSymbols, fxSymbols, indexSymbols } from 'borsajs';
184
+
185
+ // Hisse sembolleri
186
+ const stocks = symbols(); // → 80 hisse
187
+ const banks = searchSymbols('BNK'); // → ['AKBNK', 'YKBNK', 'SKBNK']
188
+
189
+ // Kripto sembolleri
190
+ const crypto = await cryptoSymbols('TRY'); // → 173 çift
191
+
192
+ // FX sembolleri
193
+ console.log(fxSymbols); // → 19 döviz/emtia
194
+
195
+ // Endeks sembolleri
196
+ console.log(indexSymbols); // → 19 endeks
41
197
  ```
42
198
 
43
199
  ## Veri Kaynakları
@@ -53,19 +209,13 @@ Bu kütüphane aşağıdaki kamuya açık veri kaynaklarından yararlanmaktadır
53
209
  | Fund | TEFAS | [tefas.gov.tr](https://www.tefas.gov.tr/) | Yatırım fonu verileri |
54
210
  | Inflation | TCMB | [tcmb.gov.tr](https://www.tcmb.gov.tr/) | Enflasyon verileri |
55
211
  | VIOP | İş Yatırım | [isyatirim.com.tr](https://www.isyatirim.com.tr/) | Vadeli işlem ve opsiyon |
56
- | Companies | KAP | [kap.org.tr](https://www.kap.org.tr/) | Şirket bilgileri ve bildirimleri |
57
212
 
58
213
  ## ⚠️ Önemli Uyarılar
59
214
 
60
- ### Veri Kaynakları Hakkında
61
- Bu kütüphane aracılığıyla erişilen veriler, yukarıda listelenen üçüncü taraf kaynaklara aittir. Veriler ilgili kaynakların kullanım koşullarına tabidir.
62
-
63
215
  ### Ticari Kullanım
64
216
  **Bu kütüphane yalnızca kişisel ve eğitim amaçlı kullanım için tasarlanmıştır.**
65
217
 
66
- Ticari kullanım için:
67
- - İlgili veri kaynağı sağlayıcılarından açık izin almanız gerekmektedir
68
- - Bu kütüphanenin yazarları, verilerin izinsiz ticari kullanımından sorumlu değildir
218
+ Ticari kullanım için ilgili veri kaynağı sağlayıcılarından açık izin almanız gerekmektedir.
69
219
 
70
220
  ### Referans Proje
71
221
  Bu proje, [borsapy](https://github.com/saidsurucu/borsapy) Python kütüphanesinden ilham alınarak TypeScript'e port edilmiştir.
package/dist/index.d.ts CHANGED
@@ -13,7 +13,8 @@ export { Index, indices, index, INDICES } from './index-class.js';
13
13
  export type { IndexInfo } from './index-class.js';
14
14
  export { Inflation } from './inflation.js';
15
15
  export { VIOP } from './viop.js';
16
- export { companies, searchCompanies } from './market.js';
16
+ export { symbols, searchSymbols, cryptoSymbols, fxSymbols, indexSymbols } from './market.js';
17
+ export type { FXSymbol, IndexSymbol, StockSymbol, Company } from './market.js';
17
18
  export { BorsajsError, TickerNotFoundError, DataNotAvailableError, APIError, AuthenticationError, RateLimitError, InvalidPeriodError, InvalidIntervalError } from './exceptions.js';
18
19
  export { Cache, TTL, getCache } from './cache.js';
19
20
  export type { OHLCVData, HistoryOptions } from './providers/paratic.js';
@@ -21,6 +22,6 @@ export type { TickerData } from './providers/btcturk.js';
21
22
  export type { FXCurrentData, FXHistoryData } from './providers/dovizcom.js';
22
23
  export type { FundInfo, FundHistoryData, SearchResult } from './providers/tefas.js';
23
24
  export type { InflationLatest, InflationData, InflationCalculation } from './providers/tcmb.js';
24
- export type { ContractData, Company, Disclosure } from './providers/kap.js';
25
+ export type { ContractData, Disclosure } from './providers/kap.js';
25
26
  export declare const VERSION = "0.1.0";
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEpL,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC5E,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpF,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChG,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5E,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7F,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEpL,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC5E,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpF,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChG,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEnE,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ export { Fund, searchFunds } from './fund.js';
9
9
  export { Index, indices, index, INDICES } from './index-class.js';
10
10
  export { Inflation } from './inflation.js';
11
11
  export { VIOP } from './viop.js';
12
- export { companies, searchCompanies } from './market.js';
12
+ export { symbols, searchSymbols, cryptoSymbols, fxSymbols, indexSymbols } from './market.js';
13
13
  export { BorsajsError, TickerNotFoundError, DataNotAvailableError, APIError, AuthenticationError, RateLimitError, InvalidPeriodError, InvalidIntervalError } from './exceptions.js';
14
14
  export { Cache, TTL, getCache } from './cache.js';
15
15
  export const VERSION = '0.1.0';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEpL,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AASlD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7F,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEpL,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AASlD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
package/dist/market.d.ts CHANGED
@@ -1,7 +1,36 @@
1
+ declare const BIST_STOCKS: readonly ["THYAO", "GARAN", "AKBNK", "YKBNK", "ISCTR", "HALKB", "VAKBN", "SAHOL", "SISE", "TUPRS", "TCELL", "EREGL", "BIMAS", "KOZAL", "PETKM", "ASELS", "KCHOL", "TOASO", "FROTO", "ARCLK", "MGROS", "TTKOM", "ENKAI", "PGSUS", "TAVHL", "EKGYO", "SASA", "DOHOL", "VESTL", "GUBRF", "KOZAA", "KLMSC", "KRDMD", "ODAS", "TSKB", "AKSEN", "AEFES", "KONTR", "CEMTS", "LOGO", "OYAKC", "ULKER", "CIMSA", "ALARK", "TURSG", "ISGYO", "GESAN", "SOKM", "DOAS", "OTKAR", "BTCIM", "BRISA", "NETAS", "IHLGM", "TKFEN", "TRGYO", "AYGAZ", "CCOLA", "MAVI", "HEKTS", "ANSGR", "ZOREN", "AGHOL", "ISMEN", "ANHYT", "IPEKE", "KORDS", "KARTN", "KLRHO", "BINHO", "AKSA", "NUHCM", "ALBRK", "SKBNK", "TMSN", "VERUS", "SISEB", "POLHO", "GLYHO", "TUREX"];
2
+ export interface Company {
3
+ ticker: string;
4
+ name?: string;
5
+ sector?: string;
6
+ }
1
7
  /**
2
- * Market-level functions for BIST data.
8
+ * Get common BIST stock symbols.
9
+ * @returns Array of stock symbols
3
10
  */
4
- import { Company } from './providers/kap.js';
5
- export declare function companies(): Promise<Company[]>;
6
- export declare function searchCompanies(query: string): Promise<Company[]>;
11
+ export declare function symbols(): string[];
12
+ /**
13
+ * Search stocks by ticker pattern.
14
+ * @param query - Search query (matches start of ticker)
15
+ * @returns Matching symbols
16
+ */
17
+ export declare function searchSymbols(query: string): string[];
18
+ /**
19
+ * Get available cryptocurrency pairs.
20
+ * @param quote - Quote currency (default: 'TRY')
21
+ * @returns Array of trading pairs (e.g., ['BTCTRY', 'ETHTRY', ...])
22
+ */
23
+ export declare function cryptoSymbols(quote?: string): Promise<string[]>;
24
+ /**
25
+ * Available FX symbols.
26
+ */
27
+ export declare const fxSymbols: readonly ["USD", "EUR", "GBP", "JPY", "CHF", "CAD", "AUD", "gram-altin", "ceyrek-altin", "yarim-altin", "tam-altin", "cumhuriyet-altini", "gumus", "ons", "BRENT", "WTI", "diesel", "gasoline", "lpg"];
28
+ /**
29
+ * Available BIST indices.
30
+ */
31
+ export declare const indexSymbols: readonly ["XU100", "XU050", "XU030", "XBANK", "XUSIN", "XHOLD", "XUTEK", "XGIDA", "XTRZM", "XULAS", "XSGRT", "XMANA", "XKMYA", "XMADN", "XELKT", "XTEKS", "XILTM", "XUMAL", "XUTUM"];
32
+ export type FXSymbol = typeof fxSymbols[number];
33
+ export type IndexSymbol = typeof indexSymbols[number];
34
+ export type StockSymbol = typeof BIST_STOCKS[number];
35
+ export {};
7
36
  //# sourceMappingURL=market.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../src/market.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAkB,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7D,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAA4C;AACjG,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAA2C"}
1
+ {"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../src/market.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,WAAW,itBASP,CAAC;AAEX,MAAM,WAAW,OAAO;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,MAAM,EAAE,CAElC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAGrD;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,KAAK,GAAE,MAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAE5E;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,wMAUZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY,sLAIf,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAChD,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC"}
package/dist/market.js CHANGED
@@ -1,7 +1,62 @@
1
1
  /**
2
2
  * Market-level functions for BIST data.
3
3
  */
4
- import { getKapProvider } from './providers/kap.js';
5
- export async function companies() { return getKapProvider().getCompanies(); }
6
- export async function searchCompanies(query) { return getKapProvider().search(query); }
4
+ import { getBtcTurkProvider } from './providers/btcturk.js';
5
+ // Static list of major BIST stocks (commonly traded)
6
+ const BIST_STOCKS = [
7
+ 'THYAO', 'GARAN', 'AKBNK', 'YKBNK', 'ISCTR', 'HALKB', 'VAKBN', 'SAHOL', 'SISE', 'TUPRS',
8
+ 'TCELL', 'EREGL', 'BIMAS', 'KOZAL', 'PETKM', 'ASELS', 'KCHOL', 'TOASO', 'FROTO', 'ARCLK',
9
+ 'MGROS', 'TTKOM', 'ENKAI', 'PGSUS', 'TAVHL', 'EKGYO', 'SASA', 'DOHOL', 'VESTL', 'GUBRF',
10
+ 'KOZAA', 'KLMSC', 'KRDMD', 'ODAS', 'TSKB', 'AKSEN', 'AEFES', 'KONTR', 'CEMTS', 'LOGO',
11
+ 'OYAKC', 'ULKER', 'CIMSA', 'ALARK', 'TURSG', 'ISGYO', 'GESAN', 'SOKM', 'DOAS', 'OTKAR',
12
+ 'BTCIM', 'BRISA', 'NETAS', 'IHLGM', 'TKFEN', 'TRGYO', 'AYGAZ', 'CCOLA', 'MAVI', 'HEKTS',
13
+ 'ANSGR', 'ZOREN', 'AGHOL', 'ISMEN', 'ANHYT', 'IPEKE', 'KORDS', 'KARTN', 'KLRHO', 'BINHO',
14
+ 'AKSA', 'NUHCM', 'ALBRK', 'SKBNK', 'TMSN', 'VERUS', 'SISEB', 'POLHO', 'GLYHO', 'TUREX',
15
+ ];
16
+ /**
17
+ * Get common BIST stock symbols.
18
+ * @returns Array of stock symbols
19
+ */
20
+ export function symbols() {
21
+ return [...BIST_STOCKS].sort();
22
+ }
23
+ /**
24
+ * Search stocks by ticker pattern.
25
+ * @param query - Search query (matches start of ticker)
26
+ * @returns Matching symbols
27
+ */
28
+ export function searchSymbols(query) {
29
+ const q = query.toUpperCase();
30
+ return BIST_STOCKS.filter(s => s.includes(q));
31
+ }
32
+ /**
33
+ * Get available cryptocurrency pairs.
34
+ * @param quote - Quote currency (default: 'TRY')
35
+ * @returns Array of trading pairs (e.g., ['BTCTRY', 'ETHTRY', ...])
36
+ */
37
+ export async function cryptoSymbols(quote = 'TRY') {
38
+ return getBtcTurkProvider().getPairs(quote);
39
+ }
40
+ /**
41
+ * Available FX symbols.
42
+ */
43
+ export const fxSymbols = [
44
+ // Currencies
45
+ 'USD', 'EUR', 'GBP', 'JPY', 'CHF', 'CAD', 'AUD',
46
+ // Precious Metals
47
+ 'gram-altin', 'ceyrek-altin', 'yarim-altin', 'tam-altin', 'cumhuriyet-altini',
48
+ 'gumus', 'ons',
49
+ // Energy
50
+ 'BRENT', 'WTI',
51
+ // Fuel
52
+ 'diesel', 'gasoline', 'lpg',
53
+ ];
54
+ /**
55
+ * Available BIST indices.
56
+ */
57
+ export const indexSymbols = [
58
+ 'XU100', 'XU050', 'XU030', 'XBANK', 'XUSIN', 'XHOLD', 'XUTEK', 'XGIDA',
59
+ 'XTRZM', 'XULAS', 'XSGRT', 'XMANA', 'XKMYA', 'XMADN', 'XELKT', 'XTEKS',
60
+ 'XILTM', 'XUMAL', 'XUTUM',
61
+ ];
7
62
  //# sourceMappingURL=market.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"market.js","sourceRoot":"","sources":["../src/market.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAW,MAAM,oBAAoB,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,SAAS,KAAyB,OAAO,cAAc,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AACjG,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,KAAa,IAAwB,OAAO,cAAc,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"market.js","sourceRoot":"","sources":["../src/market.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,qDAAqD;AACrD,MAAM,WAAW,GAAG;IAChB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IACvF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACxF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACvF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;IACrF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IACtF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IACvF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACxF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;CAChF,CAAC;AAQX;;;GAGG;AACH,MAAM,UAAU,OAAO;IACnB,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACvC,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAC9B,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB,KAAK;IACrD,OAAO,kBAAkB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,aAAa;IACb,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IAC/C,kBAAkB;IAClB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB;IAC7E,OAAO,EAAE,KAAK;IACd,SAAS;IACT,OAAO,EAAE,KAAK;IACd,OAAO;IACP,QAAQ,EAAE,UAAU,EAAE,KAAK;CACrB,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO;CACnB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "borsajs",
3
- "version": "0.1.1",
4
- "description": "Turkish financial markets data library - yfinance-like API for BIST stocks, forex, crypto, and more",
3
+ "version": "0.1.2",
4
+ "description": "Turkey financial markets data library, BIST stocks, forex, crypto, investment funds, and more",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,8 +24,11 @@
24
24
  "turkey",
25
25
  "forex",
26
26
  "crypto",
27
- "market-data",
28
- "yfinance"
27
+ "investment-funds",
28
+ "economic-indicators",
29
+ "macroeconomic-indicators",
30
+ "türkiye",
31
+ "market-data"
29
32
  ],
30
33
  "author": "Mesut Piskin",
31
34
  "license": "Apache-2.0",
package/src/index.ts CHANGED
@@ -22,7 +22,8 @@ export { Inflation } from './inflation.js';
22
22
 
23
23
  export { VIOP } from './viop.js';
24
24
 
25
- export { companies, searchCompanies } from './market.js';
25
+ export { symbols, searchSymbols, cryptoSymbols, fxSymbols, indexSymbols } from './market.js';
26
+ export type { FXSymbol, IndexSymbol, StockSymbol, Company } from './market.js';
26
27
 
27
28
  export { BorsajsError, TickerNotFoundError, DataNotAvailableError, APIError, AuthenticationError, RateLimitError, InvalidPeriodError, InvalidIntervalError } from './exceptions.js';
28
29
 
@@ -33,6 +34,6 @@ export type { TickerData } from './providers/btcturk.js';
33
34
  export type { FXCurrentData, FXHistoryData } from './providers/dovizcom.js';
34
35
  export type { FundInfo, FundHistoryData, SearchResult } from './providers/tefas.js';
35
36
  export type { InflationLatest, InflationData, InflationCalculation } from './providers/tcmb.js';
36
- export type { ContractData, Company, Disclosure } from './providers/kap.js';
37
+ export type { ContractData, Disclosure } from './providers/kap.js';
37
38
 
38
39
  export const VERSION = '0.1.0';
package/src/market.ts CHANGED
@@ -1,7 +1,77 @@
1
1
  /**
2
2
  * Market-level functions for BIST data.
3
3
  */
4
- import { getKapProvider, Company } from './providers/kap.js';
4
+ import { getBtcTurkProvider } from './providers/btcturk.js';
5
5
 
6
- export async function companies(): Promise<Company[]> { return getKapProvider().getCompanies(); }
7
- export async function searchCompanies(query: string): Promise<Company[]> { return getKapProvider().search(query); }
6
+ // Static list of major BIST stocks (commonly traded)
7
+ const BIST_STOCKS = [
8
+ 'THYAO', 'GARAN', 'AKBNK', 'YKBNK', 'ISCTR', 'HALKB', 'VAKBN', 'SAHOL', 'SISE', 'TUPRS',
9
+ 'TCELL', 'EREGL', 'BIMAS', 'KOZAL', 'PETKM', 'ASELS', 'KCHOL', 'TOASO', 'FROTO', 'ARCLK',
10
+ 'MGROS', 'TTKOM', 'ENKAI', 'PGSUS', 'TAVHL', 'EKGYO', 'SASA', 'DOHOL', 'VESTL', 'GUBRF',
11
+ 'KOZAA', 'KLMSC', 'KRDMD', 'ODAS', 'TSKB', 'AKSEN', 'AEFES', 'KONTR', 'CEMTS', 'LOGO',
12
+ 'OYAKC', 'ULKER', 'CIMSA', 'ALARK', 'TURSG', 'ISGYO', 'GESAN', 'SOKM', 'DOAS', 'OTKAR',
13
+ 'BTCIM', 'BRISA', 'NETAS', 'IHLGM', 'TKFEN', 'TRGYO', 'AYGAZ', 'CCOLA', 'MAVI', 'HEKTS',
14
+ 'ANSGR', 'ZOREN', 'AGHOL', 'ISMEN', 'ANHYT', 'IPEKE', 'KORDS', 'KARTN', 'KLRHO', 'BINHO',
15
+ 'AKSA', 'NUHCM', 'ALBRK', 'SKBNK', 'TMSN', 'VERUS', 'SISEB', 'POLHO', 'GLYHO', 'TUREX',
16
+ ] as const;
17
+
18
+ export interface Company {
19
+ ticker: string;
20
+ name?: string;
21
+ sector?: string;
22
+ }
23
+
24
+ /**
25
+ * Get common BIST stock symbols.
26
+ * @returns Array of stock symbols
27
+ */
28
+ export function symbols(): string[] {
29
+ return [...BIST_STOCKS].sort();
30
+ }
31
+
32
+ /**
33
+ * Search stocks by ticker pattern.
34
+ * @param query - Search query (matches start of ticker)
35
+ * @returns Matching symbols
36
+ */
37
+ export function searchSymbols(query: string): string[] {
38
+ const q = query.toUpperCase();
39
+ return BIST_STOCKS.filter(s => s.includes(q));
40
+ }
41
+
42
+ /**
43
+ * Get available cryptocurrency pairs.
44
+ * @param quote - Quote currency (default: 'TRY')
45
+ * @returns Array of trading pairs (e.g., ['BTCTRY', 'ETHTRY', ...])
46
+ */
47
+ export async function cryptoSymbols(quote: string = 'TRY'): Promise<string[]> {
48
+ return getBtcTurkProvider().getPairs(quote);
49
+ }
50
+
51
+ /**
52
+ * Available FX symbols.
53
+ */
54
+ export const fxSymbols = [
55
+ // Currencies
56
+ 'USD', 'EUR', 'GBP', 'JPY', 'CHF', 'CAD', 'AUD',
57
+ // Precious Metals
58
+ 'gram-altin', 'ceyrek-altin', 'yarim-altin', 'tam-altin', 'cumhuriyet-altini',
59
+ 'gumus', 'ons',
60
+ // Energy
61
+ 'BRENT', 'WTI',
62
+ // Fuel
63
+ 'diesel', 'gasoline', 'lpg',
64
+ ] as const;
65
+
66
+ /**
67
+ * Available BIST indices.
68
+ */
69
+ export const indexSymbols = [
70
+ 'XU100', 'XU050', 'XU030', 'XBANK', 'XUSIN', 'XHOLD', 'XUTEK', 'XGIDA',
71
+ 'XTRZM', 'XULAS', 'XSGRT', 'XMANA', 'XKMYA', 'XMADN', 'XELKT', 'XTEKS',
72
+ 'XILTM', 'XUMAL', 'XUTUM',
73
+ ] as const;
74
+
75
+ export type FXSymbol = typeof fxSymbols[number];
76
+ export type IndexSymbol = typeof indexSymbols[number];
77
+ export type StockSymbol = typeof BIST_STOCKS[number];
package/test/demo.ts CHANGED
@@ -4,95 +4,132 @@
4
4
  */
5
5
  import { Crypto, cryptoPairs } from '../src/crypto.js';
6
6
  import { FX } from '../src/fx.js';
7
- import { Ticker } from '../src/ticker.js';
8
- import { Index, indices } from '../src/index-class.js';
9
7
  import { Fund, searchFunds } from '../src/fund.js';
8
+ import { Index, indices } from '../src/index-class.js';
10
9
  import { Inflation } from '../src/inflation.js';
10
+ import { Ticker } from '../src/ticker.js';
11
+ import { symbols, searchSymbols, cryptoSymbols, fxSymbols, indexSymbols } from '../src/market.js';
11
12
 
12
13
  async function testCrypto() {
13
- console.log('\n🪙 Testing Crypto (BtcTurk)...');
14
- console.log('─'.repeat(50));
14
+ console.log('\n🪙 CRYPTO (BtcTurk)');
15
+ console.log('─'.repeat(60));
15
16
  try {
16
17
  const btc = new Crypto('BTCTRY');
17
18
  const current = await btc.getCurrent();
18
- console.log('BTC/TRY Current:', JSON.stringify(current, null, 2));
19
+ console.log('BTC/TRY:', JSON.stringify(current, null, 2));
20
+
19
21
  const pairs = await cryptoPairs('TRY');
20
- console.log(`\nAvailable TRY pairs: ${pairs.slice(0, 10).join(', ')}...`);
21
- } catch (error) { console.error('Crypto Error:', error); }
22
+ console.log(`\nAvailable pairs: ${pairs.slice(0, 10).join(', ')}... (${pairs.length} total)`);
23
+ } catch (error) { console.error('Error:', error); }
22
24
  }
23
25
 
24
26
  async function testFX() {
25
- console.log('\n💱 Testing FX (doviz.com)...');
26
- console.log('─'.repeat(50));
27
+ console.log('\n💱 FX (doviz.com)');
28
+ console.log('─'.repeat(60));
27
29
  try {
28
30
  const usd = new FX('USD');
29
31
  const current = await usd.getCurrent();
30
- console.log('USD/TRY Current:', JSON.stringify(current, null, 2));
32
+ console.log('USD/TRY:', JSON.stringify(current, null, 2));
33
+
31
34
  const gold = new FX('gram-altin');
32
35
  const goldCurrent = await gold.getCurrent();
33
- console.log('\nGold (gram) Current:', JSON.stringify(goldCurrent, null, 2));
34
- } catch (error) { console.error('FX Error:', error); }
36
+ console.log('\nGold (gram):', JSON.stringify(goldCurrent, null, 2));
37
+
38
+ console.log(`\nFX Symbols: ${fxSymbols.slice(0, 10).join(', ')}...`);
39
+ } catch (error) { console.error('Error:', error); }
35
40
  }
36
41
 
37
42
  async function testTicker() {
38
- console.log('\n📈 Testing Ticker (Paratic)...');
39
- console.log('─'.repeat(50));
43
+ console.log('\n📈 TICKER (Paratic)');
44
+ console.log('─'.repeat(60));
40
45
  try {
41
46
  const stock = new Ticker('THYAO');
42
47
  const info = await stock.getInfo();
43
- console.log('THYAO Info:', JSON.stringify(info, null, 2));
44
- } catch (error) { console.error('Ticker Error:', error); }
48
+ console.log('THYAO:', JSON.stringify(info, null, 2));
49
+
50
+ const history = await stock.getHistory({ period: '5d', interval: '1d' });
51
+ console.log(`\nHistory (5d): ${history.length} records`);
52
+ if (history.length > 0) console.log('Last:', JSON.stringify(history[history.length - 1], null, 2));
53
+ } catch (error) { console.error('Error:', error); }
45
54
  }
46
55
 
47
56
  async function testIndex() {
48
- console.log('\n📊 Testing Index (Paratic)...');
49
- console.log('─'.repeat(50));
57
+ console.log('\n📊 INDEX (Paratic)');
58
+ console.log('─'.repeat(60));
50
59
  try {
51
- console.log('Available indices:', indices().slice(0, 10).join(', '));
60
+ console.log('Index Symbols:', indexSymbols.slice(0, 10).join(', '));
61
+
52
62
  const xu100 = new Index('XU100');
53
63
  const info = await xu100.getInfo();
54
- console.log('\nXU100 Info:', JSON.stringify(info, null, 2));
55
- } catch (error) { console.error('Index Error:', error); }
64
+ console.log('\nXU100:', JSON.stringify(info, null, 2));
65
+ } catch (error) { console.error('Error:', error); }
56
66
  }
57
67
 
58
68
  async function testFund() {
59
- console.log('\n🏦 Testing Fund (TEFAS)...');
60
- console.log('─'.repeat(50));
69
+ console.log('\n🏦 FUND (TEFAS)');
70
+ console.log('─'.repeat(60));
61
71
  try {
62
- const results = await searchFunds('ak', 5);
72
+ const results = await searchFunds('ak', 3);
63
73
  console.log('Search "ak":', JSON.stringify(results, null, 2));
74
+
64
75
  if (results.length > 0) {
65
76
  const fund = new Fund(results[0].fundCode);
66
77
  const info = await fund.getInfo();
67
- console.log(`\n${results[0].fundCode} Info:`, JSON.stringify(info, null, 2));
78
+ console.log(`\n${results[0].fundCode}:`, JSON.stringify(info, null, 2));
68
79
  }
69
- } catch (error) { console.error('Fund Error:', error); }
80
+ } catch (error) { console.error('Error:', error); }
70
81
  }
71
82
 
72
83
  async function testInflation() {
73
- console.log('\n📉 Testing Inflation (TCMB)...');
74
- console.log('─'.repeat(50));
84
+ console.log('\n📉 INFLATION (TCMB)');
85
+ console.log('─'.repeat(60));
75
86
  try {
76
87
  const inflation = new Inflation();
77
88
  const latest = await inflation.getLatest();
78
89
  console.log('Latest CPI:', JSON.stringify(latest, null, 2));
79
- const cpi = await inflation.getTufe({ limit: 3 });
80
- console.log('\nCPI last 3 months:', JSON.stringify(cpi, null, 2));
81
- const calculation = await inflation.calculate(100000, '2020-01', '2024-01');
82
- console.log('\n100,000 TL (2020-01 2024-01):', JSON.stringify(calculation, null, 2));
83
- } catch (error) { console.error('Inflation Error:', error); }
90
+
91
+ const calc = await inflation.calculate(100000, '2020-01', '2024-01');
92
+ console.log('\nCalculation (100K TL, 2020-01 2024-01):', JSON.stringify(calc, null, 2));
93
+ } catch (error) { console.error('Error:', error); }
94
+ }
95
+
96
+ async function testSymbols() {
97
+ console.log('\n🏢 SYMBOLS');
98
+ console.log('─'.repeat(60));
99
+ try {
100
+ // Stock symbols
101
+ const stockSymbols = symbols();
102
+ console.log(`Stock Symbols: ${stockSymbols.slice(0, 15).join(', ')}... (${stockSymbols.length} total)`);
103
+
104
+ // Search stocks
105
+ const banks = searchSymbols('BNK');
106
+ console.log(`\nSearch "BNK": ${banks.join(', ')}`);
107
+
108
+ // Crypto symbols
109
+ const cryptoList = await cryptoSymbols('TRY');
110
+ console.log(`\nCrypto Symbols: ${cryptoList.slice(0, 10).join(', ')}... (${cryptoList.length} total)`);
111
+
112
+ // FX symbols
113
+ console.log(`\nFX Symbols: ${fxSymbols.join(', ')}`);
114
+
115
+ // Index symbols
116
+ console.log(`\nIndex Symbols: ${indexSymbols.join(', ')}`);
117
+ } catch (error) { console.error('Error:', error); }
84
118
  }
85
119
 
86
120
  async function main() {
87
121
  console.log('🚀 borsajs API Test');
88
- console.log('═'.repeat(50));
122
+ console.log('═'.repeat(60));
123
+
89
124
  await testCrypto();
90
125
  await testFX();
91
126
  await testTicker();
92
127
  await testIndex();
93
128
  await testFund();
94
129
  await testInflation();
95
- console.log('\n' + '═'.repeat(50));
130
+ await testSymbols();
131
+
132
+ console.log('\n' + '═'.repeat(60));
96
133
  console.log('✅ All tests completed!');
97
134
  }
98
135