<jupyter_start><jupyter_text>sqlalchemy things for one to many relations<jupyter_code>from tables import Stocks, Industry, Sector
from connect import connect_to_session
# from add_update_stock import add_stock
session = connect_to_session()
for row in session.query(Industry).all():
    print(row.__dict__)
for row in session.query(Sector).all():
    print(row.__dict__)
new = Industry(industry_name='Test')
session.add(new)
session.commit()
new.id
import datetime
datetime.datetime.now()
Stocks.datetime_updated
from sqlalchemy.sql import select
from tables import StockInfo, Stocks
s = select(Stocks.symbol, Stocks.is_held).where()
result = session.execute(s)
result.fetchall()<jupyter_output><empty_output><jupyter_text>Testing stockstats w/ yf<jupyter_code>import yfinance as yf
from stockstats import StockDataFrame
data = yf.Ticker('AAPL').history()
data.head()
df = StockDataFrame(data)
df.rename(columns={'Open': 'open', 'High': 'high', 'Low': 'low', 'Close': 'close', 'Volume': 'volume'}, inplace=True)
df.init_all()
df.info()
df.rsi<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13059701492537312, 'fraction_numerical': 0.0, 'mean_word_length': 7.515873015873016, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '284637', 'license': 'MIT', 'n_tokens_mistral': 363, 'n_tokens_neox': 360, 'n_words': 85, 'path': 'test_yy.ipynb', 'repo_name': 'jmacdonald2010/stock-scanner', 'size': '1072'}