vistafetch


Namevistafetch JSON
Version 1.2.3 PyPI version JSON
download
home_pagehttps://github.com/bossenti/vistafetch
SummarySmall & simple library to fetch financial data for stocks, ETFs, funds, etc. from Onvista.
upload_time2023-11-04 08:10:06
maintainer
docs_urlNone
authorbossenti
requires_python>=3.8,<3.13
licenseApache 2.0
keywords etf exchange financial-data funds onvista stocks
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
  <br>
   <img src="https://github.com/bossenti/vistafetch/blob/main/docs/img/vistafetch.png?raw=true"
   alt="VistaFetch Logo" title="VistaFetch Logo" width=30%"/>
    <br>VistaFetch
  <br>
</h1>
<h4 align="center">VistaFetch is a simple and lightweight Python library for financial asset data retrieval (stocks, ETFs, etc.) from onvista.de.</h4>
<p align="center">
<a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">
    <img src="https://img.shields.io/github/license/apache/streampipes.svg" alt="License Apache 2.0">
</a>
<a href="https://github.com/bossenti/vistafetch/actions/workflows/ci.yml" target="blank">
    <img src="https://github.com/bossenti/vistafetch/actions/workflows/ci.yml/badge.svg" alt="Continuous Integration status"> 
</a>
<a href="https://pypi.org/project/vistafetch/" target="blank">
    <img src="https://img.shields.io/pypi/v/vistafetch" alt="PyPI released version"> 
</a>
<a href="https://pypi.org/project/vistafetch/" target="blank">
    <img src="https://img.shields.io/pypi/pyversions/vistafetch" alt="PyPI supported Python versions"> 
</a>
<a href="https://github.com/python/mypy" target="_blank">
    <img src="https://img.shields.io/badge/typed-mypy-blue" alt="Typed: MyPy">
</a>
<a href="https://beta.ruff.rs/docs/" target="_blank">
    <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Linting: Ruff">
</a>
<a href="https://python-poetry.org" target="_blank">
    <img src="https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json" alt="Dependency & Build Management: Poetry">
</a>
<a href="https://pre-commit.com/" target="_blank">
    <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white" alt="pre-commit">
</a>
<a href="https://pydantic.dev" target="_blank">
    <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json" alt="Pydantic v2">
</a>
</p>

> [!WARNING]  
> The API used by this package is not public. Therefore, users should assume that using this package may violate the site's terms of use.
> The author of this package takes no responsibility for how individuals use the code. It is important to use the code respectfully and judiciously, keeping in mind the potential consequences of violating the terms of service and applicable laws.
> Users are encouraged to read the API Terms and Conditions, Acceptable Use Policy, and License Agreements before using any API. These agreements outline the legal, business, and technical considerations that apply to the use of an API.


## โšก๏ธ Quickstart
Please ensure that `vistafetch` is installed on your machine by running the following command:
```bash
pip install vistafetch
```
The first step is to initiate the client (`VistaFetchClient`):
```python
from vistafetch import VistaFetchClient

client = VistaFetchClient()
```

