Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shaunlwm/reticker
Use Regular Expression to extract possible stock tickers from text
https://github.com/shaunlwm/reticker
stocks stocks-ticker ticker ticker-symbol tickers
Last synced: 26 days ago
JSON representation
Use Regular Expression to extract possible stock tickers from text
- Host: GitHub
- URL: https://github.com/shaunlwm/reticker
- Owner: ShaunLWM
- License: mit
- Created: 2021-08-29T05:41:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-03T07:47:02.000Z (over 3 years ago)
- Last Synced: 2024-04-24T13:22:17.763Z (8 months ago)
- Topics: stocks, stocks-ticker, ticker, ticker-symbol, tickers
- Language: TypeScript
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# reticker
[![npm](https://img.shields.io/npm/dt/reticker.svg)](https://github.com/ShaunLWM/reticker/releases)
[![npm](https://img.shields.io/npm/v/reticker.svg)](https://www.npmjs.com/package/reticker)
![npm](https://img.shields.io/npm/l/reticker)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ShaunLWM/reticker/Run%20jest)A [Python-ported](https://github.com/impredicative/reticker) stock tickers extractor using Regular Expressions.
## Installation
```bash
npm install reticker
# -- or
yarn add reticker
```## Usage
```python
import TickerExtractor from "reticker"const tickerExtractor = new TickerExtractor();
const tickers = await tickerExtractor.extract("Comparing FNGU vs $WEBL vs SOXL- who wins? And what about $cldl vs $Skyu? IMHO, SOXL is king!\nBTW, will the $w+$Z pair still grow?");
# ['FNGU', 'WEBL', 'SOXL', 'CLDL', 'SKYU', 'W', 'Z']const tickers = await tickerExtractor.extract("Which of BTC-USD, $ETH-USD and $ada-usd is best?\nWhat about $Brk.a and $Brk.B? Compare futures MGC=F and SIL=F.");
# ['BTC-USD', 'ETH-USD', 'ADA-USD', 'BRK.A', 'BRK.B', 'MGC=F', 'SIL=F']
```### Options
```
new TickerExtractor(deduplicate = true, options: TickerMatchConfig)// deduplicate - Removes duplicate tickers from result
# TickerMatchConfig
prefixedUppercase?: boolean = true;
unprefixedUppercase?: boolean = true;
prefixedLowercase?: boolean = true;
prefixedTitlecase?: boolean = true;
separators?: string | undefined | null = ".-=";
```## TODO
- Match `^STI`
- Match `9988.hk`## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)
## Credits
[reticker](https://github.com/impredicative/reticker)