tvfinance 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tvfinance-1.0.0/.github/workflows/ci.yml +38 -0
- tvfinance-1.0.0/.github/workflows/docs.yml +35 -0
- tvfinance-1.0.0/.github/workflows/publish.yml +38 -0
- tvfinance-1.0.0/.gitignore +19 -0
- tvfinance-1.0.0/.python-version +1 -0
- tvfinance-1.0.0/CHANGELOG.md +17 -0
- tvfinance-1.0.0/CODE_OF_CONDUCT.md +74 -0
- tvfinance-1.0.0/CONTRIBUTING.md +89 -0
- tvfinance-1.0.0/DISCLAIMER.md +31 -0
- tvfinance-1.0.0/LICENSE +21 -0
- tvfinance-1.0.0/PKG-INFO +110 -0
- tvfinance-1.0.0/README.md +100 -0
- tvfinance-1.0.0/docs/api/calendar.md +55 -0
- tvfinance-1.0.0/docs/api/market_data.md +45 -0
- tvfinance-1.0.0/docs/api/news.md +25 -0
- tvfinance-1.0.0/docs/api/options.md +25 -0
- tvfinance-1.0.0/docs/api/scrapers.md +75 -0
- tvfinance-1.0.0/docs/api/screener.md +27 -0
- tvfinance-1.0.0/docs/api/ticker.md +23 -0
- tvfinance-1.0.0/docs/index.md +64 -0
- tvfinance-1.0.0/main.py +5 -0
- tvfinance-1.0.0/mkdocs.yml +60 -0
- tvfinance-1.0.0/pyproject.toml +31 -0
- tvfinance-1.0.0/src/tvfinance/__init__.py +77 -0
- tvfinance-1.0.0/src/tvfinance/aio/__init__.py +77 -0
- tvfinance-1.0.0/src/tvfinance/api/__init__.py +1 -0
- tvfinance-1.0.0/src/tvfinance/api/calendar.py +731 -0
- tvfinance-1.0.0/src/tvfinance/api/history.py +47 -0
- tvfinance-1.0.0/src/tvfinance/api/html_extractors.py +1505 -0
- tvfinance-1.0.0/src/tvfinance/api/news.py +41 -0
- tvfinance-1.0.0/src/tvfinance/api/options.py +329 -0
- tvfinance-1.0.0/src/tvfinance/api/quote.py +67 -0
- tvfinance-1.0.0/src/tvfinance/api/screener.py +253 -0
- tvfinance-1.0.0/src/tvfinance/api/search.py +96 -0
- tvfinance-1.0.0/src/tvfinance/cli.py +349 -0
- tvfinance-1.0.0/src/tvfinance/client/__init__.py +1 -0
- tvfinance-1.0.0/src/tvfinance/client/chart_session.py +221 -0
- tvfinance-1.0.0/src/tvfinance/client/news_session.py +238 -0
- tvfinance-1.0.0/src/tvfinance/client/quote_session.py +165 -0
- tvfinance-1.0.0/src/tvfinance/core/__init__.py +1 -0
- tvfinance-1.0.0/src/tvfinance/core/exceptions.py +10 -0
- tvfinance-1.0.0/src/tvfinance/core/models.py +113 -0
- tvfinance-1.0.0/src/tvfinance/core/news_parser.py +84 -0
- tvfinance-1.0.0/src/tvfinance/core/protocol.py +52 -0
- tvfinance-1.0.0/src/tvfinance/core/range_bars.py +50 -0
- tvfinance-1.0.0/src/tvfinance/core/series.py +47 -0
- tvfinance-1.0.0/src/tvfinance/core/session.py +49 -0
- tvfinance-1.0.0/src/tvfinance/core/timeframe.py +53 -0
- tvfinance-1.0.0/src/tvfinance/ticker.py +1099 -0
- tvfinance-1.0.0/tests/conftest.py +10 -0
- tvfinance-1.0.0/tests/test_calendar.py +150 -0
- tvfinance-1.0.0/tests/test_history.py +26 -0
- tvfinance-1.0.0/tests/test_html_extractors.py +230 -0
- tvfinance-1.0.0/tests/test_quote.py +25 -0
- tvfinance-1.0.0/tests/test_search.py +32 -0
- tvfinance-1.0.0/tests/test_tickers.py +247 -0
- tvfinance-1.0.0/uv.lock +1112 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.10"
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v5
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: uv sync --all-groups
|
|
30
|
+
|
|
31
|
+
- name: Run Ruff Lint
|
|
32
|
+
run: uv run ruff check .
|
|
33
|
+
|
|
34
|
+
- name: Run Ruff Format Check
|
|
35
|
+
run: uv run ruff format --check .
|
|
36
|
+
|
|
37
|
+
- name: Run tests
|
|
38
|
+
run: uv run pytest
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
deploy:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.10"
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v5
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: uv sync --all-groups
|
|
30
|
+
|
|
31
|
+
- name: Build and Deploy documentation
|
|
32
|
+
run: |
|
|
33
|
+
git config --global user.name "github-actions[bot]"
|
|
34
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
35
|
+
uv run mkdocs gh-deploy --force
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
name: Build and publish Python distribution to PyPI
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
# This permission is required for Trusted Publishing / OIDC
|
|
14
|
+
id-token: write
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.10"
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v5
|
|
28
|
+
with:
|
|
29
|
+
enable-cache: true
|
|
30
|
+
|
|
31
|
+
- name: Build package distribution
|
|
32
|
+
run: uv build
|
|
33
|
+
|
|
34
|
+
- name: Publish package distribution to PyPI
|
|
35
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
36
|
+
with:
|
|
37
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
38
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [1.0.0] - 2026-06-20
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Initial Release of tvfinance**: A unified lightweight library for querying TradingView financial and general market data.
|
|
14
|
+
- **Dual Namespace Structure**: Supports both synchronous (`tvfinance`) and asynchronous (`tvfinance.aio`) APIs.
|
|
15
|
+
- **Object-Oriented Wrappers**: Features sync `Ticker`/`Tickers` and async `Ticker`/`Tickers` (under `tvfinance.aio`) wrapper classes.
|
|
16
|
+
- **Connection Reuse Context**: Includes `Session` and `AsyncSession` context managers using `contextvars` for pooling.
|
|
17
|
+
- **Comprehensive Scrapers**: Support for Quotes, History, Options, News, Calendars, Forecasts, and Technical Indicators.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Community Pledge
|
|
4
|
+
|
|
5
|
+
All participants, contributors, and maintainers pledge to make participation in this
|
|
6
|
+
project a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
All participants pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Community Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for the
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best for the overall community, not just the individual
|
|
26
|
+
|
|
27
|
+
Examples of unacceptable behavior include:
|
|
28
|
+
|
|
29
|
+
* The use of sexualized language or imagery, and unwelcome sexual attention or
|
|
30
|
+
advances
|
|
31
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
32
|
+
* Public or private harassment
|
|
33
|
+
* Publishing others' private information, such as a physical or email
|
|
34
|
+
address, without their explicit permission
|
|
35
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
36
|
+
professional setting
|
|
37
|
+
|
|
38
|
+
## Enforcement Responsibilities
|
|
39
|
+
|
|
40
|
+
Repository maintainers are responsible for clarifying and enforcing the standards of
|
|
41
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
42
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
43
|
+
or harmful.
|
|
44
|
+
|
|
45
|
+
Repository maintainers have the right and responsibility to remove, edit, or reject
|
|
46
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
47
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
48
|
+
decisions when appropriate.
|
|
49
|
+
|
|
50
|
+
## Scope
|
|
51
|
+
|
|
52
|
+
This Code of Conduct applies within all project spaces, and also applies when
|
|
53
|
+
an individual is officially representing the project in public spaces.
|
|
54
|
+
Examples of representing the project include using an official e-mail
|
|
55
|
+
address, posting via an official social media account, or acting as an appointed
|
|
56
|
+
representative at an online or offline event.
|
|
57
|
+
|
|
58
|
+
## Enforcement
|
|
59
|
+
|
|
60
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
61
|
+
reported to the repository maintainers via GitHub Issues. All complaints
|
|
62
|
+
will be reviewed and investigated promptly and fairly.
|
|
63
|
+
|
|
64
|
+
All repository maintainers are obligated to respect the privacy and security of the
|
|
65
|
+
reporter of any incident.
|
|
66
|
+
|
|
67
|
+
## Attribution
|
|
68
|
+
|
|
69
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
70
|
+
version 2.1, available at
|
|
71
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][version].
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
[version]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Contributing to tvfinance
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to `tvfinance`! We welcome bug reports, feature suggestions, documentation enhancements, and pull requests.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Development Setup
|
|
8
|
+
|
|
9
|
+
We use `uv` for python dependency and virtual environment management.
|
|
10
|
+
|
|
11
|
+
1. **Clone the Repository**:
|
|
12
|
+
```bash
|
|
13
|
+
git clone https://github.com/adrianeth/tvfinance.git
|
|
14
|
+
cd tvfinance
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. **Install Development Dependencies**:
|
|
18
|
+
Install the package in editable mode with all dependency groups (`dev`, `lint`, `docs`):
|
|
19
|
+
```bash
|
|
20
|
+
uv sync --all-groups
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Code Quality, Linting & Formatting
|
|
26
|
+
|
|
27
|
+
To maintain a clean and consistent codebase, we enforce code quality checks using **Ruff**. All pull requests are checked for style conformity.
|
|
28
|
+
|
|
29
|
+
1. **Lint Checks**:
|
|
30
|
+
Analyze the codebase for bugs, syntax errors, and style violations:
|
|
31
|
+
```bash
|
|
32
|
+
uv run ruff check .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. **Auto-Formatting**:
|
|
36
|
+
Automatically format code imports and layout before committing changes:
|
|
37
|
+
```bash
|
|
38
|
+
uv run ruff format .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. **Auto-Fixing Lint Errors**:
|
|
42
|
+
Automatically fix safe lint violations:
|
|
43
|
+
```bash
|
|
44
|
+
uv run ruff check --fix .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Running Tests
|
|
50
|
+
|
|
51
|
+
We use `pytest` with `pytest-asyncio` for unit testing. Always ensure the entire test suite passes before submitting a pull request.
|
|
52
|
+
|
|
53
|
+
1. **Run All Tests**:
|
|
54
|
+
```bash
|
|
55
|
+
uv run pytest
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. **Run Specific Test File**:
|
|
59
|
+
```bash
|
|
60
|
+
uv run pytest tests/test_tickers.py
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Documentation
|
|
66
|
+
|
|
67
|
+
Documentation is built using `mkdocs` with `mkdocs-material` and `mkdocstrings`.
|
|
68
|
+
|
|
69
|
+
1. **Run Dev Server Locally**:
|
|
70
|
+
Start a local hot-reloading documentation server at `http://127.0.0.1:8000`:
|
|
71
|
+
```bash
|
|
72
|
+
uv run mkdocs serve
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
2. **Build Site**:
|
|
76
|
+
```bash
|
|
77
|
+
uv run mkdocs build
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Pull Request Checklist
|
|
83
|
+
|
|
84
|
+
Before submitting a Pull Request, please ensure:
|
|
85
|
+
1. All lint errors are resolved: `uv run ruff check .`
|
|
86
|
+
2. Code is formatted: `uv run ruff format .`
|
|
87
|
+
3. All tests pass successfully: `uv run pytest`
|
|
88
|
+
4. The documentation builds cleanly without warnings: `uv run mkdocs build`
|
|
89
|
+
5. You have updated `CHANGELOG.md` with a summary of your changes if applicable.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# LEGAL DISCLAIMER & TERMS OF USE
|
|
2
|
+
|
|
3
|
+
> [!CAUTION]
|
|
4
|
+
> **PLEASE READ THIS DISCLAIMER CAREFULLY BEFORE USING THIS SOFTWARE. BY USING OR ACCESSING THIS SOFTWARE, YOU AGREE TO BE BOUND BY ALL CLAUSES DESCRIBED HEREIN.**
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
### 1. Strictly for Educational & Research Purposes
|
|
9
|
+
This software (`tvfinance`) is an open-source research and educational utility designed for analyzing network protocols, data structures, and web interface engineering. It is **not** a commercial product, **not** a financial advisory service, and must **never** be used for any production, commercial, or institutional purposes.
|
|
10
|
+
|
|
11
|
+
### 2. No Affiliation with TradingView, Inc.
|
|
12
|
+
This software is an independent, community-driven project. It has **no** affiliation, sponsorship, authorization, endorsement, or validation from TradingView, Inc., or any of its data providers or partners. All product names, logos, brands, and trademarks (including "TradingView") are the property of their respective owners.
|
|
13
|
+
|
|
14
|
+
### 3. Absolute Waiver of Liability
|
|
15
|
+
To the maximum extent permitted by applicable law, the author(s), maintainer(s), and contributor(s) of this project:
|
|
16
|
+
- **DISCLAIM ALL WARRANTIES**, express or implied, including but not limited to the warranties of merchantability and fitness for a particular purpose.
|
|
17
|
+
- **ACCEPT ZERO LIABILITY** for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, IP bans, network blockages, service disruptions, account suspensions, financial losses, or trading losses) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
|
18
|
+
|
|
19
|
+
### 4. End-User Compliance & Responsibility
|
|
20
|
+
The execution of this software is controlled solely by the end-user. All network requests originate from the end-user's local computer/network and use the end-user's internet connection.
|
|
21
|
+
- The end-user assumes **sole and absolute responsibility** for ensuring that their use of this software complies with TradingView's Terms of Service, Privacy Policy, local laws, and regulations.
|
|
22
|
+
- The author **does not condone, encourage, or facilitate** automated scraping, commercial data exploitation, or any access patterns that violate the platform's terms.
|
|
23
|
+
|
|
24
|
+
### 5. No Reverse Engineering or Security Bypassing
|
|
25
|
+
This software **does not** decrypt, crack, or bypass any password protection, access control system, or digital rights management (DRM) mechanisms implemented by TradingView, Inc. It only queries and formats publicly visible data endpoints accessible to any standard web browser.
|
|
26
|
+
|
|
27
|
+
### 6. No Data Redistribution
|
|
28
|
+
This software does not host, cache, distribute, or store any market data. It is a client-side formatting script. All requests are real-time, client-to-host queries.
|
|
29
|
+
|
|
30
|
+
### 7. Immediate Compliance & Takedown Policy
|
|
31
|
+
The author respects all intellectual property rights and platform terms. If TradingView, Inc., or its authorized legal representatives request the removal of this repository, the author will comply and take down the repository immediately.
|
tvfinance-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tvfinance contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tvfinance-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tvfinance
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python tools for TradingView finance data research
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: curl-cffi>=0.15.0
|
|
8
|
+
Requires-Dist: lxml
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# tvfinance
|
|
12
|
+
|
|
13
|
+
A lightweight, high-performance Python package for querying TradingView financial and general market data synchronously and asynchronously.
|
|
14
|
+
|
|
15
|
+
> [!CAUTION]
|
|
16
|
+
> **CRITICAL LEGAL NOTICE & DISCLAIMER: READ BEFORE USE**
|
|
17
|
+
>
|
|
18
|
+
> **BEFORE ACCESSING OR USING THIS REPOSITORY, YOU MUST READ AND AGREE TO THE FULL [LEGAL DISCLAIMER & TERMS OF USE](DISCLAIMER.md).**
|
|
19
|
+
>
|
|
20
|
+
> 1. **STRICTLY FOR EDUCATIONAL & PERSONAL RESEARCH ONLY**: This project (`tvfinance`) is an open-source educational research tool designed to analyze web protocols. It is **NOT** a commercial product, **NOT** a financial service, and **MUST NOT** be used for production or commercial purposes.
|
|
21
|
+
> 2. **NO AFFILIATION WITH TRADINGVIEW**: This library is **NOT** affiliated with, sponsored by, endorsed by, or associated with TradingView, Inc. or any of its partners or affiliates. "TradingView" is a registered trademark of TradingView, Inc.
|
|
22
|
+
> 3. **USE AT YOUR OWN RISK (NO WARRANTY)**: This software is provided "AS IS", without warranty of any kind, express or implied. The author, contributors, and maintainers **ACCEPT ZERO LIABILITY** for any damages, losses, server bans, IP blocks, or account suspensions that may result from using this software.
|
|
23
|
+
> 4. **COMPLIANCE & TERMS OF SERVICE**: Users are solely and fully responsible for ensuring compliance with TradingView's Terms of Use, policies, and local laws. The author does **not** encourage, condone, or facilitate automated scraping, commercial exploitation, or any access patterns that violate TradingView's policies.
|
|
24
|
+
> 5. **NO FINANCIAL OR INVESTMENT ADVICE**: Any data retrieved by this tool is strictly informational. It does **not** constitute financial, trading, or investment advice. The author is **not** a financial advisor and shall **not** be held liable for any trading decisions or investment losses.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **Real-Time Quotes**: Stream or fetch real-time quotes including prices, change percentages, and company logos.
|
|
31
|
+
- **Historical Data**: Fetch OHLCV bar data with custom timeframes and resolutions.
|
|
32
|
+
- **Economic Calendar**: Query upcoming or past economic events with date, country, and importance filters.
|
|
33
|
+
- **Fundamental & Company Data**: Extract Bonds, ETFs, SEC Documents, Holdings, community Ideas, and Financial Overview.
|
|
34
|
+
- **Search**: Dynamic fuzzy symbol search supporting econometrics and FRED data.
|
|
35
|
+
- **Option Chains**: Fetch and pair options contracts cleanly.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
Install using `pip` from a local directory or your preferred method:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install tvfinance
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or using `uv`:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv add tvfinance
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quickstart
|
|
52
|
+
|
|
53
|
+
### Ticker Wrapper
|
|
54
|
+
|
|
55
|
+
The `Ticker` class wraps all functional interfaces into an object-oriented package:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from tvfinance import Ticker
|
|
59
|
+
|
|
60
|
+
# Instantiate a ticker (requires exchange prefix)
|
|
61
|
+
aapl = Ticker("NASDAQ:AAPL")
|
|
62
|
+
|
|
63
|
+
# Get real-time quote
|
|
64
|
+
quote = aapl.quote()
|
|
65
|
+
print(f"Price: {quote.last} | Logo: {quote.logo_url}")
|
|
66
|
+
|
|
67
|
+
# Fetch 30 daily price bars (OHLCV)
|
|
68
|
+
history = aapl.history(count=30)
|
|
69
|
+
|
|
70
|
+
# Fetch company profile & fundamentals
|
|
71
|
+
profile = aapl.profile()
|
|
72
|
+
print(f"CEO: {profile['ceo']} | Market Cap: {profile['market_cap']}")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Economic Calendar
|
|
76
|
+
|
|
77
|
+
Query global economic events:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from tvfinance import calendar
|
|
81
|
+
|
|
82
|
+
events = calendar(countries="US,JP", importance=1)
|
|
83
|
+
for event in events[:3]:
|
|
84
|
+
print(f"[{event['date']}] {event['country']} - {event['title']}")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Command Line Interface (CLI)
|
|
88
|
+
|
|
89
|
+
`tvfinance` installs a command-line interface for quick terminal queries:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Get quote
|
|
93
|
+
tvfinance quote NASDAQ:AAPL
|
|
94
|
+
|
|
95
|
+
# Search economic calendar
|
|
96
|
+
tvfinance calendar --countries US,JP --limit 5
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Documentation
|
|
100
|
+
|
|
101
|
+
To build the interactive documentation site locally:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
uv run mkdocs build
|
|
105
|
+
uv run mkdocs serve
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# tvfinance
|
|
2
|
+
|
|
3
|
+
A lightweight, high-performance Python package for querying TradingView financial and general market data synchronously and asynchronously.
|
|
4
|
+
|
|
5
|
+
> [!CAUTION]
|
|
6
|
+
> **CRITICAL LEGAL NOTICE & DISCLAIMER: READ BEFORE USE**
|
|
7
|
+
>
|
|
8
|
+
> **BEFORE ACCESSING OR USING THIS REPOSITORY, YOU MUST READ AND AGREE TO THE FULL [LEGAL DISCLAIMER & TERMS OF USE](DISCLAIMER.md).**
|
|
9
|
+
>
|
|
10
|
+
> 1. **STRICTLY FOR EDUCATIONAL & PERSONAL RESEARCH ONLY**: This project (`tvfinance`) is an open-source educational research tool designed to analyze web protocols. It is **NOT** a commercial product, **NOT** a financial service, and **MUST NOT** be used for production or commercial purposes.
|
|
11
|
+
> 2. **NO AFFILIATION WITH TRADINGVIEW**: This library is **NOT** affiliated with, sponsored by, endorsed by, or associated with TradingView, Inc. or any of its partners or affiliates. "TradingView" is a registered trademark of TradingView, Inc.
|
|
12
|
+
> 3. **USE AT YOUR OWN RISK (NO WARRANTY)**: This software is provided "AS IS", without warranty of any kind, express or implied. The author, contributors, and maintainers **ACCEPT ZERO LIABILITY** for any damages, losses, server bans, IP blocks, or account suspensions that may result from using this software.
|
|
13
|
+
> 4. **COMPLIANCE & TERMS OF SERVICE**: Users are solely and fully responsible for ensuring compliance with TradingView's Terms of Use, policies, and local laws. The author does **not** encourage, condone, or facilitate automated scraping, commercial exploitation, or any access patterns that violate TradingView's policies.
|
|
14
|
+
> 5. **NO FINANCIAL OR INVESTMENT ADVICE**: Any data retrieved by this tool is strictly informational. It does **not** constitute financial, trading, or investment advice. The author is **not** a financial advisor and shall **not** be held liable for any trading decisions or investment losses.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Real-Time Quotes**: Stream or fetch real-time quotes including prices, change percentages, and company logos.
|
|
21
|
+
- **Historical Data**: Fetch OHLCV bar data with custom timeframes and resolutions.
|
|
22
|
+
- **Economic Calendar**: Query upcoming or past economic events with date, country, and importance filters.
|
|
23
|
+
- **Fundamental & Company Data**: Extract Bonds, ETFs, SEC Documents, Holdings, community Ideas, and Financial Overview.
|
|
24
|
+
- **Search**: Dynamic fuzzy symbol search supporting econometrics and FRED data.
|
|
25
|
+
- **Option Chains**: Fetch and pair options contracts cleanly.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install using `pip` from a local directory or your preferred method:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install tvfinance
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or using `uv`:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv add tvfinance
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
### Ticker Wrapper
|
|
44
|
+
|
|
45
|
+
The `Ticker` class wraps all functional interfaces into an object-oriented package:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from tvfinance import Ticker
|
|
49
|
+
|
|
50
|
+
# Instantiate a ticker (requires exchange prefix)
|
|
51
|
+
aapl = Ticker("NASDAQ:AAPL")
|
|
52
|
+
|
|
53
|
+
# Get real-time quote
|
|
54
|
+
quote = aapl.quote()
|
|
55
|
+
print(f"Price: {quote.last} | Logo: {quote.logo_url}")
|
|
56
|
+
|
|
57
|
+
# Fetch 30 daily price bars (OHLCV)
|
|
58
|
+
history = aapl.history(count=30)
|
|
59
|
+
|
|
60
|
+
# Fetch company profile & fundamentals
|
|
61
|
+
profile = aapl.profile()
|
|
62
|
+
print(f"CEO: {profile['ceo']} | Market Cap: {profile['market_cap']}")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Economic Calendar
|
|
66
|
+
|
|
67
|
+
Query global economic events:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from tvfinance import calendar
|
|
71
|
+
|
|
72
|
+
events = calendar(countries="US,JP", importance=1)
|
|
73
|
+
for event in events[:3]:
|
|
74
|
+
print(f"[{event['date']}] {event['country']} - {event['title']}")
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Command Line Interface (CLI)
|
|
78
|
+
|
|
79
|
+
`tvfinance` installs a command-line interface for quick terminal queries:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Get quote
|
|
83
|
+
tvfinance quote NASDAQ:AAPL
|
|
84
|
+
|
|
85
|
+
# Search economic calendar
|
|
86
|
+
tvfinance calendar --countries US,JP --limit 5
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Documentation
|
|
90
|
+
|
|
91
|
+
To build the interactive documentation site locally:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
uv run mkdocs build
|
|
95
|
+
uv run mkdocs serve
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Calendar APIs
|
|
2
|
+
|
|
3
|
+
These functions retrieve economic, earnings, dividend, and IPO events from TradingView.
|
|
4
|
+
|
|
5
|
+
## Synchronous APIs
|
|
6
|
+
|
|
7
|
+
### `calendar`
|
|
8
|
+
::: tvfinance.calendar
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
### `earnings`
|
|
13
|
+
::: tvfinance.earnings
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### `dividends`
|
|
18
|
+
::: tvfinance.dividends
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### `ipo`
|
|
23
|
+
::: tvfinance.ipo
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### `revenue`
|
|
28
|
+
::: tvfinance.revenue
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Asynchronous APIs
|
|
33
|
+
|
|
34
|
+
### `calendar` (Async)
|
|
35
|
+
::: tvfinance.aio.calendar
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### `earnings` (Async)
|
|
40
|
+
::: tvfinance.aio.earnings
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### `dividends` (Async)
|
|
45
|
+
::: tvfinance.aio.dividends
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### `ipo` (Async)
|
|
50
|
+
::: tvfinance.aio.ipo
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### `revenue` (Async)
|
|
55
|
+
::: tvfinance.aio.revenue
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Market Data APIs
|
|
2
|
+
|
|
3
|
+
These functions provide low-level interfaces for quotes, streaming data, symbol search, and history.
|
|
4
|
+
|
|
5
|
+
## Synchronous APIs
|
|
6
|
+
|
|
7
|
+
### `quote`
|
|
8
|
+
::: tvfinance.quote
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
### `stream`
|
|
13
|
+
::: tvfinance.stream
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### `history`
|
|
18
|
+
::: tvfinance.history
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### `search`
|
|
23
|
+
::: tvfinance.search
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Asynchronous APIs
|
|
28
|
+
|
|
29
|
+
### `quote` (Async)
|
|
30
|
+
::: tvfinance.aio.quote
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### `stream` (Async)
|
|
35
|
+
::: tvfinance.aio.stream
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### `history` (Async)
|
|
40
|
+
::: tvfinance.aio.history
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### `search` (Async)
|
|
45
|
+
::: tvfinance.aio.search
|