예제 #1
0
    def process_row(self, index, row):
        ticker_code = clean_nulls(row['ticker'])
        ticker = Ticker.find_by_ticker(self.session, ticker_code)

        corp_action_date = row['date']
        corp_action_type_code = row['action']
        corp_action_type = CorporateActionType.get_or_create(
            self.session, corp_action_type_code)

        name = row['name']
        value = clean_nulls(row['value'])
        contra_ticker = clean_nulls(row['contraticker'])
        contra_name = clean_nulls(row['contraname'])

        corp_action = CorporateAction.find(self.session, ticker_code,
                                           corp_action_date,
                                           corp_action_type_code)
        if corp_action is None:
            corp_action = CorporateAction(corp_action_date=corp_action_date,
                                          ticker_code=ticker_code,
                                          ticker=ticker,
                                          corp_action_type=corp_action_type,
                                          name=name,
                                          value=value,
                                          contra_ticker=contra_ticker,
                                          contra_name=contra_name)
        else:
            corp_action.ticker = ticker
            corp_action.name = name
            corp_action.value = value
            corp_action.contra_ticker = contra_ticker
            corp_action.contra_name = contra_name

        self.session.add(corp_action)
    def process_row(self, index, row):
        ticker_code = row['ticker']
        ticker = Ticker.find_by_ticker(self.session, ticker_code)

        investor_name = row['investorname']
        investor = InstitutionalInvestor.get_or_create(self.session,
                                                       investor_name)

        security_type_code = row['securitytype']
        security_type = SecurityType.get_or_create(self.session,
                                                   security_type_code)

        calendar_date = row['calendardate']
        value = row['value']
        units = row['units']
        price = clean_nulls(row['price'])

        holdings = InstitutionalHoldings.find(self.session, ticker_code,
                                              investor, security_type,
                                              calendar_date)
        if holdings is None:
            holdings = InstitutionalHoldings(ticker=ticker,
                                             investor=investor,
                                             security_type=security_type,
                                             calendar_date=calendar_date,
                                             value=value,
                                             units=units,
                                             price=price)
        else:
            holdings.value = value
            holdings.units = units
            holdings.price = price

        self.session.add(holdings)
예제 #3
0
    def process_row(self, index, row):
        ticker_code = row['ticker']
        date = row['date']
        open_px = clean_price(row['open'])
        high_px = clean_price(row['high'])
        low_px = clean_price(row['low'])
        close_px = clean_price(row['close'])
        volume = clean_nulls(row['volume'])
        dividends = row['dividends']
        close_unadj = row['closeunadj']
        last_updated = row['lastupdated']

        ticker = Ticker.find_by_ticker(self.session, ticker_code)
        equity_price = EquityPrice.find(self.session, ticker_code, date)
        if equity_price is None:
            equity_price = EquityPrice(ticker_code=ticker_code,
                                       ticker=ticker,
                                       date=date,
                                       open_px=open_px,
                                       high_px=high_px,
                                       low_px=low_px,
                                       close_px=close_px,
                                       volume=volume,
                                       dividends=dividends,
                                       close_unadj=close_unadj,
                                       last_updated=last_updated)
        else:
            equity_price.ticker = ticker
            equity_price.open_px = open_px
            equity_price.high_px = high_px
            equity_price.low_px = low_px
            equity_price.close_px = close_px
            equity_price.volume = volume
            equity_price.dividends = dividends
            equity_price.close_unadj = close_unadj
            equity_price.last_updated = last_updated

        self.session.add(equity_price)
