npm package: @omc345/borsa
Description: Turkish financial markets data library for BIST stocks, FX, crypto, funds, and macro data.
Latest version: 0.1.0

# @omc345/borsa

TypeScript library for Turkish financial markets (BIST stocks, FX, crypto, funds, and macro data). The API is yfinance-inspired with async/await patterns.

## Install

```bash
npm install @omc345/borsa
```

## Quick Start

```ts
import {
  Ticker,
  FX,
  Crypto,
  Fund,
  Inflation,
  download,
  companies,
  cryptoPairs
} from '@omc345/borsa';

const stock = new Ticker('THYAO');
console.log(await stock.info());
console.log(await stock.history({ period: '1mo' }));
console.log(await stock.balanceSheet());

const data = await download(['THYAO', 'GARAN', 'AKBNK'], { period: '1mo' });
console.log(data);

const usd = new FX('USD');
console.log(await usd.current());

const btc = new Crypto('BTCTRY');
console.log(await btc.current());

const fund = new Fund('AAK');
console.log(await fund.info());

const inf = new Inflation();
console.log(await inf.latest());

console.log(await companies());
console.log(await cryptoPairs());
```

## Ticker (BIST Stocks)

```ts
const ticker = new Ticker('THYAO');

// fast info
console.log(await ticker.fastInfo());

// full info (yfinance aliases included)
console.log(await ticker.info());

// history
console.log(await ticker.history({ period: '1y', interval: '1d' }));

// financials
console.log(await ticker.balanceSheet());
console.log(await ticker.quarterlyIncomeStmt());
console.log(await ticker.ttmCashflow());

// actions
console.log(await ticker.dividends());
console.log(await ticker.splits());
console.log(await ticker.actions());

// KAP disclosures
console.log(await ticker.news());
console.log(await ticker.calendar());
console.log(await ticker.earningsDates());

// analyst data
console.log(await ticker.analystPriceTargets());
console.log(await ticker.recommendationsSummary());
```

## Tickers & download

```ts
import { Tickers, download } from '@omc345/borsa';

const tickers = new Tickers(['THYAO', 'GARAN', 'AKBNK']);
for (const [symbol, ticker] of tickers) {
  console.log(symbol, (await ticker.info()).last);
}

const grouped = await download(['THYAO', 'GARAN'], { groupBy: 'ticker' });
const columnGrouped = await download(['THYAO', 'GARAN']);
```

## Index

```ts
import { Index, indices } from '@omc345/borsa';

console.log(indices());
const xu100 = new Index('XU100');
console.log(await xu100.info());
console.log(await xu100.history({ period: '1mo' }));
```

## FX

```ts
const usd = new FX('USD');
console.log(await usd.current());
console.log(await usd.history({ period: '1mo' }));
```

## Crypto

```ts
const btc = new Crypto('BTCTRY');
console.log(await btc.current());
console.log(await btc.history({ period: '1mo' }));
```

## Funds

```ts
import { Fund, searchFunds } from '@omc345/borsa';

console.log(await searchFunds('banka'));
const fund = new Fund('AAK');
console.log(await fund.info());
console.log(await fund.history({ period: '1mo' }));
```

## Inflation

```ts
const inf = new Inflation();
console.log(await inf.latest('tufe'));
console.log(await inf.tufe({ limit: 12 }));
console.log(await inf.calculate(100000, '2020-01', '2024-01'));
```

## VIOP

```ts
import { VIOP } from '@omc345/borsa';

const viop = new VIOP();
console.log(await viop.futures());
console.log(await viop.options());
console.log(await viop.getBySymbol('THYAO'));
```

## Testing

```bash
npm test
```

For live integration tests:

```bash
BORSA_LIVE=1 npm test
```

## Disclaimer

Data is sourced from İş Yatırım, Paratic, KAP, TCMB, BtcTurk, TEFAS, doviz.com, hedeffiyat.com.tr, and isinturkiye.com.tr. Intended for personal use only.

## License

Apache 2.0