コード例 #1
0
ファイル: start_test.py プロジェクト: fswzb/pytrade
def test_merge():
    symToTa = start.get_all_from(
        os.path.join(local_path, 'start_test.dir', 'ta'))
    df = start.merge(symToTa, '2016-05-02', '2016-05-28')
    assert (40, 82) == df.shape
    df = start.merge(symToTa, '2016-05-03', '2016-05-28')
    assert (38, 82) == df.shape
    df = start.merge(symToTa, '2016-05-02', '2016-05-27')
    assert (40, 82) == df.shape
    df = start.merge(symToTa, '2016-05-02', '2016-05-26')
    assert (38, 82) == df.shape
コード例 #2
0
ファイル: start_test.py プロジェクト: fswzb/pytrade
def test_pred():
    symToTa = start.get_all_from(
        os.path.join(local_path, 'start_test.dir', 'ta'))
    df = start.merge(symToTa, '2016-05-02', '2016-05-28')
    lLabel = [x for x in df.columns if x.startswith('label')]
    for sym in symToTa:
        for each in lLabel[4:]:
            del symToTa[sym][each]
    df = start.pred(symToTa, 3, {}, '2016-01-01', '2016-12-31', '2016-05-27')
    assert (2, 77) == df.shape
コード例 #3
0
ファイル: start_test.py プロジェクト: fswzb/pytrade
def test_build_trains2():
    symToTa = start.get_all_from(
        os.path.join(local_path, 'start_test.dir', 'ta'))
    df = start.merge(symToTa, '2016-05-02', '2016-05-28')
    lLabel = [x for x in df.columns if x.startswith('label')]
    for sym in symToTa:
        for each in lLabel[4:]:
            del symToTa[sym][each]
    df = start.build_trains(symToTa, '2016-05-02', '2016-05-27')
    assert (32, 80) == df.shape
コード例 #4
0
ファイル: start_test.py プロジェクト: fswzb/pytrade
def test_train():
    symToTa = start.get_all_from(
        os.path.join(local_path, 'start_test.dir', 'ta'))
    df = start.merge(symToTa, '2016-05-02', '2016-05-28')
    lLabel = [x for x in df.columns if x.startswith('label')]
    for sym in symToTa:
        for each in lLabel[4:]:
            del symToTa[sym][each]
    #npLabel = df.loc[:,start.get_label_name(df,3)].values.copy()
    #npLabel[npLabel != 1.0]
    #npLabel[npLabel >  1.0] = 1
    #npLabel[npLabel <  1.0] = 0
    #print npLabel
    #assert False
    df = start.train2(symToTa, 3, {}, '2016-01-01', '2016-12-31', '2016-01-01',
                      '2016-12-31')
    assert (32, 81) == df.shape
コード例 #5
0
ファイル: start_test.py プロジェクト: fswzb/pytrade
def test_get_feat_names():
    symToTa = start.get_all_from(
        os.path.join(local_path, 'start_test.dir', 'ta'))
    df = start.merge(symToTa, '2016-05-02', '2016-05-28')
    assert 70 == len(start.get_feat_names(df))