tessa.price

Retrieving price information

Main functions:

Example use:

>>> from tessa import price_history, price_point, price_latest

>>> df, currency = price_history("AAPL")

>>> price_point("SAP.DE", "2015-01-01")         # will return price at 2015-01-02

>>> price_point_strict("SAP.DE", "2015-01-01")  # will raise a KeyError

>>> price_latest("ethereum", source="coingecko", currency_preference="CHF")

>>> price_latest("ETH-EUR", source="yahoo")

>>> price_latest("ethereum", source="yahoo")    # error b/c symbol not found on yahoo

>>> price_latest("ETH-EUR", source="coingecko") # error b/c symbol not found on coingecko
 1"""
 2# Retrieving price information
 3
 4Main functions:
 5
 6- `tessa.price.price.price_history`: Retrieve the full history of an asset as a
 7  dataframe.
 8- `tessa.price.price.price_point_strict`: Get an asset's price at a certain point in
 9  time. Fail if no price found.
10- `tessa.price.price.price_point`: Same, but find the nearest price if the given point
11  in time has no
12- `tessa.price.price.price_latest`: Get an asset's latest price.
13
14
15Example use:
16
17```python
18>>> from tessa import price_history, price_point, price_latest
19
20>>> df, currency = price_history("AAPL")
21
22>>> price_point("SAP.DE", "2015-01-01")         # will return price at 2015-01-02
23
24>>> price_point_strict("SAP.DE", "2015-01-01")  # will raise a KeyError
25
26>>> price_latest("ethereum", source="coingecko", currency_preference="CHF")
27
28>>> price_latest("ETH-EUR", source="yahoo")
29
30>>> price_latest("ethereum", source="yahoo")    # error b/c symbol not found on yahoo
31
32>>> price_latest("ETH-EUR", source="coingecko") # error b/c symbol not found on coingecko
33
34```
35
36"""
37
38from .types import PriceHistory, PricePoint
39from .price import (
40    price_history,
41    price_point,
42    price_point_strict,
43    price_latest,
44)