code
stringlengths
3
6.57k
replace('{}', 'null')
re.sub(r'\{[\'|\"]raw[\'|\"]:(.*?)
json.loads(new_data)
_parse_table(json_info)
pd.DataFrame(json_info)
df.set_index("endDate", inplace=True)
pd.to_datetime(df.index, unit="s")
df.transpose()
get_income_statement(ticker, yearly = True)
_parse_json(income_site)
_parse_table(temp)
get_balance_sheet(ticker, yearly = True)
_parse_json(balance_sheet_site)
_parse_table(temp)
get_cash_flow(ticker, yearly = True)
_parse_json(cash_flow_site)
_parse_table(temp)
get_financials(ticker, yearly = True, quarterly = True)
AssertionError("yearly or quarterly must be True")
_parse_json(financials_site)
_parse_table(temp)
_parse_table(temp)
_parse_table(temp)
_parse_table(temp)
_parse_table(temp)
_parse_table(temp)
get_holders(ticker, headers = {'User-agent': 'Mozilla/5.0'})
pd.read_html(requests.get(holders_site, headers=headers)
Holders (Forms 3 and 4)
zip(table_names , tables)
get_analysts_info(ticker, headers = {'User-agent': 'Mozilla/5.0'})
pd.read_html(requests.get(analysts_site, headers=headers)
zip(table_names , tables)
get_live_price(ticker)
get_data(ticker, end_date = pd.Timestamp.today()
pd.DateOffset(10)
_raw_get_daily_info(site)
HTMLSession()
session.get(site)
pd.read_html(resp.html.raw_html)
copy()
map(lambda x: float(x.strip("%+")
replace(",", "")
df.columns.tolist()
type(df[field][0])
map(_convert_to_numeric)
session.close()
get_day_most_active(count: int = 100)
_raw_get_daily_info(f"https://finance.yahoo.com/most-active?offset=0&count={count}")
get_day_gainers(count: int = 100)
_raw_get_daily_info(f"https://finance.yahoo.com/gainers?offset=0&count={count}")
get_day_losers(count: int = 100)
_raw_get_daily_info(f"https://finance.yahoo.com/losers?offset=0&count={count}")
get_top_crypto()
HTMLSession()
session.get("https://finance.yahoo.com/cryptocurrencies?offset=0&count=100")
pd.read_html(resp.html.raw_html)
copy()
map(lambda x: float(str(x)
strip("%")
strip("+")
replace(",", "")
df.columns.tolist()
type(df[field][0])
map(lambda x: _convert_to_numeric(str(x)
session.close()
build_url(ticker, start_date, end_date, "1d")
requests.get(site, params = params, headers = headers)
pd.DataFrame()
resp.json()
pd.DataFrame()
pd.DataFrame(data["chart"]["result"][0]['events']['dividends'])
frame.transpose()
pd.to_datetime(frame.index, unit = "s")
frame.index.map(lambda dt: dt.floor("d")
frame.sort_index()
ticker.upper()
frame.drop(columns='date')
frame.rename({'amount': 'dividend'}, axis = 'columns')
frame.reset_index()
frame.rename(columns = {"index": "date"}, inplace = True)
build_url(ticker, start_date, end_date, "1d")
requests.get(site, params = params, headers = headers)
AssertionError(resp.json()
resp.json()
AssertionError("There is no data available on stock events, or none have occured")
AssertionError("There is no data available on stock splits, or none have occured")
pd.DataFrame(data["chart"]["result"][0]['events']['splits'])
frame.transpose()
pd.to_datetime(frame.index, unit = "s")
frame.index.map(lambda dt: dt.floor("d")
frame.sort_index()
ticker.upper()
frame.drop(columns=['date', 'denominator', 'numerator'])
frame.reset_index()
frame.rename(columns = {"index": "date"}, inplace = True)
get_earnings(ticker)
pd.DataFrame()
pd.DataFrame()
pd.DataFrame()