tessa


Nametessa JSON
Version 0.8.0 PyPI version JSON
download
home_pagehttps://github.com/ymyke/tessa
SummaryFind financial assets and get their price history without worrying about different APIs or rate limiting.
upload_time2023-06-27 12:20:01
maintainer
docs_urlNone
authorymyke
requires_python>=3.9
licenseMIT
keywords python finance investing financial-analysis investment-analysis financial-data coingecko pycoingecko yahoo yahoo-finance yfinance
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# tessa – simple, hassle-free access to price information of financial assets 📉🤓📈

tessa is a Python library to help you **easily search asset identifiers** (e.g.,
tickers) and **retrieve price information** for assets from different sources such as
Yahoo or Coingecko. It takes care of the different APIs, caching, rate limiting, and
other hassles.

tessa provides a **Symbol class that encapsulates nicely the methods relevant for a
symbol**. tessa also provides functionality to **manage collections of symbols**, store
and load them, and extend their functionality.

Finally, tessa makes sure to be nice to the sites being accessed and tries to **prevent
users from being blocked by 429 rate limiting errors** by 1) caching results upon
retrieval and 2) keeping track of request timestamps and waiting appropriate amounts of
time if necessary.

[→ Check out the full documentation. 📖](https://ymyke.github.io/tessa/tessa.html)


## How to use

Here's a longer example that quickly shows all aspects of the library. Refer to
submodules [symbol](tessa/symbol.html), [search](tessa/search.html), and
[price](tessa/price.html) for more information.

- Imports:

```python
from tessa import Symbol, SymbolCollection, search
```

- Create a symbol for MSFT and access some functions:

```python
s1 = Symbol("MSFT")         # will use "yahoo" as the default source
s1.price_latest()           # get latest price
```

- Create another symbol from a bloomberg ticker as it is used by Yahoo Finance:

```python
s2 = Symbol("SREN.SW")
s2.price_point("2022-06-30")    # get price at specific point in time
```

- Create a symbol from the coingecko source with an id as it is used by coingecko:

```python
s3 = Symbol("bitcoin", source="coingecko")
s3.price_graph()            # show price graph
```

- Search for a more crypto ticker on coingecko:

```python
res = search("GAME")        # search and print search result summary
filtered = res.filter(source="coingecko")  # filter results
filtered.p()                # print summary of filtered results
filtered.buckets[0].symbols # review the best bucket in the filtered results
s4 = filtered.buckets[0].symbols[2]   # our symbol is the 3rd in that list
s4.price_history()          # get entire history
```

- Build a collection of several symbols and use the collection to retrieve symbols:

```python
sc = SymbolCollection([s1, s2, s3, s4])
sc.add(Symbol("AAPL"))      # add another one
sc.find_one("SREN").price_graph()
```

- Store and load a symbol collection:

```python
sc.save_yaml("my_symbols.yaml")
sc_new = SymbolCollection()
sc_new.load_yaml("my_symbols.yaml")
```

- Use a different currency preference:

```python
sc.find_one("game").price_latest()  # will return price in USD
Symbol.currency_preference = "CHF"
sc.find_one("game").price_latest()  # will return price in CHF
```

Note that `currency_preference` will only have an effect with sources that support it.
It is supported for Coingecko but not for Yahoo. So you should always verify the
effective currency you receive in the result.


## Data sources

tessa builds on [yfinance](https://pypi.org/project/yfinance/) and
[pycoingecko](https://github.com/man-c/pycoingecko) and offers **a simplified and
unified interface**. 

Why these two sources? Yahoo Finance (via yfinance) is fast and offers an extensive
database that also contains many non-US markets. Coingecko (via pycoingecko) offers
great access to crypto prices. While Yahoo Finance also offers crypto information,
pycoingecko has the advantage that you can have the prices quoted in many more currency
preferences (a function that is also exposed via tessa).

More sources can be added in the future. Let me know in the
[issues](https://github.com/ymyke/tessa/issues) of you have a particular request.


## Main submodules

- [symbol](tessa/symbol.html): working with symbols and symbol collections.
- [search](tessa/search.html): searching the different sources.
- [price](tessa/price.html): accessing price functions directly instead of via the
  `Symbol` class.
- [sources](tessa/sources.html): if you'd like to add additional sources to the library.


## How to install

`pip install tessa`


## Prerequisites

See `pyproject.toml`. Major prerequisites are the `yfinance` and `pycoingecko` packages
to access finance information as well as the `beautifulsoup4` package to do some
scraping for searching on Yahoo Finance.


## Repository

https://github.com/ymyke/tessa


## Future Work

This is an initial version. There are a number of ideas on how to extend. Please leave
your suggestions and comments in the [Issues
section](https://github.com/ymyke/tessa/issues).


## On terminology

I'm using symbol instead of ticker because a ticker is mainly used for stock on stock
markets, whereas tessa is inteded to be used for any kind of financial assets, e.g. also
crypto.


## Other noteworthy libraries

- [strela](https://github.com/ymyke/strela): A python package for financial alerts.
- [pypme](https://github.com/ymyke/pypme): A Python package for PME (Public Market
  Equivalent) calculation.


## On investpy as a data source

Tessa used to use the [investpy package](https://github.com/alvarobartt/investpy) as the
main source of information until mid 2022 until investing.com introduced Cloudflare,
which broke access by investpy. 😖 It is currently unclear if investpy will be available
again in the future. [You can follow the developments in issue
600.](https://github.com/alvarobartt/investpy/issues/600) The old tessa/investpy code is
still available in the [add-symbols-based-on-investpy
branch](https://github.com/ymyke/tessa/tree/add-symbols-based-on-investpy).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ymyke/tessa",
    "name": "tessa",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "python,finance,investing,financial-analysis,investment-analysis,financial-data,coingecko,pycoingecko,yahoo,yahoo-finance,yfinance",
    "author": "ymyke",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/75/d0/197b2697e1c6294d36d7660bb6046915af5a4db96a98d2cb151a2ec694f5/tessa-0.8.0.tar.gz",
    "platform": null,
    "description": "\n# tessa \u2013 simple, hassle-free access to price information of financial assets \ud83d\udcc9\ud83e\udd13\ud83d\udcc8\n\ntessa is a Python library to help you **easily search asset identifiers** (e.g.,\ntickers) and **retrieve price information** for assets from different sources such as\nYahoo or Coingecko. It takes care of the different APIs, caching, rate limiting, and\nother hassles.\n\ntessa provides a **Symbol class that encapsulates nicely the methods relevant for a\nsymbol**. tessa also provides functionality to **manage collections of symbols**, store\nand load them, and extend their functionality.\n\nFinally, tessa makes sure to be nice to the sites being accessed and tries to **prevent\nusers from being blocked by 429 rate limiting errors** by 1) caching results upon\nretrieval and 2) keeping track of request timestamps and waiting appropriate amounts of\ntime if necessary.\n\n[\u2192 Check out the full documentation. \ud83d\udcd6](https://ymyke.github.io/tessa/tessa.html)\n\n\n## How to use\n\nHere's a longer example that quickly shows all aspects of the library. Refer to\nsubmodules [symbol](tessa/symbol.html), [search](tessa/search.html), and\n[price](tessa/price.html) for more information.\n\n- Imports:\n\n```python\nfrom tessa import Symbol, SymbolCollection, search\n```\n\n- Create a symbol for MSFT and access some functions:\n\n```python\ns1 = Symbol(\"MSFT\")         # will use \"yahoo\" as the default source\ns1.price_latest()           # get latest price\n```\n\n- Create another symbol from a bloomberg ticker as it is used by Yahoo Finance:\n\n```python\ns2 = Symbol(\"SREN.SW\")\ns2.price_point(\"2022-06-30\")    # get price at specific point in time\n```\n\n- Create a symbol from the coingecko source with an id as it is used by coingecko:\n\n```python\ns3 = Symbol(\"bitcoin\", source=\"coingecko\")\ns3.price_graph()            # show price graph\n```\n\n- Search for a more crypto ticker on coingecko:\n\n```python\nres = search(\"GAME\")        # search and print search result summary\nfiltered = res.filter(source=\"coingecko\")  # filter results\nfiltered.p()                # print summary of filtered results\nfiltered.buckets[0].symbols # review the best bucket in the filtered results\ns4 = filtered.buckets[0].symbols[2]   # our symbol is the 3rd in that list\ns4.price_history()          # get entire history\n```\n\n- Build a collection of several symbols and use the collection to retrieve symbols:\n\n```python\nsc = SymbolCollection([s1, s2, s3, s4])\nsc.add(Symbol(\"AAPL\"))      # add another one\nsc.find_one(\"SREN\").price_graph()\n```\n\n- Store and load a symbol collection:\n\n```python\nsc.save_yaml(\"my_symbols.yaml\")\nsc_new = SymbolCollection()\nsc_new.load_yaml(\"my_symbols.yaml\")\n```\n\n- Use a different currency preference:\n\n```python\nsc.find_one(\"game\").price_latest()  # will return price in USD\nSymbol.currency_preference = \"CHF\"\nsc.find_one(\"game\").price_latest()  # will return price in CHF\n```\n\nNote that `currency_preference` will only have an effect with sources that support it.\nIt is supported for Coingecko but not for Yahoo. So you should always verify the\neffective currency you receive in the result.\n\n\n## Data sources\n\ntessa builds on [yfinance](https://pypi.org/project/yfinance/) and\n[pycoingecko](https://github.com/man-c/pycoingecko) and offers **a simplified and\nunified interface**. \n\nWhy these two sources? Yahoo Finance (via yfinance) is fast and offers an extensive\ndatabase that also contains many non-US markets. Coingecko (via pycoingecko) offers\ngreat access to crypto prices. While Yahoo Finance also offers crypto information,\npycoingecko has the advantage that you can have the prices quoted in many more currency\npreferences (a function that is also exposed via tessa).\n\nMore sources can be added in the future. Let me know in the\n[issues](https://github.com/ymyke/tessa/issues) of you have a particular request.\n\n\n## Main submodules\n\n- [symbol](tessa/symbol.html): working with symbols and symbol collections.\n- [search](tessa/search.html): searching the different sources.\n- [price](tessa/price.html): accessing price functions directly instead of via the\n  `Symbol` class.\n- [sources](tessa/sources.html): if you'd like to add additional sources to the library.\n\n\n## How to install\n\n`pip install tessa`\n\n\n## Prerequisites\n\nSee `pyproject.toml`. Major prerequisites are the `yfinance` and `pycoingecko` packages\nto access finance information as well as the `beautifulsoup4` package to do some\nscraping for searching on Yahoo Finance.\n\n\n## Repository\n\nhttps://github.com/ymyke/tessa\n\n\n## Future Work\n\nThis is an initial version. There are a number of ideas on how to extend. Please leave\nyour suggestions and comments in the [Issues\nsection](https://github.com/ymyke/tessa/issues).\n\n\n## On terminology\n\nI'm using symbol instead of ticker because a ticker is mainly used for stock on stock\nmarkets, whereas tessa is inteded to be used for any kind of financial assets, e.g. also\ncrypto.\n\n\n## Other noteworthy libraries\n\n- [strela](https://github.com/ymyke/strela): A python package for financial alerts.\n- [pypme](https://github.com/ymyke/pypme): A Python package for PME (Public Market\n  Equivalent) calculation.\n\n\n## On investpy as a data source\n\nTessa used to use the [investpy package](https://github.com/alvarobartt/investpy) as the\nmain source of information until mid 2022 until investing.com introduced Cloudflare,\nwhich broke access by investpy. \ud83d\ude16 It is currently unclear if investpy will be available\nagain in the future. [You can follow the developments in issue\n600.](https://github.com/alvarobartt/investpy/issues/600) The old tessa/investpy code is\nstill available in the [add-symbols-based-on-investpy\nbranch](https://github.com/ymyke/tessa/tree/add-symbols-based-on-investpy).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Find financial assets and get their price history without worrying about different APIs or rate limiting.",
    "version": "0.8.0",
    "project_urls": {
        "Documentation": "https://ymyke.github.io/tessa/tessa.html",
        "Homepage": "https://github.com/ymyke/tessa",
        "Repository": "https://github.com/ymyke/tessa"
    },
    "split_keywords": [
        "python",
        "finance",
        "investing",
        "financial-analysis",
        "investment-analysis",
        "financial-data",
        "coingecko",
        "pycoingecko",
        "yahoo",
        "yahoo-finance",
        "yfinance"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9d0cd78a1f0828259aae54bdfa714ba5ef07d874ed9969dbeec7aa4123c113f",
                "md5": "7abf81df4b6659bba26dc038c44abca0",
                "sha256": "d273ee2702bc5962a4f10bfceb4e799fbe39f3d0df6e8e62ac92315cc1db9d8a"
            },
            "downloads": -1,
            "filename": "tessa-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7abf81df4b6659bba26dc038c44abca0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 29065,
            "upload_time": "2023-06-27T12:19:59",
            "upload_time_iso_8601": "2023-06-27T12:19:59.366514Z",
            "url": "https://files.pythonhosted.org/packages/f9/d0/cd78a1f0828259aae54bdfa714ba5ef07d874ed9969dbeec7aa4123c113f/tessa-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75d0197b2697e1c6294d36d7660bb6046915af5a4db96a98d2cb151a2ec694f5",
                "md5": "137d958693019e68ed7a29da90e8083f",
                "sha256": "f68b7105933973007a0ba0ef37a74527ac9209a95d29c6b209738dad5d95e3df"
            },
            "downloads": -1,
            "filename": "tessa-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "137d958693019e68ed7a29da90e8083f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 25187,
            "upload_time": "2023-06-27T12:20:01",
            "upload_time_iso_8601": "2023-06-27T12:20:01.711646Z",
            "url": "https://files.pythonhosted.org/packages/75/d0/197b2697e1c6294d36d7660bb6046915af5a4db96a98d2cb151a2ec694f5/tessa-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-27 12:20:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ymyke",
    "github_project": "tessa",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tessa"
}
        
Elapsed time: 0.09792s