A Python client for TradingView WebSocket API. It's a lightweight library capable of providing real-time data on stocks, cryptocurrencies, indices etc.
Project description
pytradingview
A simple, open-source Python client for connecting to TradingView's WebSocket API.
Features
- WebSocket connection management
- Simple send/receive interface
- Easy to extend for custom signals and data
Dependencies
websocket-client
Installation
pip install
Usage
# example.py
from pytradingview import TVclient
# Create the client and chart
client = TVclient()
chart = client.Chart
# Set up the chart
chart.set_up_chart()
# Set the market
chart.set_market("BINANCE:BTCUSD", {
"timeframe": "1", # 1-minute chart
"currency": "USD",
})
# Event: When the symbol data is loaded
chart.on_symbol_loaded(lambda _: print("✅ Market loaded:", chart.get_infos['description']))
# Event: When price data is updated
def handle_update(_):
if chart.get_periods:
print(f"🟢 New Price: {chart.get_periods['close']}")
chart.on_update(handle_update)
# Start the WebSocket connection
client.create_connection()
Contributing
Contributions are welcome! Please open issues or PRs to collaborate.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytradingview-0.1.0.tar.gz.
File metadata
- Download URL: pytradingview-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fbaed61ade62cefe1a29ac8847ce6dea233689655c12ec5c6e5ae4913921c74
|
|
| MD5 |
2380bfaf493fecf9af6e553d2b49c6c4
|
|
| BLAKE2b-256 |
9217511648ab31a85c07923920b0f88df7091509aff88c103db14a0af444c5e5
|
File details
Details for the file pytradingview-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytradingview-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1aff88e4f97087ff0c2431dc5fdce8ba0cf045eb07140c4c6ff41f2b926d0f00
|
|
| MD5 |
f5a2b2acbeebde58240d1ea49741d6fb
|
|
| BLAKE2b-256 |
fee8306d969dc3d066c5faecf0412576f25bbd5a8d8cab0ab73004ad60aaff8a
|