예제 #4
0
    def process_row(self, index, row):
        ticker_code = row['ticker']
        ticker = Ticker.find_by_ticker(self.session, ticker_code)

        dimension_type_code = row['dimension']
        dimension_type = DimensionType.get_or_create(self.session,
                                                     dimension_type_code)

        calendar_date = row['calendardate']
        date_key = row['datekey']
        report_period = row['reportperiod']
        last_updated = row['lastupdated']

        accoci = clean_nulls(row['accoci'])
        assets = clean_nulls(row['assets'])
        assets_avg = clean_nulls(row['assetsavg'])
        assets_c = clean_nulls(row['assetsc'])
        assets_nc = clean_nulls(row['assetsnc'])
        asset_turnover = clean_nulls(row['assetturnover'])
        bvps = clean_nulls(row['bvps'])
        capex = clean_nulls(row['capex'])
        cash_neq = clean_nulls(row['cashneq'])
        cash_neq_usd = clean_nulls(row['cashnequsd'])
        cor = clean_nulls(row['cor'])
        consol_inc = clean_nulls(row['consolinc'])
        current_ratio = clean_nulls(row['currentratio'])
        de = clean_nulls(row['de'])
        debt = clean_nulls(row['debt'])
        debt_c = clean_nulls(row['debtc'])
        debt_nc = clean_nulls(row['debtnc'])
        debt_usd = clean_nulls(row['debtusd'])
        deferred_rev = clean_nulls(row['deferredrev'])
        dep_amor = clean_nulls(row['depamor'])
        deposits = clean_nulls(row['deposits'])
        div_yield = clean_nulls(row['divyield'])
        dps = clean_nulls(row['dps'])
        ebit = clean_nulls(row['ebit'])
        ebitda = clean_nulls(row['ebitda'])
        ebitda_margin = clean_nulls(row['ebitdamargin'])
        ebitda_usd = clean_nulls(row['ebitdausd'])
        ebit_usd = clean_nulls(row['ebitusd'])
        ebt = clean_nulls(row['ebt'])
        eps = clean_nulls(row['eps'])
        eps_dil = clean_nulls(row['epsdil'])
        eps_usd = clean_nulls(row['epsusd'])
        equity = clean_nulls(row['equity'])
        equity_avg = clean_nulls(row['equityavg'])
        equity_usd = clean_nulls(row['equityusd'])
        ev = clean_nulls(row['ev'])
        ev_ebit = clean_nulls(row['evebit'])
        ev_ebitda = clean_nulls(row['evebitda'])
        fcf = clean_nulls(row['fcf'])
        fcf_ps = clean_nulls(row['fcfps'])
        fx_usd = clean_nulls(row['fxusd'])
        gp = clean_nulls(row['gp'])
        gross_margin = clean_nulls(row['grossmargin'])
        int_exp = clean_nulls(row['intexp'])
        inv_cap = clean_nulls(row['invcap'])
        inv_cap_avg = clean_nulls(row['invcapavg'])
        inventory = clean_nulls(row['inventory'])
        investments = clean_nulls(row['investments'])
        investments_c = clean_nulls(row['investmentsc'])
        investments_nc = clean_nulls(row['investmentsnc'])
        liabilities = clean_nulls(row['liabilities'])
        liabilities_c = clean_nulls(row['liabilitiesc'])
        liabilities_nc = clean_nulls(row['liabilitiesnc'])
        market_cap = clean_nulls(row['marketcap'])
        ncf = clean_nulls(row['ncf'])
        ncf_bus = clean_nulls(row['ncfbus'])
        ncf_common = clean_nulls(row['ncfcommon'])
        ncf_debt = clean_nulls(row['ncfdebt'])
        ncf_div = clean_nulls(row['ncfdiv'])
        ncf_f = clean_nulls(row['ncff'])
        ncf_i = clean_nulls(row['ncfi'])
        ncf_inv = clean_nulls(row['ncfinv'])
        ncf_o = clean_nulls(row['ncfo'])
        ncf_x = clean_nulls(row['ncfx'])
        net_inc = clean_nulls(row['netinc'])
        net_inc_cmn = clean_nulls(row['netinccmn'])
        net_inc_cmn_usd = clean_nulls(row['netinccmnusd'])
        net_inc_dis = clean_nulls(row['netincdis'])
        net_inc_nci = clean_nulls(row['netincnci'])
        net_margin = clean_nulls(row['netmargin'])
        op_ex = clean_nulls(row['opex'])
        op_inc = clean_nulls(row['opinc'])
        payables = clean_nulls(row['payables'])
        payout_ratio = clean_nulls(row['payoutratio'])
        pb = clean_nulls(row['pb'])
        pe = clean_nulls(row['pe'])
        pe1 = clean_nulls(row['pe1'])
        ppne_net = clean_nulls(row['ppnenet'])
        pref_div_is = clean_nulls(row['prefdivis'])
        price = clean_nulls(row['price'])
        ps = clean_nulls(row['ps'])
        ps1 = clean_nulls(row['ps1'])
        receivables = clean_nulls(row['receivables'])
        ret_earn = clean_nulls(row['retearn'])
        revenue = clean_nulls(row['revenue'])
        revenue_usd = clean_nulls(row['revenueusd'])
        rnd = clean_nulls(row['rnd'])
        roa = clean_nulls(row['roa'])
        roe = clean_nulls(row['roe'])
        roic = clean_nulls(row['roic'])
        ros = clean_nulls(row['ros'])
        sb_comp = clean_nulls(row['sbcomp'])
        sgna = clean_nulls(row['sgna'])
        share_factor = clean_nulls(row['sharefactor'])
        shares_bas = clean_nulls(row['sharesbas'])
        shares_wa = clean_nulls(row['shareswa'])
        shares_wa_dil = clean_nulls(row['shareswadil'])
        sps = clean_nulls(row['sps'])
        tangibles = clean_nulls(row['tangibles'])
        tax_assets = clean_nulls(row['taxassets'])
        tax_exp = clean_nulls(row['taxexp'])
        tax_liabilities = clean_nulls(row['taxliabilities'])
        tbvps = clean_nulls(row['tbvps'])
        working_capital = clean_nulls(row['workingcapital'])

        fundamentals = Fundamentals.find(self.session, ticker_code,
                                         dimension_type, date_key,
                                         report_period)
        if fundamentals is None:
            fundamentals = Fundamentals(ticker_code=ticker_code,
                                        ticker=ticker,
                                        dimension_type=dimension_type,
                                        calendar_date=calendar_date,
                                        date_key=date_key,
                                        report_period=report_period,
                                        last_updated=last_updated,
                                        accoci=accoci,
                                        assets=assets,
                                        assets_avg=assets_avg,
                                        assets_c=assets_c,
                                        assets_nc=assets_nc,
                                        asset_turnover=asset_turnover,
                                        bvps=bvps,
                                        capex=capex,
                                        cash_neq=cash_neq,
                                        cash_neq_usd=cash_neq_usd,
                                        cor=cor,
                                        consol_inc=consol_inc,
                                        current_ratio=current_ratio,
                                        de=de,
                                        debt=debt,
                                        debt_c=debt_c,
                                        debt_nc=debt_nc,
                                        debt_usd=debt_usd,
                                        deferred_rev=deferred_rev,
                                        dep_amor=dep_amor,
                                        deposits=deposits,
                                        div_yield=div_yield,
                                        dps=dps,
                                        ebit=ebit,
                                        ebitda=ebitda,
                                        ebitda_margin=ebitda_margin,
                                        ebitda_usd=ebitda_usd,
                                        ebit_usd=ebit_usd,
                                        ebt=ebt,
                                        eps=eps,
                                        eps_dil=eps_dil,
                                        eps_usd=eps_usd,
                                        equity=equity,
                                        equity_avg=equity_avg,
                                        equity_usd=equity_usd,
                                        ev=ev,
                                        ev_ebit=ev_ebit,
                                        ev_ebitda=ev_ebitda,
                                        fcf=fcf,
                                        fcf_ps=fcf_ps,
                                        fx_usd=fx_usd,
                                        gp=gp,
                                        gross_margin=gross_margin,
                                        int_exp=int_exp,
                                        inv_cap=inv_cap,
                                        inv_cap_avg=inv_cap_avg,
                                        inventory=inventory,
                                        investments=investments,
                                        investments_c=investments_c,
                                        investments_nc=investments_nc,
                                        liabilities=liabilities,
                                        liabilities_c=liabilities_c,
                                        liabilities_nc=liabilities_nc,
                                        market_cap=market_cap,
                                        ncf=ncf,
                                        ncf_bus=ncf_bus,
                                        ncf_common=ncf_common,
                                        ncf_debt=ncf_debt,
                                        ncf_div=ncf_div,
                                        ncf_f=ncf_f,
                                        ncf_i=ncf_i,
                                        ncf_inv=ncf_inv,
                                        ncf_o=ncf_o,
                                        ncf_x=ncf_x,
                                        net_inc=net_inc,
                                        net_inc_cmn=net_inc_cmn,
                                        net_inc_cmn_usd=net_inc_cmn_usd,
                                        net_inc_dis=net_inc_dis,
                                        net_inc_nci=net_inc_nci,
                                        net_margin=net_margin,
                                        op_ex=op_ex,
                                        op_inc=op_inc,
                                        payables=payables,
                                        payout_ratio=payout_ratio,
                                        pb=pb,
                                        pe=pe,
                                        pe1=pe1,
                                        ppne_net=ppne_net,
                                        pref_div_is=pref_div_is,
                                        price=price,
                                        ps=ps,
                                        ps1=ps1,
                                        receivables=receivables,
                                        ret_earn=ret_earn,
                                        revenue=revenue,
                                        revenue_usd=revenue_usd,
                                        rnd=rnd,
                                        roa=roa,
                                        roe=roe,
                                        roic=roic,
                                        ros=ros,
                                        sb_comp=sb_comp,
                                        sgna=sgna,
                                        share_factor=share_factor,
                                        shares_bas=shares_bas,
                                        shares_wa=shares_wa,
                                        shares_wa_dil=shares_wa_dil,
                                        sps=sps,
                                        tangibles=tangibles,
                                        tax_assets=tax_assets,
                                        tax_exp=tax_exp,
                                        tax_liabilities=tax_liabilities,
                                        tbvps=tbvps,
                                        working_capital=working_capital)
        else:
            fundamentals.ticker = ticker
            fundamentals.calendar_date = calendar_date
            fundamentals.last_updated = last_updated
            fundamentals.accoci = accoci
            fundamentals.assets = assets
            fundamentals.assets_avg = assets_avg
            fundamentals.assets_c = assets_c
            fundamentals.assets_nc = assets_nc
            fundamentals.asset_turnover = asset_turnover
            fundamentals.bvps = bvps
            fundamentals.capex = capex
            fundamentals.cash_neq = cash_neq
            fundamentals.cash_neq_usd = cash_neq_usd
            fundamentals.cor = cor
            fundamentals.consol_inc = consol_inc
            fundamentals.current_ratio = current_ratio
            fundamentals.de = de
            fundamentals.debt = debt
            fundamentals.debt_c = debt_c
            fundamentals.debt_nc = debt_nc
            fundamentals.debt_usd = debt_usd
            fundamentals.deferred_rev = deferred_rev
            fundamentals.dep_amor = dep_amor
            fundamentals.deposits = deposits
            fundamentals.div_yield = div_yield
            fundamentals.dps = dps
            fundamentals.ebit = ebit
            fundamentals.ebitda = ebitda
            fundamentals.ebitda_margin = ebitda_margin
            fundamentals.ebitda_usd = ebitda_usd
            fundamentals.ebit_usd = ebit_usd
            fundamentals.ebt = ebt
            fundamentals.eps = eps
            fundamentals.eps_dil = eps_dil
            fundamentals.eps_usd = eps_usd
            fundamentals.equity = equity
            fundamentals.equity_avg = equity_avg
            fundamentals.equity_usd = equity_usd
            fundamentals.ev = ev
            fundamentals.ev_ebit = ev_ebit
            fundamentals.ev_ebitda = ev_ebitda
            fundamentals.fcf = fcf
            fundamentals.fcf_ps = fcf_ps
            fundamentals.fx_usd = fx_usd
            fundamentals.gp = gp
            fundamentals.gross_margin = gross_margin
            fundamentals.int_exp = int_exp
            fundamentals.inv_cap = inv_cap
            fundamentals.inv_cap_avg = inv_cap_avg
            fundamentals.inventory = inventory
            fundamentals.investments = investments
            fundamentals.investments_c = investments_c
            fundamentals.investments_nc = investments_nc
            fundamentals.liabilities = liabilities
            fundamentals.liabilities_c = liabilities_c
            fundamentals.liabilities_nc = liabilities_nc
            fundamentals.market_cap = market_cap
            fundamentals.ncf = ncf
            fundamentals.ncf_bus = ncf_bus
            fundamentals.ncf_common = ncf_common
            fundamentals.ncf_debt = ncf_debt
            fundamentals.ncf_div = ncf_div
            fundamentals.ncf_f = ncf_f
            fundamentals.ncf_i = ncf_i
            fundamentals.ncf_inv = ncf_inv
            fundamentals.ncf_o = ncf_o
            fundamentals.ncf_x = ncf_x
            fundamentals.net_inc = net_inc
            fundamentals.net_inc_cmn = net_inc_cmn
            fundamentals.net_inc_cmn_usd = net_inc_cmn_usd
            fundamentals.net_inc_dis = net_inc_dis
            fundamentals.net_inc_nci = net_inc_nci
            fundamentals.net_margin = net_margin
            fundamentals.op_ex = op_ex
            fundamentals.op_inc = op_inc
            fundamentals.payables = payables
            fundamentals.payout_ratio = payout_ratio
            fundamentals.pb = pb
            fundamentals.pe = pe
            fundamentals.pe1 = pe1
            fundamentals.ppne_net = ppne_net
            fundamentals.pref_div_is = pref_div_is
            fundamentals.price = price
            fundamentals.ps = ps
            fundamentals.ps1 = ps1
            fundamentals.receivables = receivables
            fundamentals.ret_earn = ret_earn
            fundamentals.revenue = revenue
            fundamentals.revenue_usd = revenue_usd
            fundamentals.rnd = rnd
            fundamentals.roa = roa
            fundamentals.roe = roe
            fundamentals.roic = roic
            fundamentals.ros = ros
            fundamentals.sb_comp = sb_comp
            fundamentals.sgna = sgna
            fundamentals.share_factor = share_factor
            fundamentals.shares_bas = shares_bas
            fundamentals.shares_wa = shares_wa
            fundamentals.shares_wa_dil = shares_wa_dil
            fundamentals.sps = sps
            fundamentals.tangibles = tangibles
            fundamentals.tax_assets = tax_assets
            fundamentals.tax_exp = tax_exp
            fundamentals.tax_liabilities = tax_liabilities
            fundamentals.tbvps = tbvps
            fundamentals.working_capital = working_capital

        self.session.add(fundamentals)
