The fundamentals database provides ev_to_ebitda. It also provides enterprise_value and ebitda, so I tried calculating the values as enterprise_value/ebitda. These to values seem to differ. Is my understanding of ev_to_ebitda wrong? if not why the deviation.
Demo code to reproduce what i am seeing below
Sarvi
def initialize(context):
context.stock = sid(8554)
def before_trading_start(context):
"""
Called before the start of each trading day.
It updates our universe with the
securities and values found from fetch_fundamentals.
"""
stock_df = get_fundamentals(
query(
# put your query in here by typing "fundamentals."
fundamentals.share_class_reference.symbol,
fundamentals.income_statement.ebit,
fundamentals.income_statement.ebitda,
fundamentals.valuation_ratios.ev_to_ebitda,
fundamentals.operation_ratios.roic,
fundamentals.valuation.enterprise_value,
)
.filter(fundamentals.share_class_reference.symbol=='MSFT')
.filter(fundamentals.valuation.shares_outstanding != None)
.filter(fundamentals.valuation.enterprise_value != None)
.filter(fundamentals.income_statement.ebit != None)
.filter(fundamentals.income_statement.ebitda != None)
.filter(fundamentals.valuation_ratios.ev_to_ebitda !=None)
# .filter(fundamentals.operation_ratios.roic > 0.0)
)
record(ev_to_ebitda=stock_df[symbol('MSFT')]['ev_to_ebitda'],
ev_to_ebitda2=stock_df[symbol('MSFT')]['enterprise_value']/stock_df[symbol('MSFT')]['ebitda'])
# Will be called on every trade event for the securities you specify.
def handle_data(context, data):
order(context.stock,10)