Skip to main content

Historical data of financial instruments from NSE

Project description


<p align="center"><img src="screenshots/tickerstore-logo.png"></p>



## Super simple to use

TickerStore is an easy to use python library used to get historical
data of financial instruments from NSE.


## Install
```bash
$ pip install tickerstore
```

## Basic Usage

Using TickerStore you can specify the source from where the data needs
to be fetched. At present, there are 2 sources of data **Upstox** and
**NSE**. EOD (End of Day) data can be used simple by using the following piece
of code.

```python
from tickerstore.store import TickerStore
from datetime import date

fetcher = TickerStore()
fetcher.historical_data("SBIN", date(2018,1,1), date(2018,1,30), TickerStore.INTERVAL_DAY_1)

```

## How it works?
TickerStore tries to make historical stock market data more easy to
use in your python projects. TickerStore has multiple sources from
where the data is fetched. At present we have 2 sources, **NSE** and **Upstox**.
Data from these 2 sources are fetched in a predefined order.

The default order is:
1. Upstox
2. NSE

If one fails, the next one is tried in order. You can change the order using a **set_fetch_order()** method.
To view the present fetch order use the **get_fetch_order()** method.


## Using with .env file (python-dotenv)

Create a **.env** file in the present working directory and enter your
Upstox API key and API secret and leave all other fields as it is.

```dotenv
UPSTOX_API_KEY=<YOUR_UPSTOX_API_KEY>
UPSTOX_API_SECRET=<YOUR_UPSTOX_API_SECRET>
UPSTOX_REDIRECT_URI=http://127.0.0.1:5000/callback
TEMP_SERVER_SHUTDOWN_URL=http://127.0.0.1:5000/shutdown
TEMP_SERVER_AUTH_PAGE=http://127.0.0.1:5000/
```

On python end, use the **find_dotenv** function from the python-dotenv
package and pass it to the TickerStore. The information from the dotenv
file will be available as environment variables.
```python
from tickerstore.store import TickerStore
from dotenv import find_dotenv
from datetime import date

fetcher = TickerStore(dotenv_path=find_dotenv())
fetcher.historical_data("SBIN", date(2018,1,1), date(2018,1,30), TickerStore.INTERVAL_DAY_1)

```


## Using with Upstox
Using only with **Upstox**:

```python
from tickerstore.store import TickerStore
from datetime import date

fetcher = TickerStore(
upstox_api_key="<YOUR_UPSTOX_API_KEY>",
upstox_api_secret="<YOUR_UPSTOX_API_SECRET>",
upstox_redirect_uri="http://localhost:5000/callback",
temp_server_auth_page="http://localhost:8000/"
)

fetcher.historical_data("SBIN", date(2018,1,1), date(2018,1,30), TickerStore.INTERVAL_DAY_1)

```


## Change fetch order
Order in which the data is fetched from different sources can be changed.

```python
from tickerstore.store import TickerStore
from dotenv import find_dotenv
from datetime import date

fetcher = TickerStore(dotenv_path=find_dotenv())
fetcher.set_fetch_order([TickerStore.NSE, TickerStore.UPSTOX])

fetcher.historical_data("SBIN", date(2018,1,1), date(2018,1,30), TickerStore.INTERVAL_DAY_1)

```
TickerStore now first fetches data from NSE and then from UPSTOX. You can
even specify a single source and data will only be fetched from there.

## API
Coming soon :)


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TickerStore-0.0.8.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

TickerStore-0.0.8-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file TickerStore-0.0.8.tar.gz.

File metadata

  • Download URL: TickerStore-0.0.8.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for TickerStore-0.0.8.tar.gz
Algorithm Hash digest
SHA256 45dca25c0b277c0c0b6ab331a533a2b211c7102485b0f822551994a5120231fd
MD5 90993ee50b1810165b6839c5e53ed16c
BLAKE2b-256 593c41ed43509d3c9a346b6d14739fce41783c6e478a757162bc2ae8303de78b

See more details on using hashes here.

File details

Details for the file TickerStore-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: TickerStore-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for TickerStore-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 416784e499812b857b162c9141ac3479561c339647b4db53460bd1006a5ebeac
MD5 cd306406ca6557fb325f4287f12a08bc
BLAKE2b-256 d2c386e799b14e017c2afd1d1960b49906f66d41c56d63a38eb0bff78fdecb96

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page