VistaFetch
VistaFetch is a simple and lightweight Python library for financial asset data retrieval (stocks, ETFs, etc.) from onvista.de.
⚡️ Quickstart
Please ensure that vistafetch is installed on your machine by running the following command:
pip install vistafetch
The first step is to initiate the client (VistaFetchClient):
from vistafetch import VistaFetchClient
client = VistaFetchClient()
🔎 Exploratory search
The client now enables you to search for assets and allows you to investigate the results:
result = client.search_asset(
search_term="S&P",
)
result.visualize()
This produces the following console output:
Financial assets discovered
┏━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Index ┃ Name ┃ Asset Type ┃ ISIN ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ 0 │ S&P 500 │ INDEX │ US78378X1072 │
│ 1 │ Siemens Energy │ STOCK │ DE000ENER6Y0 │
│ 2 │ Silberpreis │ PRECIOUS_METAL │ XC0009653103 │
│ 3 │ SAP │ STOCK │ DE0007164600 │
│ 4 │ EURO STOXX 50 │ INDEX │ EU0009658145 │
└───────┴────────────────┴────────────────┴──────────────┘
One now can access the asset of choice:
asset = result.get(3) # returns SAP in this case
# in case one simply wants the first one, the following shorthand takes you there
asset = result.get()
One can now access several parameters of the asset or convert them to a JSON string as show below.
print(asset.isin)
print(asset.as_json())
DE0007164600
{
"display_type":"Aktie",
"entity_type":"STOCK",
"isin":"DE0007164600",
"name":"SAP",
"tiny_name":"SAP",
"wkn":"716460",
}
As a final step, the asset provides some recent price-related data:
print(asset.get_latest_price_data().as_json())
{
"currency_symbol":"EUR",
"datetime_high":"2023-08-25T14:17:15Z",
"datetime_last":"2023-08-25T15:37:14Z",
"datetime_low":"2023-08-25T15:02:12Z",
"datetime_open":"2023-08-25T07:00:26.999000Z",
"high":127.24,
"last":126.16,
"low":125.66,
"open":126.2,
}
In addition, you directly access the individual values, e.g., price value last:
asset.get_latest_price_data().last
126.16
🎯 Targeted search
In case you already know the identifier for your asset (both ISIN and WKN are supported), you can directly query them. This returns then only one result:
result = client.search_asset(
search_term="DE0007164600", # alternatively pass the WKN here
)
sap_stock = result.get()
⚙️ Configuration
The following environment variables can be used to configure vistafetch:
| Variable | Description | Default |
|---|---|---|
VISTAFETCH_USER_AGENT |
Overrides the User-Agent header sent with every API request. Useful if the default value is blocked or if you want to identify your application. |
vistafetch |
Example:
export VISTAFETCH_USER_AGENT="my-app/2.0"
🐛 Facing problems
Feel free to open an issue if you experience strange behavior or bugs when using vistafetch.
If you are not sure if your problem should be considered a bug or if you have a question in general, reach out via discussions.
💻 Contributing
We welcome and appreciate contributions of any size. or smaller or straightforward changes, feel free to create a pull request directly. If you plan to make significant improvements or extensions, please open an issue or disussion beforehand.
Initial Setup
For your convenience, please ensure that you have Poetry and Just installed. You can read more on them by following the links below:
To get all required dependencies installed, simply start with:
just poetry-install
Additionally, we make use of pre-commit. To set it up, run the following command:
pre-commit install
To verify that everything is set up correctly, execute the test suite:
just unit-tests
Code Conformance
Once you implemented your changes, please run the following commands:
just pretty # formats the code and applies automatic linting fixes
just check # checks code for conformance
Opening PR
Please be aware that this repository follows conventional commit. So please choose a PR title corresponding to the following:
<scope>(#<IssueID>): <description> # supported scopes can be found here: https://github.com/commitizen/conventional-commit-types/blob/master/index.json
# e.g.
docs(#8): provide extensive project readme
# issue id is optional, so the following si valid as well
docs: provide extensive project readme
Metadata
Release files for vistafetch 2.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vistafetch-2.3.0.tar.gz | 20.1 kB | Without provenance | Details for vistafetch-2.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vistafetch-2.3.0-py3-none-any.whl | Python 3 | none | any | Details for vistafetch-2.3.0-py3-none-any.whl |
Total release size: 41.5 kB
Release files / vistafetch-2.3.0.tar.gz
| Download URL | vistafetch-2.3.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17c2bdd747893ea504c0ce249b64bd63f5d17f03a3052515fc62905f01a2e6aa
|
|
BLAKE2b-256 checksum How to use checksums |
aff3f24c5fd581934572d8fe7f9be4e5092d0aa9169bb808517f497bb9e47918
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / vistafetch-2.3.0-py3-none-any.whl
| Download URL | vistafetch-2.3.0-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef6468cea3d5aedd49c10413e04b8ba1aa28d9fd8550a0743ba8dce54df4a541
|
|
BLAKE2b-256 checksum How to use checksums |
3c0ea42d4325d5c7a1126310218fe3a1d1dcc89df859ae3f7b890423467a6fc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Security for vistafetch 2.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.