tvdatafeed-enhanced


Nametvdatafeed-enhanced JSON
Version 2.2.0 PyPI version JSON
download
home_pageNone
SummaryTradingView historical and live data downloader with advanced features
upload_time2025-10-17 13:39:45
maintainerNone
docs_urlNone
authorStreamAlpha, rongardF
requires_python>=3.10
licenseNone
keywords tradingview trading data market-data finance stocks crypto forex live-data real-time
VCS
bugtrack_url
requirements setuptools pandas websocket-client requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TvDatafeed Enhanced

[![PyPI version](https://badge.fury.io/py/tvdatafeed-enhanced.svg)](https://badge.fury.io/py/tvdatafeed-enhanced)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A powerful TradingView historical and live data downloader for Python. Download up to 5000 bars of historical data on any supported timeframe, with support for both basic historical data retrieval and advanced live streaming with callback architecture.

## ✨ Features

- 📊 **Historical Data**: Download up to 5000 bars of OHLCV data
- 🔴 **Live Data Streaming**: Real-time data feed with callback architecture
- 🔐 **Smart Authentication**: Token caching with automatic validation
- 🤖 **CAPTCHA Handling**: Browser-based authentication fallback
- 📈 **Multiple Timeframes**: Support for 16 different intervals (1m to 12M)
- 🌍 **Multi-Exchange**: Works with stocks, crypto, forex, futures, and more
- 🎯 **Easy to Use**: Simple and intuitive API

## 🚀 Quick Start

See [QUICKSTART.md](QUICKSTART.md) for a 2-minute getting started guide!

## Installation

### From PyPI (recommended)

```bash
pip install tvdatafeed-enhanced
```

### From GitHub

```bash
pip install --upgrade --no-cache-dir git+https://github.com/rongardF/tvdatafeed.git
```

### Optional: For automatic CAPTCHA handling

```bash
pip install tvdatafeed-enhanced[captcha]
```

## 📝 What's New in v2.2.0

- ⚡ **Async Operations**: Concurrent data fetching for multiple symbols (10-50x faster!)
- ✅ **Token Caching**: Automatic token persistence and validation
- ✅ **JWT Validation**: Smart expiration checking without API calls
- ✅ **CAPTCHA Support**: Browser-based fallback for manual authentication
- ✅ **New Intervals**: Added 3M, 6M, and 12M timeframes
- ✅ **Helper Script**: Interactive `token_helper.py` for easy setup
- ✅ **Better Error Handling**: Improved connection reliability
- ✅ **Python 3.10+**: Modern Python with type hints and pattern matching

See [TOKEN_SETUP_GUIDE.md](TOKEN_SETUP_GUIDE.md) for detailed authentication setup.

---

## 📺 Video Tutorials

v1.2 tutorial with installation and backtrader usage:

[![Watch the video](https://img.youtube.com/vi/f76dOZW2gwI/hqdefault.jpg)](https://youtu.be/f76dOZW2gwI)

Full tutorial:

[![Watch the video](https://img.youtube.com/vi/qDrXmb2ZRjo/hqdefault.jpg)](https://youtu.be/qDrXmb2ZRjo)

## Usage

Import the packages and initialize with your tradingview username and password.

```python
from tvDatafeed import TvDatafeed, Interval

username = 'YourTradingViewUsername'
password = 'YourTradingViewPassword'

tv = TvDatafeed(username, password)
```

You may use without logging in, but in some cases tradingview may limit the symbols and some symbols might not be available.

To use it without logging in

```python
tv = TvDatafeed()
```

when using without login, following warning will be shown `you are using nologin method, data you access may be limited`

---

## Getting Data

To download the data use `tv.get_hist` method.

It accepts following arguments and returns pandas dataframe

```python
(symbol: str, exchange: str = 'NSE', interval: Interval = Interval.in_daily, n_bars: int = 10, fut_contract: int | None = None, extended_session: bool = False) -> DataFrame)
```

for example-

```python
# index
nifty_index_data = tv.get_hist(symbol='NIFTY',exchange='NSE',interval=Interval.in_1_hour,n_bars=1000)

# futures continuous contract
nifty_futures_data = tv.get_hist(symbol='NIFTY',exchange='NSE',interval=Interval.in_1_hour,n_bars=1000,fut_contract=1)

# crudeoil
crudeoil_data = tv.get_hist(symbol='CRUDEOIL',exchange='MCX',interval=Interval.in_1_hour,n_bars=5000,fut_contract=1)

# downloading data for extended market hours
extended_price_data = tv.get_hist(symbol="EICHERMOT",exchange="NSE",interval=Interval.in_1_hour,n_bars=500, extended_session=False)
```

---

## ⚡ Getting Data for Multiple Symbols (Async)

**NEW in v2.2.0**: Fetch data for multiple symbols concurrently with dramatically improved performance!

### Performance Comparison

| Symbols | Sequential (old) | Concurrent (new) | Speedup |
|---------|-----------------|------------------|---------|
| 5 symbols | ~5-10 sec | ~1-2 sec | **5-10x faster** |
| 10 symbols | ~10-20 sec | ~1-2 sec | **10-20x faster** |
| 50 symbols | ~50-100 sec | ~2-5 sec | **25-50x faster** |

### Usage

Use `get_hist_multi()` method to fetch multiple symbols concurrently:

```python
from tvDatafeed import TvDatafeed, Interval

tv = TvDatafeed()

# Fetch multiple symbols concurrently (FAST!)
symbols = ['AAPL', 'GOOGL', 'MSFT', 'TSLA', 'AMZN']
data = tv.get_hist_multi(
    symbols,
    exchange='NASDAQ',
    interval=Interval.in_1_hour,
    n_bars=100
)

# Returns a dictionary: {'AAPL': DataFrame, 'GOOGL': DataFrame, ...}
for symbol, df in data.items():
    print(f"{symbol}: {len(df)} bars")
    print(df.head())
```

### Return Format Options

```python
# Return as DataFrames (default)
data = tv.get_hist_multi(symbols, 'NASDAQ', n_bars=100, dataFrame=True)
# Returns: {'AAPL': DataFrame, 'GOOGL': DataFrame, ...}

# Return as lists (for custom processing)
data = tv.get_hist_multi(symbols, 'NASDAQ', n_bars=100, dataFrame=False)
# Returns: {'AAPL': [[timestamp, o, h, l, c, v], ...], 'GOOGL': [...], ...}
```

### Single Symbol (also works)

```python
# get_hist_multi() works with single symbols too
data = tv.get_hist_multi('AAPL', 'NASDAQ', n_bars=100)
# Returns: DataFrame (not a dict)
```

### For Advanced Users: Direct Async API

```python
import asyncio
from tvDatafeed import TvDatafeed, Interval

tv = TvDatafeed()

# Use async/await directly
async def fetch_data():
    symbols = ['AAPL', 'GOOGL', 'MSFT', 'TSLA', 'AMZN']
    data = await tv.get_hist_async(symbols, 'NASDAQ', n_bars=100)
    return data

# Run the async function
data = asyncio.run(fetch_data())
```

**Note for Jupyter Notebooks**: If you're using Jupyter/IPython and encounter event loop issues, install and use `nest_asyncio`:

```python
import nest_asyncio
nest_asyncio.apply()

# Now you can use get_hist_multi() in notebooks
data = tv.get_hist_multi(symbols, 'NASDAQ', n_bars=100)
```

---

## Search Symbol

To find the exact symbols for an instrument you can use `tv.search_symbol` method.

You need to provide search text and optional exchange. This will return a list of macthing instruments and their symbol.

```python
tv.search_symbol('CRUDE','MCX')
```

---

## Calculating Indicators

Indicators data is not downloaded from tradingview. For that you can use [TA-Lib](https://github.com/mrjbq7/ta-lib). Check out this video for installation and usage instructions-

[![Watch the video](https://img.youtube.com/vi/0MeHXJm9HRk/hqdefault.jpg)](https://youtu.be/0MeHXJm9HRk)

---

## Live feed (TvDatafeedLive)

### Description

**TvDatafeedLive** is a sub-class of **TvDatafeed** to extend the functionality and provide live data feed feature. The live data feed feature means that the user can specify
symbol, exchange and interval set (also called as seis) for which they want the new data bar to be retrieved from TradingView whenever it is produced. The user can then
provide any number of callback functions for that seis which will be called with the newly retrieved data bar. Callback functions and retrieving data from TradingView is
implemented in threads so live data is as close to realtime as possible, but it **does not provide realtime** data samples!

### Usage

Import the packages and initialize with your tradingview username and password. As TvDatafeedLive is an extension of TvDatafeed class then all the rules about initialization
are the same.

```python
from tvDatafeed import TvDatafeedLive, Interval

username = 'YourTradingViewUsername'
password = 'YourTradingViewPassword'

tvl = TvDatafeedLive(username, password)
```

### Creating new seis

TvDatafeedLive works with **Seis** and **Consumer** objects. Seis is short for symbol-exchange-interval-set. It is a class to contain a unique combination of symbol, exchange
and interval values together with methods to make managing and using various symbols easier for the user.

User can create a new Seis by calling `tvl.new_seis` method.

```python

seis = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_1_hour)
seis2 = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_2_hour)

```

The interface for this method is similar to the `get_hist` method as it accepts the same three arguments - symbol, exchange and interval. Once the `seis` is created
it will automatically be added into live feed of `tvl`. This means that a thread will be created which will continously wait until new data bar is 
produced for this symbol in TradingView and will retrieve it. If no consumer instances are added to `seis` then nothing will be done with the retrieved data 
sample and it will be discarded.

All TvDatafeedLive method calls have an optional *timeout* parameter. TvDatafeedLive uses threading so method calls are blocking if the resources are in use. The user 
can specify maximum amount to wait before aborting the call and returning. This parameter defaults to -1 which means no timeout.

```python

seis = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_1_hour, timeout=10)
seis2 = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_2_hour, timeout=10)

```

### Removing seis

The user can remove the `seis` from `tvl` using the `tvl.del_seis(seis)` or `seis.del_seis` method. In the former case the method must have the 
`seis` to be deleted provided as an argument to reference a specific seis instance.

```python

tvl.del_seis(seis)
seis2.del_seis()

```

### Creating new consumer

The user can consume/use retrieved data by registering callback functions to `seis`. The `tvl.new_consumer` method accepts `seis` and a function as an argument
and returns a consumer object. The `seis.new_consumer` method simply needs the function as an argument. The function provided must follow the prototype function shown below:

```python

def consumer_func1(seis, data):
	print("Open price for "+seis.symbol+" on "+seis.exchange+" exchange with "+seis.interval.name+" interval was "+str(data.open[0]))

def consumer_func2(seis, data):
	print("Volume of "+seis.symbol+" on "+seis.exchange+" exchange with "+seis.interval.name+" interval was "+str(data.volume[0]))

def consumer_func3(seis, data):
	print("Close price for "+seis.symbol+" on "+seis.exchange+" exchange with "+seis.interval.name+" interval was "+str(data.close[0]))

consumer1=tvl.new_consumer(seis, consumer_func1)
consumer2=seis.new_consumer(consumer_func2)
consumer3=seis.new_consumer(consumer_func3)

```

When there is new data produced and retrieved from TradingView for this seis then the provided function will
be called with `seis` and pandas DataFrame as arguments. The user can add one or many callback functions to `seis` - each of them will create a new
`consumer`.

### Removing consumer

The user can remove a `consumer` from `seis` by using the `tvl.del_consumer`, `seis.del_consumer` or `consumer.del_consumer` methods.

```python

tvl.del_consumer(consumer1)
seis.del_consumer(consumer2)
consumer3.del_consumer()

```

### Getting Data

TvDatafeedLive supports retrieving historic data in addition to retrieving live data. The user can use the `tvl.get_hist` or `seis.get_hist` method. 
The former method has the same API as the TvDatafeed `get_hist` method, except it accepts one additional optional argument - `timeout`. This parameter 
defaults to -1 which means no timeout. The `seis.get_hist` method only accepts two arguments - `n_bars` and `timeout`. Both of these parameters are
optional and default to 10 bars and no timeout.

```python

data=tvl.get_hist(symbol, exchange, interval=tvDatafeed.Interval.in_daily, n_bars=10, fut_contract=None, extended_session=False, timeout=-1)
data=seis.get_hist(n_bars=10, timeout=-1)

```

---

## Supported Time Intervals

The following timeframe intervals are supported:

| Interval | Description |
|----------|-------------|
| `Interval.in_1_minute` | 1 minute |
| `Interval.in_3_minute` | 3 minutes |
| `Interval.in_5_minute` | 5 minutes |
| `Interval.in_15_minute` | 15 minutes |
| `Interval.in_30_minute` | 30 minutes |
| `Interval.in_45_minute` | 45 minutes |
| `Interval.in_1_hour` | 1 hour |
| `Interval.in_2_hour` | 2 hours |
| `Interval.in_3_hour` | 3 hours |
| `Interval.in_4_hour` | 4 hours |
| `Interval.in_daily` | Daily |
| `Interval.in_weekly` | Weekly |
| `Interval.in_monthly` | Monthly |
| `Interval.in_3_monthly` | 3 months (new in v2.2.0) |
| `Interval.in_6_monthly` | 6 months (new in v2.2.0) |
| `Interval.in_yearly` | 12 months / Yearly (new in v2.2.0) |

---

## Read this before creating an issue

Before creating an issue in this library, please follow the following steps.

1. Search the problem you are facing is already asked by someone else. There might be some issues already there, either solved/unsolved related to your problem. Go to [issues](https://github.com/StreamAlpha/tvdatafeed/issues) page, use `is:issue` as filter and search your problem. ![image](https://user-images.githubusercontent.com/59556194/128167319-2654cfa1-f718-4a52-82f8-b0c0d26bf4ef.png)
2. If you feel your problem is not asked by anyone or no issues are related to your problem, then create a new issue.
3. Describe your problem in detail while creating the issue. If you don't have time to detail/describe the problem you are facing, assume that I also won't be having time to respond to your problem.
4. Post a sample code of the problem you are facing. If I copy paste the code directly from issue, I should be able to reproduce the problem you are facing.
5. Before posting the sample code, test your sample code yourself once. Only sample code should be tested, no other addition should be there while you are testing.
6. Have some print() function calls to display the values of some variables related to your problem.
7. Post the results of print() functions also in the issue.
8. Use the insert code feature of github to inset code and print outputs, so that the code is displyed neat. !
9. If you have multiple lines of code, use tripple grave accent ( ``` ) to insert multiple lines of code.

   [Example:](https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks)

   ![1659809630082](image/README/1659809630082.png)

---

## 📚 Additional Documentation

- [QUICKSTART.md](QUICKSTART.md) - Get started in 2 minutes
- [TOKEN_SETUP_GUIDE.md](TOKEN_SETUP_GUIDE.md) - Detailed authentication setup
- [token_helper.py](token_helper.py) - Interactive token management script

---

## 🙏 Credits

This project is a fork of the original [TvDatafeed](https://github.com/rongardF/tvdatafeed.git) by **StreamAlpha**.

**Key Contributors:**
- **StreamAlpha** - Original creator
- **rongardF** - Live data streaming feature
- **stefanomorni** - Selenium dependency removal (v2.0.0)

If you find this project useful, consider supporting the original creator:

[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/StreamAlpha)

---

## 📄 License

MIT License - see [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tvdatafeed-enhanced",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "tradingview, trading, data, market-data, finance, stocks, crypto, forex, live-data, real-time",
    "author": "StreamAlpha, rongardF",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/99/2c/551d1cb1f0200274aa2204ff5de6436b32e4dbe5fd8dadb1f657bf41c6b7/tvdatafeed_enhanced-2.2.0.tar.gz",
    "platform": null,
    "description": "# TvDatafeed Enhanced\n\n[![PyPI version](https://badge.fury.io/py/tvdatafeed-enhanced.svg)](https://badge.fury.io/py/tvdatafeed-enhanced)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA powerful TradingView historical and live data downloader for Python. Download up to 5000 bars of historical data on any supported timeframe, with support for both basic historical data retrieval and advanced live streaming with callback architecture.\n\n## \u2728 Features\n\n- \ud83d\udcca **Historical Data**: Download up to 5000 bars of OHLCV data\n- \ud83d\udd34 **Live Data Streaming**: Real-time data feed with callback architecture\n- \ud83d\udd10 **Smart Authentication**: Token caching with automatic validation\n- \ud83e\udd16 **CAPTCHA Handling**: Browser-based authentication fallback\n- \ud83d\udcc8 **Multiple Timeframes**: Support for 16 different intervals (1m to 12M)\n- \ud83c\udf0d **Multi-Exchange**: Works with stocks, crypto, forex, futures, and more\n- \ud83c\udfaf **Easy to Use**: Simple and intuitive API\n\n## \ud83d\ude80 Quick Start\n\nSee [QUICKSTART.md](QUICKSTART.md) for a 2-minute getting started guide!\n\n## Installation\n\n### From PyPI (recommended)\n\n```bash\npip install tvdatafeed-enhanced\n```\n\n### From GitHub\n\n```bash\npip install --upgrade --no-cache-dir git+https://github.com/rongardF/tvdatafeed.git\n```\n\n### Optional: For automatic CAPTCHA handling\n\n```bash\npip install tvdatafeed-enhanced[captcha]\n```\n\n## \ud83d\udcdd What's New in v2.2.0\n\n- \u26a1 **Async Operations**: Concurrent data fetching for multiple symbols (10-50x faster!)\n- \u2705 **Token Caching**: Automatic token persistence and validation\n- \u2705 **JWT Validation**: Smart expiration checking without API calls\n- \u2705 **CAPTCHA Support**: Browser-based fallback for manual authentication\n- \u2705 **New Intervals**: Added 3M, 6M, and 12M timeframes\n- \u2705 **Helper Script**: Interactive `token_helper.py` for easy setup\n- \u2705 **Better Error Handling**: Improved connection reliability\n- \u2705 **Python 3.10+**: Modern Python with type hints and pattern matching\n\nSee [TOKEN_SETUP_GUIDE.md](TOKEN_SETUP_GUIDE.md) for detailed authentication setup.\n\n---\n\n## \ud83d\udcfa Video Tutorials\n\nv1.2 tutorial with installation and backtrader usage:\n\n[![Watch the video](https://img.youtube.com/vi/f76dOZW2gwI/hqdefault.jpg)](https://youtu.be/f76dOZW2gwI)\n\nFull tutorial:\n\n[![Watch the video](https://img.youtube.com/vi/qDrXmb2ZRjo/hqdefault.jpg)](https://youtu.be/qDrXmb2ZRjo)\n\n## Usage\n\nImport the packages and initialize with your tradingview username and password.\n\n```python\nfrom tvDatafeed import TvDatafeed, Interval\n\nusername = 'YourTradingViewUsername'\npassword = 'YourTradingViewPassword'\n\ntv = TvDatafeed(username, password)\n```\n\nYou may use without logging in, but in some cases tradingview may limit the symbols and some symbols might not be available.\n\nTo use it without logging in\n\n```python\ntv = TvDatafeed()\n```\n\nwhen using without login, following warning will be shown `you are using nologin method, data you access may be limited`\n\n---\n\n## Getting Data\n\nTo download the data use `tv.get_hist` method.\n\nIt accepts following arguments and returns pandas dataframe\n\n```python\n(symbol: str, exchange: str = 'NSE', interval: Interval = Interval.in_daily, n_bars: int = 10, fut_contract: int | None = None, extended_session: bool = False) -> DataFrame)\n```\n\nfor example-\n\n```python\n# index\nnifty_index_data = tv.get_hist(symbol='NIFTY',exchange='NSE',interval=Interval.in_1_hour,n_bars=1000)\n\n# futures continuous contract\nnifty_futures_data = tv.get_hist(symbol='NIFTY',exchange='NSE',interval=Interval.in_1_hour,n_bars=1000,fut_contract=1)\n\n# crudeoil\ncrudeoil_data = tv.get_hist(symbol='CRUDEOIL',exchange='MCX',interval=Interval.in_1_hour,n_bars=5000,fut_contract=1)\n\n# downloading data for extended market hours\nextended_price_data = tv.get_hist(symbol=\"EICHERMOT\",exchange=\"NSE\",interval=Interval.in_1_hour,n_bars=500, extended_session=False)\n```\n\n---\n\n## \u26a1 Getting Data for Multiple Symbols (Async)\n\n**NEW in v2.2.0**: Fetch data for multiple symbols concurrently with dramatically improved performance!\n\n### Performance Comparison\n\n| Symbols | Sequential (old) | Concurrent (new) | Speedup |\n|---------|-----------------|------------------|---------|\n| 5 symbols | ~5-10 sec | ~1-2 sec | **5-10x faster** |\n| 10 symbols | ~10-20 sec | ~1-2 sec | **10-20x faster** |\n| 50 symbols | ~50-100 sec | ~2-5 sec | **25-50x faster** |\n\n### Usage\n\nUse `get_hist_multi()` method to fetch multiple symbols concurrently:\n\n```python\nfrom tvDatafeed import TvDatafeed, Interval\n\ntv = TvDatafeed()\n\n# Fetch multiple symbols concurrently (FAST!)\nsymbols = ['AAPL', 'GOOGL', 'MSFT', 'TSLA', 'AMZN']\ndata = tv.get_hist_multi(\n    symbols,\n    exchange='NASDAQ',\n    interval=Interval.in_1_hour,\n    n_bars=100\n)\n\n# Returns a dictionary: {'AAPL': DataFrame, 'GOOGL': DataFrame, ...}\nfor symbol, df in data.items():\n    print(f\"{symbol}: {len(df)} bars\")\n    print(df.head())\n```\n\n### Return Format Options\n\n```python\n# Return as DataFrames (default)\ndata = tv.get_hist_multi(symbols, 'NASDAQ', n_bars=100, dataFrame=True)\n# Returns: {'AAPL': DataFrame, 'GOOGL': DataFrame, ...}\n\n# Return as lists (for custom processing)\ndata = tv.get_hist_multi(symbols, 'NASDAQ', n_bars=100, dataFrame=False)\n# Returns: {'AAPL': [[timestamp, o, h, l, c, v], ...], 'GOOGL': [...], ...}\n```\n\n### Single Symbol (also works)\n\n```python\n# get_hist_multi() works with single symbols too\ndata = tv.get_hist_multi('AAPL', 'NASDAQ', n_bars=100)\n# Returns: DataFrame (not a dict)\n```\n\n### For Advanced Users: Direct Async API\n\n```python\nimport asyncio\nfrom tvDatafeed import TvDatafeed, Interval\n\ntv = TvDatafeed()\n\n# Use async/await directly\nasync def fetch_data():\n    symbols = ['AAPL', 'GOOGL', 'MSFT', 'TSLA', 'AMZN']\n    data = await tv.get_hist_async(symbols, 'NASDAQ', n_bars=100)\n    return data\n\n# Run the async function\ndata = asyncio.run(fetch_data())\n```\n\n**Note for Jupyter Notebooks**: If you're using Jupyter/IPython and encounter event loop issues, install and use `nest_asyncio`:\n\n```python\nimport nest_asyncio\nnest_asyncio.apply()\n\n# Now you can use get_hist_multi() in notebooks\ndata = tv.get_hist_multi(symbols, 'NASDAQ', n_bars=100)\n```\n\n---\n\n## Search Symbol\n\nTo find the exact symbols for an instrument you can use `tv.search_symbol` method.\n\nYou need to provide search text and optional exchange. This will return a list of macthing instruments and their symbol.\n\n```python\ntv.search_symbol('CRUDE','MCX')\n```\n\n---\n\n## Calculating Indicators\n\nIndicators data is not downloaded from tradingview. For that you can use [TA-Lib](https://github.com/mrjbq7/ta-lib). Check out this video for installation and usage instructions-\n\n[![Watch the video](https://img.youtube.com/vi/0MeHXJm9HRk/hqdefault.jpg)](https://youtu.be/0MeHXJm9HRk)\n\n---\n\n## Live feed (TvDatafeedLive)\n\n### Description\n\n**TvDatafeedLive** is a sub-class of **TvDatafeed** to extend the functionality and provide live data feed feature. The live data feed feature means that the user can specify\nsymbol, exchange and interval set (also called as seis) for which they want the new data bar to be retrieved from TradingView whenever it is produced. The user can then\nprovide any number of callback functions for that seis which will be called with the newly retrieved data bar. Callback functions and retrieving data from TradingView is\nimplemented in threads so live data is as close to realtime as possible, but it **does not provide realtime** data samples!\n\n### Usage\n\nImport the packages and initialize with your tradingview username and password. As TvDatafeedLive is an extension of TvDatafeed class then all the rules about initialization\nare the same.\n\n```python\nfrom tvDatafeed import TvDatafeedLive, Interval\n\nusername = 'YourTradingViewUsername'\npassword = 'YourTradingViewPassword'\n\ntvl = TvDatafeedLive(username, password)\n```\n\n### Creating new seis\n\nTvDatafeedLive works with **Seis** and **Consumer** objects. Seis is short for symbol-exchange-interval-set. It is a class to contain a unique combination of symbol, exchange\nand interval values together with methods to make managing and using various symbols easier for the user.\n\nUser can create a new Seis by calling `tvl.new_seis` method.\n\n```python\n\nseis = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_1_hour)\nseis2 = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_2_hour)\n\n```\n\nThe interface for this method is similar to the `get_hist` method as it accepts the same three arguments - symbol, exchange and interval. Once the `seis` is created\nit will automatically be added into live feed of `tvl`. This means that a thread will be created which will continously wait until new data bar is \nproduced for this symbol in TradingView and will retrieve it. If no consumer instances are added to `seis` then nothing will be done with the retrieved data \nsample and it will be discarded.\n\nAll TvDatafeedLive method calls have an optional *timeout* parameter. TvDatafeedLive uses threading so method calls are blocking if the resources are in use. The user \ncan specify maximum amount to wait before aborting the call and returning. This parameter defaults to -1 which means no timeout.\n\n```python\n\nseis = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_1_hour, timeout=10)\nseis2 = tvl.new_seis('ETHUSDT', 'BINANCE', Interval.in_2_hour, timeout=10)\n\n```\n\n### Removing seis\n\nThe user can remove the `seis` from `tvl` using the `tvl.del_seis(seis)` or `seis.del_seis` method. In the former case the method must have the \n`seis` to be deleted provided as an argument to reference a specific seis instance.\n\n```python\n\ntvl.del_seis(seis)\nseis2.del_seis()\n\n```\n\n### Creating new consumer\n\nThe user can consume/use retrieved data by registering callback functions to `seis`. The `tvl.new_consumer` method accepts `seis` and a function as an argument\nand returns a consumer object. The `seis.new_consumer` method simply needs the function as an argument. The function provided must follow the prototype function shown below:\n\n```python\n\ndef consumer_func1(seis, data):\n\tprint(\"Open price for \"+seis.symbol+\" on \"+seis.exchange+\" exchange with \"+seis.interval.name+\" interval was \"+str(data.open[0]))\n\ndef consumer_func2(seis, data):\n\tprint(\"Volume of \"+seis.symbol+\" on \"+seis.exchange+\" exchange with \"+seis.interval.name+\" interval was \"+str(data.volume[0]))\n\ndef consumer_func3(seis, data):\n\tprint(\"Close price for \"+seis.symbol+\" on \"+seis.exchange+\" exchange with \"+seis.interval.name+\" interval was \"+str(data.close[0]))\n\nconsumer1=tvl.new_consumer(seis, consumer_func1)\nconsumer2=seis.new_consumer(consumer_func2)\nconsumer3=seis.new_consumer(consumer_func3)\n\n```\n\nWhen there is new data produced and retrieved from TradingView for this seis then the provided function will\nbe called with `seis` and pandas DataFrame as arguments. The user can add one or many callback functions to `seis` - each of them will create a new\n`consumer`.\n\n### Removing consumer\n\nThe user can remove a `consumer` from `seis` by using the `tvl.del_consumer`, `seis.del_consumer` or `consumer.del_consumer` methods.\n\n```python\n\ntvl.del_consumer(consumer1)\nseis.del_consumer(consumer2)\nconsumer3.del_consumer()\n\n```\n\n### Getting Data\n\nTvDatafeedLive supports retrieving historic data in addition to retrieving live data. The user can use the `tvl.get_hist` or `seis.get_hist` method. \nThe former method has the same API as the TvDatafeed `get_hist` method, except it accepts one additional optional argument - `timeout`. This parameter \ndefaults to -1 which means no timeout. The `seis.get_hist` method only accepts two arguments - `n_bars` and `timeout`. Both of these parameters are\noptional and default to 10 bars and no timeout.\n\n```python\n\ndata=tvl.get_hist(symbol, exchange, interval=tvDatafeed.Interval.in_daily, n_bars=10, fut_contract=None, extended_session=False, timeout=-1)\ndata=seis.get_hist(n_bars=10, timeout=-1)\n\n```\n\n---\n\n## Supported Time Intervals\n\nThe following timeframe intervals are supported:\n\n| Interval | Description |\n|----------|-------------|\n| `Interval.in_1_minute` | 1 minute |\n| `Interval.in_3_minute` | 3 minutes |\n| `Interval.in_5_minute` | 5 minutes |\n| `Interval.in_15_minute` | 15 minutes |\n| `Interval.in_30_minute` | 30 minutes |\n| `Interval.in_45_minute` | 45 minutes |\n| `Interval.in_1_hour` | 1 hour |\n| `Interval.in_2_hour` | 2 hours |\n| `Interval.in_3_hour` | 3 hours |\n| `Interval.in_4_hour` | 4 hours |\n| `Interval.in_daily` | Daily |\n| `Interval.in_weekly` | Weekly |\n| `Interval.in_monthly` | Monthly |\n| `Interval.in_3_monthly` | 3 months (new in v2.2.0) |\n| `Interval.in_6_monthly` | 6 months (new in v2.2.0) |\n| `Interval.in_yearly` | 12 months / Yearly (new in v2.2.0) |\n\n---\n\n## Read this before creating an issue\n\nBefore creating an issue in this library, please follow the following steps.\n\n1. Search the problem you are facing is already asked by someone else. There might be some issues already there, either solved/unsolved related to your problem. Go to [issues](https://github.com/StreamAlpha/tvdatafeed/issues) page, use `is:issue` as filter and search your problem. ![image](https://user-images.githubusercontent.com/59556194/128167319-2654cfa1-f718-4a52-82f8-b0c0d26bf4ef.png)\n2. If you feel your problem is not asked by anyone or no issues are related to your problem, then create a new issue.\n3. Describe your problem in detail while creating the issue. If you don't have time to detail/describe the problem you are facing, assume that I also won't be having time to respond to your problem.\n4. Post a sample code of the problem you are facing. If I copy paste the code directly from issue, I should be able to reproduce the problem you are facing.\n5. Before posting the sample code, test your sample code yourself once. Only sample code should be tested, no other addition should be there while you are testing.\n6. Have some print() function calls to display the values of some variables related to your problem.\n7. Post the results of print() functions also in the issue.\n8. Use the insert code feature of github to inset code and print outputs, so that the code is displyed neat. !\n9. If you have multiple lines of code, use tripple grave accent ( ``` ) to insert multiple lines of code.\n\n   [Example:](https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks)\n\n   ![1659809630082](image/README/1659809630082.png)\n\n---\n\n## \ud83d\udcda Additional Documentation\n\n- [QUICKSTART.md](QUICKSTART.md) - Get started in 2 minutes\n- [TOKEN_SETUP_GUIDE.md](TOKEN_SETUP_GUIDE.md) - Detailed authentication setup\n- [token_helper.py](token_helper.py) - Interactive token management script\n\n---\n\n## \ud83d\ude4f Credits\n\nThis project is a fork of the original [TvDatafeed](https://github.com/rongardF/tvdatafeed.git) by **StreamAlpha**.\n\n**Key Contributors:**\n- **StreamAlpha** - Original creator\n- **rongardF** - Live data streaming feature\n- **stefanomorni** - Selenium dependency removal (v2.0.0)\n\nIf you find this project useful, consider supporting the original creator:\n\n[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/StreamAlpha)\n\n---\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "TradingView historical and live data downloader with advanced features",
    "version": "2.2.0",
    "project_urls": {
        "Documentation": "https://github.com/rongardF/tvdatafeed/blob/main/README.md",
        "Homepage": "https://github.com/rongardF/tvdatafeed/",
        "Source": "https://github.com/rongardF/tvdatafeed/",
        "Tracker": "https://github.com/rongardF/tvdatafeed/issues"
    },
    "split_keywords": [
        "tradingview",
        " trading",
        " data",
        " market-data",
        " finance",
        " stocks",
        " crypto",
        " forex",
        " live-data",
        " real-time"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f5752e5b2b1db1213389dabce42be6f61577ef790265962e2d302ccaf92f8071",
                "md5": "0967857f53cf81162207a2e97300df41",
                "sha256": "68cc4caa8b61be03f8f9236aff8367542761244b31b3250a3a0839c3c7806f8c"
            },
            "downloads": -1,
            "filename": "tvdatafeed_enhanced-2.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0967857f53cf81162207a2e97300df41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 25954,
            "upload_time": "2025-10-17T13:39:44",
            "upload_time_iso_8601": "2025-10-17T13:39:44.416918Z",
            "url": "https://files.pythonhosted.org/packages/f5/75/2e5b2b1db1213389dabce42be6f61577ef790265962e2d302ccaf92f8071/tvdatafeed_enhanced-2.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "992c551d1cb1f0200274aa2204ff5de6436b32e4dbe5fd8dadb1f657bf41c6b7",
                "md5": "5baedcc72ba26db5cbd82c88f1e5bbf6",
                "sha256": "f3b23b278e55e6a103f856cb23198a7308bb769d46fc1b53703995b1e5058342"
            },
            "downloads": -1,
            "filename": "tvdatafeed_enhanced-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5baedcc72ba26db5cbd82c88f1e5bbf6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 49944,
            "upload_time": "2025-10-17T13:39:45",
            "upload_time_iso_8601": "2025-10-17T13:39:45.924182Z",
            "url": "https://files.pythonhosted.org/packages/99/2c/551d1cb1f0200274aa2204ff5de6436b32e4dbe5fd8dadb1f657bf41c6b7/tvdatafeed_enhanced-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-17 13:39:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rongardF",
    "github_project": "tvdatafeed",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "setuptools",
            "specs": [
                [
                    "~=",
                    "49.2.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "~=",
                    "1.0.5"
                ]
            ]
        },
        {
            "name": "websocket-client",
            "specs": [
                [
                    "~=",
                    "0.57.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": []
        }
    ],
    "lcname": "tvdatafeed-enhanced"
}
        
Elapsed time: 1.85389s