예제 #5
0
    def process_row(self, index, row):
        table_name = row['table']
        perma_ticker_id = row['permaticker']
        ticker = row['ticker']
        if ticker == 'N/A':
            ticker = None
        name = row['name']
        exchange = Exchange.get_or_create(self.session,
                                          clean_nulls(row['exchange']))
        is_delisted = yes_no_to_bool(row['isdelisted'])
        category = TickerCategory.get_or_create(self.session,
                                                clean_nulls(row['category']))

        cusips = row['cusips']

        sic_sector_code = clean_nulls(row['siccode'])
        sic_sector = clean_nulls(row['sicsector'])
        sic_industry = clean_nulls(row['sicindustry'])
        sic_sector_map = Sector.get_or_create(self.session,
                                              sector_code_type_code='SIC',
                                              sector_code=sic_sector_code,
                                              sector=sic_sector,
                                              industry=sic_industry)

        fama_sector = clean_nulls(row['famasector'])
        fama_industry = clean_nulls(row['famaindustry'])
        fama_sector_map = Sector.get_or_create(self.session,
                                               sector_code_type_code='FAMA',
                                               sector_code=None,
                                               sector=fama_sector,
                                               industry=fama_industry)

        sector = clean_nulls(row['sector'])
        industry = clean_nulls(row['industry'])
        sharadar_sector_map = Sector.get_or_create(
            self.session,
            sector_code_type_code='Sharadar',
            sector_code=None,
            sector=sector,
            industry=industry)

        market_cap_scale_code = clean_nulls(row['scalemarketcap'])
        market_cap_scale = Scale.get_or_create(self.session,
                                               market_cap_scale_code)

        revenue_scale_code = clean_nulls(row['scalerevenue'])
        revenue_scale = Scale.get_or_create(self.session, revenue_scale_code)

        related_tickers = row['relatedtickers']

        currency_code = row['currency']
        currency = Currency.get_or_create(self.session, currency_code)

        location = row['location']
        last_updated = clean_nulls(row['lastupdated'])
        first_added = clean_nulls(row['firstadded'])
        first_price_date = clean_nulls(row['firstpricedate'])
        last_price_date = clean_nulls(row['lastpricedate'])
        first_quarter = clean_nulls(row['firstquarter'])
        last_quarter = clean_nulls(row['lastquarter'])
        sec_filings = row['secfilings']
        company_site = row['companysite']

        ticker_entity = Ticker.find_by_perma_id(self.session, perma_ticker_id)
        if ticker_entity is not None:
            ticker_entity.table_name = table_name
            ticker_entity.ticker = ticker
            ticker_entity.name = name
            ticker_entity.exchange = exchange
            ticker_entity.is_delisted = is_delisted
            ticker_entity.ticker_category = category
            ticker_entity.cusips = cusips
            ticker_entity.sic_sector = sic_sector_map
            ticker_entity.fama_sector = fama_sector_map
            ticker_entity.sector = sharadar_sector_map
            ticker_entity.market_cap_scale = market_cap_scale
            ticker_entity.revenue_scale = revenue_scale
            ticker_entity.related_tickers = related_tickers
            ticker_entity.currency = currency
            ticker_entity.location = location
            ticker_entity.last_updated = last_updated
            ticker_entity.first_added = first_added
            ticker_entity.first_price_date = first_price_date
            ticker_entity.last_price_date = last_price_date
            ticker_entity.first_quarter = first_quarter
            ticker_entity.last_quarter = last_quarter
            ticker_entity.secfilings = sec_filings
            ticker_entity.company_site = company_site
        else:
            # noinspection PyTypeChecker
            ticker_entity = Ticker(table_name=table_name,
                                   ticker=ticker,
                                   name=name,
                                   perma_ticker_id=perma_ticker_id,
                                   exchange=exchange,
                                   is_delisted=is_delisted,
                                   ticker_category=category,
                                   cusips=cusips,
                                   sic_sector=sic_sector_map,
                                   fama_sector=fama_sector_map,
                                   sector=sharadar_sector_map,
                                   market_cap_scale=market_cap_scale,
                                   revenue_scale=revenue_scale,
                                   related_tickers=related_tickers,
                                   currency=currency,
                                   location=location,
                                   last_updated=last_updated,
                                   first_added=first_added,
                                   first_price_date=first_price_date,
                                   last_price_date=last_price_date,
                                   first_quarter=first_quarter,
                                   last_quarter=last_quarter,
                                   secfilings=sec_filings,
                                   company_site=company_site)
        self.session.add(ticker_entity)
    def process_row(self, index, row):
        ticker_code = row['ticker']
        ticker = Ticker.find_by_ticker(self.session, ticker_code)
        filing_date = row['filingdate']

        form_type_code = row['formtype']
        form_type = FormType.get_or_create(self.session, form_type_code)

        issuer_name = row['issuername']
        owner_name = row['ownername']
        officer_title = row['officertitle']
        is_director = yes_no_to_bool(row['isdirector'])
        is_officer = yes_no_to_bool(row['isofficer'])
        is_ten_percent_owner = yes_no_to_bool(row['istenpercentowner'])
        transaction_date = clean_nulls(row['transactiondate'])

        security_ad_type_code = clean_nulls(row['securityadcode'])
        security_ad_type = SecurityAdType.get_or_create(
            self.session, security_ad_type_code)

        transaction_type_code = clean_nulls(row['transactioncode'])
        transaction_type = TransactionType.get_or_create(
            self.session, transaction_type_code)

        shares_owned_before_transaction = clean_nulls(
            row['sharesownedbeforetransaction'])
        transaction_shares = clean_nulls(row['transactionshares'])
        shares_owned_following_transaction = clean_nulls(
            row['sharesownedfollowingtransaction'])
        transaction_price_per_share = clean_nulls(
            row['transactionpricepershare'])
        transaction_value = clean_nulls(row['transactionvalue'])

        security_title_type_code = clean_nulls(row['securitytitle'])
        security_title_type = SecurityTitleType.get_or_create(
            self.session, security_title_type_code)

        direct_or_indirect = clean_nulls(row['directorindirect'])
        nature_of_ownership = clean_nulls(row['natureofownership'])
        date_exercisable = clean_nulls(row['dateexercisable'])
        price_exercisable = clean_nulls(row['priceexercisable'])
        expiration_date = clean_nulls(row['expirationdate'])
        row_num = row['rownum']

        holdings = InsiderHoldings.find(self.session, ticker_code, filing_date,
                                        owner_name, form_type, row_num)
        if holdings is None:
            holdings = InsiderHoldings(
                ticker_code=ticker_code,
                ticker=ticker,
                filing_date=filing_date,
                form_type=form_type,
                issuer_name=issuer_name,
                owner_name=owner_name,
                officer_title=officer_title,
                is_director=is_director,
                is_officer=is_officer,
                is_ten_percent_owner=is_ten_percent_owner,
                transaction_date=transaction_date,
                security_ad_type=security_ad_type,
                transaction_type=transaction_type,
                shares_owned_before_transaction=shares_owned_before_transaction,
                transaction_shares=transaction_shares,
                shares_owned_following_transaction=
                shares_owned_following_transaction,
                transaction_price_per_share=transaction_price_per_share,
                transaction_value=transaction_value,
                security_title_type=security_title_type,
                direct_or_indirect=direct_or_indirect,
                nature_of_ownership=nature_of_ownership,
                date_exercisable=date_exercisable,
                price_exercisable=price_exercisable,
                expiration_date=expiration_date,
                row_num=row_num)
        else:
            holdings.ticker = ticker
            holdings.issuer_name = issuer_name
            holdings.officer_title = officer_title
            holdings.is_director = is_director
            holdings.is_officer = is_officer
            holdings.is_ten_percent_owner = is_ten_percent_owner
            holdings.transaction_date = transaction_date
            holdings.shares_owned_before_transaction = shares_owned_before_transaction
            holdings.transaction_shares = transaction_shares
            holdings.shares_owned_following_transaction = shares_owned_following_transaction
            holdings.transaction_price_per_share = transaction_price_per_share
            holdings.transaction_value = transaction_value
            holdings.security_title_type = security_title_type
            holdings.direct_or_indirect = direct_or_indirect
            holdings.nature_of_ownership = nature_of_ownership
            holdings.date_exercisable = date_exercisable
            holdings.price_exercisable = price_exercisable
            holdings.expiration_date = expiration_date

        self.session.add(holdings)