Skip to main content

Information

This package to fetch data from tradingview websocket

Installation

Create an isolated Python virtual environment

pip3 install virtualenv virtualenv ./virtualenv --python=$(which python3)

Activate the virtualenv

IMPORTANT: it needs to be activated every time before you run

. virtualenv/bin/activate

Install Python requirements

pip install -r requirements.txt

Install

pip install -e .

run test

python -m test

Using:

  • define a callback function get receive result
def callbackFunc(s):
    print(s)
  • call websocket to get quote price or ohlcv to write a trading bot, data will be delayed 10m if don't use account premium
pair = "ES"

market = "futures" # 'stock' | 'futures' | 'forex' | 'cfd' | 'crypto' | 'index' | 'economic'
username = None
password = None
trading = td.TradingViewWs(pair, market, username, password)
# get quote price
trading.realtime_quote(callbackFunc)

# get ohlcv
interval = 5
total_candle = 240 # total candle to calculate indicator ex: EMA, WMA
trading.realtime_bar_chart(interval, total_candle, callbackFunc)

Alt text

Metadata

Release files for tradingview-ws 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tradingview-ws 0.0.3
File Size Uploaded
tradingview_ws-0.0.3.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tradingview-ws 0.0.3
File Interpreter ABI Platform
tradingview_ws-0.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.3 kB

Release files / tradingview_ws-0.0.3.tar.gz

Download URL tradingview_ws-0.0.3.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
73ec95a628b00f498382aee8a170995e00ba1f73d290ecf899f253a35d53bf37
BLAKE2b-256 checksum
How to use checksums
baaa700776df88270e6ac3c7d0ffcd67ca2e61ab5b0da91ec62b5d6392d3f6fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.0

Release files / tradingview_ws-0.0.3-py2.py3-none-any.whl

Download URL tradingview_ws-0.0.3-py2.py3-none-any.whl
Size 6.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ff3ca3ff5ad6952a80afc804014d2d198556c54639a8e34b2e3ea5edc2ed70f9
BLAKE2b-256 checksum
How to use checksums
809278ae0c32f0f2c9844e481f0599bf83230a9a4c5c8dcdb8f5bbb4975cc29d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page