示例#1
0
def _refresh_signals(x):
    _d_comb, _d_sig = x
    # generate the signals (type 1)
    comb_prices = _d_comb.retrieve('Close')
    for j in range(1, 51):
        comb_ret_qr = comb_prices.copy()
        comb_ret_lr = comb_prices.copy()
        for i in comb_ret_lr.tick_cols():
            comb_ret_qr[i] = crtf.qrbeta(comb_ret_qr[i].values, j*10)
            comb_ret_lr[i] = crtf.lrbeta(comb_ret_lr[i].values, j*10)
        _d_sig.store('QrB_'+str(j*10)+'D', comb_ret_qr)
        _d_sig.store('LrB_'+str(j*10)+'D', comb_ret_lr)
        del comb_ret_lr
        del comb_ret_qr

    # generate the signals (type 2)
    comb_ret = _d_comb.retrieve('Returns')
    for j in range(1, 51):
        comb_ret_lr = comb_ret.copy()
        comb_ret_qr = comb_ret.copy()
        for i in comb_ret_lr.tick_cols():
            comb_ret_qr[i] = crtf.lrma(crtf.lrma(crtf.qrma(comb_ret_qr[i].values, j*10), 5), 5)
            comb_ret_lr[i] = crtf.lrma(crtf.lrma(crtf.lrma(comb_ret_qr[i].values, j*10), 5), 5)
        _d_sig.store('QrS_'+str(j*10)+'D', comb_ret_qr)
        _d_sig.store('LrS_'+str(j*10)+'D', comb_ret_lr)
        del comb_ret_lr
        del comb_ret_qr
    return None
示例#2
0
def _qrma_multi(x, n1, n2):
    for j in range(0, n2):
        x = crtf.qrma(x, n1)
    return x
示例#3
0
    cnt4 = 0
    cnt5 = 0
    cnt6 = 0
    cnt7 = 0
    fvol = chk_vol2

    for i in test_.tick_cols():
        # i = test_.tick_cols()[0]
        test = test_[i].values
        testo = testo_[i].values
        testh = testh_[i].values
        testl = testl_[i].values
        testr = crtf.ret(test)

        test1pb = crtf.vol_pb(testo, testh, testl, test, n, zl=True)
        test2pb = crtf.qrma(test1pb, 3)
        test3pb = crtf.qrma(crtf.qrma(test1pb, 3), 3)
        test4pb = crtf.qrma(crtf.qrma(crtf.qrma(test1pb, 3), 3), 3)
        test5pb = crtf.qrma(crtf.qrma(crtf.qrma(crtf.qrma(test1pb, 3), 3), 3), 3)
        test6pb = crtf.qrma(crtf.qrma(crtf.qrma(crtf.qrma(crtf.qrma(test1pb, 3), 3), 3), 3), 3)
        test7pb = crtf.qrma(crtf.qrma(crtf.qrma(crtf.qrma(crtf.qrma(crtf.qrma(test1pb, 3), 3), 3), 3), 3), 3)
        tmp = fvol(testr, test1pb)
        if not np.isnan(tmp):
            res1pb += tmp
            cnt1 += 1
        tmp = fvol(testr, test2pb)
        if not np.isnan(tmp):
            res2pb += tmp
            cnt2 += 1
        tmp = fvol(testr, test3pb)
        if not np.isnan(tmp):