Exemplo n.º 1
0
def _set_month_id_and_class_id(mapper, connection, target):
    log.debug("setting month_id and class_id on OCVolCurve: symbol=%s expiration_date=%s",
              target.expiry.portfolio_symbol.symbol.symbol, target.expiry.expiration_date)
    session = get_session_from_connection(connection)
    expiration_date = target.expiry.expiration_date
    symbol_id = target.expiry.portfolio_symbol.symbol_id
    ocia =\
        session\
            .query(OCInstrument)\
            .join(Option)\
            .filter(Option.symbol_id == symbol_id)\
            .filter(Option.expiration_date == expiration_date)\
            .first()
    target.class_id = ocia.oc_class_id
    target.month_id = ocia.oc_month_id
def handle_vol_curve_input_record_insert(mapper, connection, target):
    log.debug("updating vol_curve timestamp on vol_curve_input insert: vol_curve_input=%s", target)
    session = get_session_from_connection(connection)
    vol_curve = session.query(VolCurve).get(target.vol_curve_input.vol_curve_id)
    vol_curve.time_stamp = target.time_stamp
    session.commit()
def prepopulate_vol_models(target, connection, **kw):
    session = get_session_from_connection(connection)
    vol_model = VolModel(name="OCFlexibleSpline")
    session.add(vol_model)
    session.commit()