mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 21:12:16 +00:00
* Report fixes * replace wrong typing * mypy * mypy again Co-authored-by: james <jmaslek11@gmail.com>
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
from datetime import datetime
|
|
import logging
|
|
from typing import Optional
|
|
from pandas import DataFrame
|
|
|
|
from openbb_terminal.decorators import log_start_end
|
|
|
|
from openbb_terminal.cryptocurrency.due_diligence.glassnode_model import get_close_price
|
|
|
|
# pylint: disable=unsupported-assignment-operation
|
|
|
|
logger = logging.getLogger(__name__)
|
|
# pylint: disable=unsupported-assignment-operation
|
|
|
|
api_url = "https://api.glassnode.com/v1/metrics/"
|
|
|
|
|
|
@log_start_end(log=logger)
|
|
def get_btc_rainbow(
|
|
start_date: str = "2010-01-01",
|
|
end_date: Optional[str] = None,
|
|
) -> DataFrame:
|
|
"""Get bitcoin price data
|
|
[Price data from source: https://glassnode.com]
|
|
[Inspired by: https://blockchaincenter.net]
|
|
|
|
Parameters
|
|
----------
|
|
start_date : str
|
|
Initial date, format YYYY-MM-DD
|
|
end_date : Optional[str]
|
|
Final date, format YYYY-MM-DD
|
|
|
|
Returns
|
|
-------
|
|
pd.DataFrame
|
|
price over time
|
|
"""
|
|
|
|
if end_date is None:
|
|
end_date = datetime.now().strftime("%Y-%m-%d")
|
|
|
|
df_data = get_close_price("BTC", start_date, end_date)
|
|
|
|
return df_data
|