コード例 #1
0
def write_log(res, C_market, data, t):

    summary = {'t': pd.to_datetime(t).date(),
               'mape': mape(C_market, data['CMerton_opt']),
               'sigma': res.x[0],
               'm': res.x[1],
               'v': res.x[2],
               'lam': res.x[3],
               'success': res.success}

    with open('Out/log_Merton.csv', 'a') as f:
        pd.DataFrame(summary, index=[0]).to_csv(f, header=f.tell() == 0, index=False)
コード例 #2
0
def write_log(res, C_market, data, t):
    summary = {
        't': pd.to_datetime(t).date(),
        'mape': mape(C_market, data['fHes_opt']),
        'sigma_0': res.x[0],
        'k': res.x[1],
        'theta': res.x[2],
        'nu': res.x[3],
        'rho': res.x[4],
        'success': res.success,
        'feller': feller(res.x)
    }
    # feller
    with open('Out/log_Heston.csv', 'a') as f:
        pd.DataFrame(summary, index=[0]).to_csv(f,
                                                header=f.tell() == 0,
                                                index=False)
コード例 #3
0
def Merton_obj_function(params, index_price, strike, tt, irate, C_market, weights):
    return mape(merton_jump_call(params, index_price, strike, tt, irate), C_market)
コード例 #4
0
def fHes_mape(params, index_price, strike, tt, irate, C_market, weights):
    return mape(C_market, fHes(params, index_price, strike, tt, irate))
コード例 #5
0
def CHeston_mape(params, index_price, strike, tt, irate, C_market, weights):
    return mape(C_market, C_Heston(params, index_price, strike, tt, irate))