mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-30 21:22:24 +00:00
* Remove disc open browser websites * remove sentiment investor from discovery * add popular,emerging SI cmds to ba * fix typo * refactor disc/finnhub commands * refactor disc/yfinance commands * refactor disc/ford command * refactor disc/arkord command * fix disc/upcoming refactoring * fix disc/upcoming refactoring * fix disc/latest-trending news refactoring * refactor disc/shortinterest commands * refactor disc/shortinterest commands * fix tests * Update test_coingecko_crypto.py * improvement after review * add todo Co-authored-by: jmaslek <jmaslek11@gmail.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
import requests
|
|
import pandas as pd
|
|
from gamestonk_terminal import config_terminal as cfg
|
|
|
|
|
|
def get_ipo_calendar(from_date: str, to_date: str) -> pd.DataFrame:
|
|
"""Get IPO calendar
|
|
|
|
Parameters
|
|
----------
|
|
from_date : str
|
|
from date (%Y-%m-%d) to get IPO calendar
|
|
to_date : str
|
|
to date (%Y-%m-%d) to get IPO calendar
|
|
|
|
Returns
|
|
-------
|
|
pd.DataFrame
|
|
Get dataframe with economic calendar events
|
|
"""
|
|
response = requests.get(
|
|
f"https://finnhub.io/api/v1/calendar/ipo?from={from_date}&to={to_date}&token={cfg.API_FINNHUB_KEY}"
|
|
)
|
|
if response.status_code == 200:
|
|
d_data = response.json()
|
|
if "ipoCalendar" in d_data:
|
|
d_refactor_columns = {
|
|
"numberOfShares": "Number of Shares",
|
|
"totalSharesValue": "Total Shares Value",
|
|
"date": "Date",
|
|
"exchange": "Exchange",
|
|
"name": "Name",
|
|
"price": "Price",
|
|
"status": "Status",
|
|
}
|
|
return pd.DataFrame(d_data["ipoCalendar"]).rename(
|
|
columns=d_refactor_columns
|
|
)
|
|
|
|
return pd.DataFrame()
|