### ๐Ÿ”Ž Exploratory search
The client now enables you to search for assets and allows you to investigate the results:
```python
result = client.search_asset(
    search_term="S&P",
)
result.visualize()
```
This produces the following console output:
```bash
               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:
```python
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.
```python
print(asset.isin)
print(asset.as_json())
```
```bash
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:
```python
print(asset.get_latest_price_data().as_json())
```
```bash
{
  "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`:
```python
asset.get_latest_price_data().last
```
```bash
126.16
```

<br>

> [!WARNING]  
> Price data are currently not supported for indexes.
> Feel free to send me a feature request if you'd like to see this feature
> supported for other asset types as well: https://github.com/bossenti/vistafetch/issues/new.
> As an alternative, contributions are welcome at any time.

### ๐ŸŽฏ 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:
```python
result = client.search_asset(
    search_term="DE0007164600",  # alternatively pass the WKN here
)
sap_stock = result.get()
```

## ๐Ÿ› Facing problems
Feel free to open an [issue](https://github.com/bossenti/vistafetch/issues/new) if you experience strange behavior or bugs when using `vistafetch`. <br>
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](https://github.com/bossenti/vistafetch/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](https://github.com/bossenti/vistafetch/issues/new) 
or [disussion](https://github.com/bossenti/vistafetch/discussions) 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:
* [poetry](https://python-poetry.org/)
* [just](https://github.com/casey/just)

To get all required dependencies installed, simply start with:
```bash
just poetry-install
```
Additionally, we make use of [pre-commit](https://github.com/pre-commit/pre-commit). To set it up, run the following command:
```bash
pre-commit install
```

To verify that everything is set up correctly, execute the test suite:
```bash
just unit-tests
```

### Code Conformance

Once you implemented your changes, please run the following commands:
```bash
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](https://www.conventionalcommits.org/en/v1.0.0/).
So please choose a PR title corresponding to the following:
```bash
<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
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bossenti/vistafetch",
    "name": "vistafetch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.13",
    "maintainer_email": "",
    "keywords": "etf,exchange,financial-data,funds,onvista,stocks",
    "author": "bossenti",
    "author_email": "bossenti@apache.org",
    "download_url": "https://files.pythonhosted.org/packages/7e/05/4c65caf807d6880ec50f796c23209272c465109e4540598bdb1d73e89113/vistafetch-1.2.3.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n  <br>\n   <img src=\"https://github.com/bossenti/vistafetch/blob/main/docs/img/vistafetch.png?raw=true\"\n   alt=\"VistaFetch Logo\" title=\"VistaFetch Logo\" width=30%\"/>\n    <br>VistaFetch\n  <br>\n</h1>\n<h4 align=\"center\">VistaFetch is a simple and lightweight Python library for financial asset data retrieval (stocks, ETFs, etc.) from onvista.de.</h4>\n<p align=\"center\">\n<a href=\"http://www.apache.org/licenses/LICENSE-2.0\" target=\"_blank\">\n    <img src=\"https://img.shields.io/github/license/apache/streampipes.svg\" alt=\"License Apache 2.0\">\n</a>\n<a href=\"https://github.com/bossenti/vistafetch/actions/workflows/ci.yml\" target=\"blank\">\n    <img src=\"https://github.com/bossenti/vistafetch/actions/workflows/ci.yml/badge.svg\" alt=\"Continuous Integration status\"> \n</a>\n<a href=\"https://pypi.org/project/vistafetch/\" target=\"blank\">\n    <img src=\"https://img.shields.io/pypi/v/vistafetch\" alt=\"PyPI released version\"> \n</a>\n<a href=\"https://pypi.org/project/vistafetch/\" target=\"blank\">\n    <img src=\"https://img.shields.io/pypi/pyversions/vistafetch\" alt=\"PyPI supported Python versions\"> \n</a>\n<a href=\"https://github.com/python/mypy\" target=\"_blank\">\n    <img src=\"https://img.shields.io/badge/typed-mypy-blue\" alt=\"Typed: MyPy\">\n</a>\n<a href=\"https://beta.ruff.rs/docs/\" target=\"_blank\">\n    <img src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\" alt=\"Linting: Ruff\">\n</a>\n<a href=\"https://python-poetry.org\" target=\"_blank\">\n    <img src=\"https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json\" alt=\"Dependency & Build Management: Poetry\">\n</a>\n<a href=\"https://pre-commit.com/\" target=\"_blank\">\n    <img src=\"https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white\" alt=\"pre-commit\">\n</a>\n<a href=\"https://pydantic.dev\" target=\"_blank\">\n    <img src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json\" alt=\"Pydantic v2\">\n</a>\n</p>\n\n> [!WARNING]  \n> The API used by this package is not public. Therefore, users should assume that using this package may violate the site's terms of use.\n> The author of this package takes no responsibility for how individuals use the code. It is important to use the code respectfully and judiciously, keeping in mind the potential consequences of violating the terms of service and applicable laws.\n> Users are encouraged to read the API Terms and Conditions, Acceptable Use Policy, and License Agreements before using any API. These agreements outline the legal, business, and technical considerations that apply to the use of an API.\n\n\n## \u26a1\ufe0f Quickstart\nPlease ensure that `vistafetch` is installed on your machine by running the following command:\n```bash\npip install vistafetch\n```\nThe first step is to initiate the client (`VistaFetchClient`):\n```python\nfrom vistafetch import VistaFetchClient\n\nclient = VistaFetchClient()\n```\n\n### \ud83d\udd0e Exploratory search\nThe client now enables you to search for assets and allows you to investigate the results:\n```python\nresult = client.search_asset(\n    search_term=\"S&P\",\n)\nresult.visualize()\n```\nThis produces the following console output:\n```bash\n               Financial assets discovered                \n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Index \u2503      Name      \u2503   Asset Type   \u2503     ISIN     \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502   0   \u2502    S&P 500     \u2502     INDEX      \u2502 US78378X1072 \u2502\n\u2502   1   \u2502 Siemens Energy \u2502     STOCK      \u2502 DE000ENER6Y0 \u2502\n\u2502   2   \u2502  Silberpreis   \u2502 PRECIOUS_METAL \u2502 XC0009653103 \u2502\n\u2502   3   \u2502      SAP       \u2502     STOCK      \u2502 DE0007164600 \u2502\n\u2502   4   \u2502 EURO STOXX 50  \u2502     INDEX      \u2502 EU0009658145 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\nOne now can access the asset of choice:\n```python\nasset = result.get(3)  # returns SAP in this case\n\n# in case one simply wants the first one, the following shorthand takes you there\nasset = result.get()\n```\nOne can now access several parameters of the asset or convert them to a JSON string as show below.\n```python\nprint(asset.isin)\nprint(asset.as_json())\n```\n```bash\nDE0007164600\n{\n  \"display_type\":\"Aktie\",\n  \"entity_type\":\"STOCK\",\n  \"isin\":\"DE0007164600\",\n  \"name\":\"SAP\",\n  \"tiny_name\":\"SAP\",\n  \"wkn\":\"716460\",\n}\n```\n\nAs a final step, the asset provides some recent price-related data:\n```python\nprint(asset.get_latest_price_data().as_json())\n```\n```bash\n{\n  \"currency_symbol\":\"EUR\",\n  \"datetime_high\":\"2023-08-25T14:17:15Z\",\n  \"datetime_last\":\"2023-08-25T15:37:14Z\",\n  \"datetime_low\":\"2023-08-25T15:02:12Z\",\n  \"datetime_open\":\"2023-08-25T07:00:26.999000Z\",\n  \"high\":127.24,\n  \"last\":126.16,\n  \"low\":125.66,\n  \"open\":126.2,\n}\n```\n\nIn addition, you directly access the individual values, e.g., price value `last`:\n```python\nasset.get_latest_price_data().last\n```\n```bash\n126.16\n```\n\n<br>\n\n> [!WARNING]  \n> Price data are currently not supported for indexes.\n> Feel free to send me a feature request if you'd like to see this feature\n> supported for other asset types as well: https://github.com/bossenti/vistafetch/issues/new.\n> As an alternative, contributions are welcome at any time.\n\n### \ud83c\udfaf Targeted search\nIn case you already know the identifier for your asset (both ISIN and WKN are supported),\nyou can directly query them. This returns then only one result:\n```python\nresult = client.search_asset(\n    search_term=\"DE0007164600\",  # alternatively pass the WKN here\n)\nsap_stock = result.get()\n```\n\n## \ud83d\udc1b Facing problems\nFeel free to open an [issue](https://github.com/bossenti/vistafetch/issues/new) if you experience strange behavior or bugs when using `vistafetch`. <br>\nIf you are not sure if your problem should be considered a bug or if you have a question in general, reach out via [discussions](https://github.com/bossenti/vistafetch/discussions).\n\n\n## \ud83d\udcbb Contributing\nWe welcome and appreciate contributions of any size.\nor smaller or straightforward changes, feel free to create a pull request directly. \nIf you plan to make significant improvements or extensions, please open an [issue](https://github.com/bossenti/vistafetch/issues/new) \nor [disussion](https://github.com/bossenti/vistafetch/discussions) beforehand.\n\n### Initial Setup\nFor your convenience, please ensure that you have Poetry and Just installed. You can read more on them by following the links below:\n* [poetry](https://python-poetry.org/)\n* [just](https://github.com/casey/just)\n\nTo get all required dependencies installed, simply start with:\n```bash\njust poetry-install\n```\nAdditionally, we make use of [pre-commit](https://github.com/pre-commit/pre-commit). To set it up, run the following command:\n```bash\npre-commit install\n```\n\nTo verify that everything is set up correctly, execute the test suite:\n```bash\njust unit-tests\n```\n\n### Code Conformance\n\nOnce you implemented your changes, please run the following commands:\n```bash\njust pretty   # formats the code and applies automatic linting fixes\njust check  # checks code for conformance\n```\n\n### Opening PR\n\nPlease be aware that this repository follows [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/).\nSo please choose a PR title corresponding to the following:\n```bash\n<scope>(#<IssueID>): <description>  # supported scopes can be found here: https://github.com/commitizen/conventional-commit-types/blob/master/index.json\n\n# e.g.\ndocs(#8): provide extensive project readme\n\n# issue id is optional, so the following si valid as well\ndocs: provide extensive project readme\n```\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Small & simple library to fetch financial data for stocks, ETFs, funds, etc. from Onvista.",
    "version": "1.2.3",
    "project_urls": {
        "Documentation": "https://github.com/bossenti/vistafetch#readme",
        "Homepage": "https://github.com/bossenti/vistafetch",
        "Repository": "https://github.com/bossenti/vistafetch"
    },
    "split_keywords": [
        "etf",
        "exchange",
        "financial-data",
        "funds",
        "onvista",
        "stocks"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6ad2c365f4e1467d80bb8037a3d54065959f5fb4fb039f30193162cd79d6f4d",
                "md5": "3c9f3757721d3212941736d391291527",
                "sha256": "44119f3c71dd0e68565c8e2ec3bf361f688b7b1849bd7a4817e95fce10a58a85"
            },
            "downloads": -1,
            "filename": "vistafetch-1.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3c9f3757721d3212941736d391291527",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.13",
            "size": 20931,
            "upload_time": "2023-11-04T08:10:05",
            "upload_time_iso_8601": "2023-11-04T08:10:05.116869Z",
            "url": "https://files.pythonhosted.org/packages/b6/ad/2c365f4e1467d80bb8037a3d54065959f5fb4fb039f30193162cd79d6f4d/vistafetch-1.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e054c65caf807d6880ec50f796c23209272c465109e4540598bdb1d73e89113",
                "md5": "c4a74231e969876fd1dfdce2c34a5a9a",
                "sha256": "ef6eb55d765013984b5dabe0f5fc929017a077f916cd77fd7ec3bb81757fe0d6"
            },
            "downloads": -1,
            "filename": "vistafetch-1.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c4a74231e969876fd1dfdce2c34a5a9a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.13",
            "size": 18091,
            "upload_time": "2023-11-04T08:10:06",
            "upload_time_iso_8601": "2023-11-04T08:10:06.945105Z",
            "url": "https://files.pythonhosted.org/packages/7e/05/4c65caf807d6880ec50f796c23209272c465109e4540598bdb1d73e89113/vistafetch-1.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-04 08:10:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bossenti",
    "github_project": "vistafetch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "vistafetch"
}
        
Elapsed time: 0.13038s