예제 #1
0
def main():
    data = [20171020]
    instrumentid_array = ["rb1801"]
    for item in data:
        for instrumentid in instrumentid_array:
            path = "../kdata/" + instrumentid + '_' + str(item) + '.csv'
            data = bf.read_data_from_csv(path)
            start_create_config(instrumentid, data)
예제 #2
0
def main(filename):
    # path = "../create_data/"+filename+"_band_data.csv"
    path = "../tmp/" + filename + "_band_data.csv"
    # path = "../everydayoutdata/"+filename+"_band_data.csv"
    # path = "../zn/"+filename
    csv_data = bf.read_data_from_csv(path)
    path = "../outdata_one_hour/" + filename + "_trade_limit_time_volume.txt"
    file = open(path, "w")

    # 这个是螺纹钢的 tick 1
    param_dict = {
        "limit_rsi_data": 70,
        "band_profit_edge": 2,
        "limit_bar_volume_tick": 10,
        "limit_large_period": 5,
        "limit_multiple": 2,
        "file": file
    }
    if "rb" in filename:
        param_dict["volume_open_edge"] = 600
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 10
        param_dict["band_loss_edge"] = 5
        param_dict["max_loss"] = 10
        param_dict["max_profit"] = 30000
        param_dict["cross_middle_edge"] = 2
    elif "ru" in filename:
        param_dict["volume_open_edge"] = 20
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 50
        param_dict["band_loss_edge"] = 25
        param_dict["max_loss"] = 50
        param_dict["max_profit"] = 150
    elif "pb" in filename:
        param_dict["volume_open_edge"] = 20
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 50
        param_dict["band_loss_edge"] = 25
        param_dict["max_loss"] = 50
        param_dict["max_profit"] = 150
    elif "zn" in filename:
        param_dict["volume_open_edge"] = 20
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 50
        param_dict["band_loss_edge"] = 25
        param_dict["max_loss"] = 50
        param_dict["max_profit"] = 150
    elif "cu" in filename:
        param_dict["volume_open_edge"] = 40
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 100
        param_dict["band_loss_edge"] = 50
        param_dict["max_loss"] = 100
    elif "hc" in filename:
        param_dict["volume_open_edge"] = 400
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 0.5
        param_dict["band_loss_edge"] = 0.5
        param_dict["limit_sd"] = 4
        param_dict["open_interest_edge"] = 0
        param_dict["limit_sd_close_edge"] = 1
        param_dict["limit_sd_open_edge"] = 2
        param_dict["spread"] = 90
        param_dict["limit_wvad"] = 2000
    elif "i" in filename and "ni" not in filename:
        param_dict["volume_open_edge"] = 900
        param_dict["limit_sd"] = 4
        param_dict["open_interest_edge"] = 0
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 0.5
        param_dict["band_loss_edge"] = 0.5
        param_dict["limit_sd_close_edge"] = 1
        param_dict["limit_sd_open_edge"] = 2
        param_dict["spread"] = 100
        param_dict["limit_wvad"] = 5000
    elif "ni" in filename:
        param_dict["volume_open_edge"] = 200
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 100
        param_dict["band_loss_edge"] = 50
    elif "al" in filename:
        param_dict["volume_open_edge"] = 100
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 50
        param_dict["band_loss_edge"] = 25
        param_dict["max_loss"] = 50
    elif "au" in filename:
        param_dict["volume_open_edge"] = 20
        param_dict["limit_sd"] = 0.3
        param_dict["open_interest_edge"] = 0
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 0.5
        param_dict["band_loss_edge"] = 0.5
        param_dict["limit_sd_close_edge"] = 1
        param_dict["spread"] = 100
        param_dict["limit_wvad"] = 2000
    elif "ag" in filename:
        param_dict["volume_open_edge"] = 600
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 10
        param_dict["band_loss_edge"] = 5
        param_dict["max_loss"] = 10
        param_dict["max_profit"] = 30
    elif "j" in filename and "m" not in filename:
        param_dict["volume_open_edge"] = 100
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 5
        param_dict["band_loss_edge"] = 2.5
        param_dict["max_loss"] = 5
        param_dict["max_profit"] = 20
    elif "jm" in filename:
        param_dict["volume_open_edge"] = 100
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 5
        param_dict["band_loss_edge"] = 2.5
        param_dict["max_loss"] = 5
        param_dict["max_profit"] = 20
    elif "pp" in filename:
        param_dict["volume_open_edge"] = 80
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 10
        param_dict["band_loss_edge"] = 5
        param_dict["max_loss"] = 10
        param_dict["max_profit"] = 30
    elif "v" in filename:
        param_dict["volume_open_edge"] = 80
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 50
        param_dict["band_loss_edge"] = 25
        param_dict["max_loss"] = 25
        param_dict["max_profit"] = 100
    elif "y" in filename:
        param_dict["volume_open_edge"] = 100
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 20
        param_dict["band_loss_edge"] = 10
        param_dict["max_loss"] = 10
        param_dict["max_profit"] = 140
    elif "p" in filename and "pp" not in filename:
        param_dict["volume_open_edge"] = 100
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 20
        param_dict["band_loss_edge"] = 10
        param_dict["max_loss"] = 20
        param_dict["max_profit"] = 100
    elif "c1801" in filename:
        param_dict["volume_open_edge"] = 40
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 5
        param_dict["band_loss_edge"] = 3
        param_dict["max_loss"] = 5
        param_dict["max_profit"] = 30
    elif "a1801" in filename:
        param_dict["volume_open_edge"] = 40
        param_dict["band_open_edge1"] = 0
        param_dict["band_open_edge2"] = 10
        param_dict["band_loss_edge"] = 3
        param_dict["max_loss"] = 5
        param_dict["max_profit"] = 30
    else:
        print "the instrument is not in the parm " + filename
        return
    create_band_obj(csv_data, param_dict)
    file.close()