<commit_before>from collections import namedtuple
import datetime
from sqlalchemy import func
from sqlalchemy.orm import sessionmaker

from database.order_history import OrderHistory
from database import db


Order = namedtuple('Order', ['ticker', 'date', 'num_shares', 'price'])
TickerDate = namedtuple('TickerDate', ['ticker', 'date'])
Session = sessionmaker(bind=db.engine)


class OrderHistoryLogic(object):

    def add_orders(self, user_id, orders):
        session = Session()
        for order in orders:
            session.add(
                OrderHistory(
                    user_id=user_id,
                    date=order.date,
                    ticker=order.ticker,
                    num_shares=order.num_shares,
                    price=order.price,
                )
            )
        session.commit()
<commit_msg>Adding a todo<commit_after>from collections import namedtuple
import datetime
from sqlalchemy import func
from sqlalchemy.orm import sessionmaker

from database.order_history import OrderHistory
from database import db


Order = namedtuple('Order', ['ticker', 'date', 'num_shares', 'price'])
TickerDate = namedtuple('TickerDate', ['ticker', 'date'])
Session = sessionmaker(bind=db.engine)


class OrderHistoryLogic(object):

    # TODO add user_id to Order, consistency
    def add_orders(self, user_id, orders):
        session = Session()
        for order in orders:
            session.add(
                OrderHistory(
                    user_id=user_id,
                    date=order.date,
                    ticker=order.ticker,
                    num_shares=order.num_shares,
                    price=order.price,
                )
            )
        session.commit()

{'fraction_non_alphanumeric': 0.08927536231884058, 'fraction_numerical': 0.0, 'mean_word_length': 2.244360902255639, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '5884652', 'n_tokens_mistral': 474, 'n_tokens_neox': 448, 'n_words': 116}