Exemplo n.º 1
0
def show_good_meigaras(datestr, show_cnt=10, search_cnt=1000, trade_mode="BOTH", max_price=10000):
    meigaras = kf.get_goodmeigaras(datestr=datestr, cnt=search_cnt, high_vol_first=True, maxprice=max_price)
    
    s = Simulator3(meigaras, trade_mode)
    s.set_date(datestr, True)
    traders = s.choose(choose_cnt=show_cnt)
    meigarad = {}
    if traders is not None and len(traders) > 0:
        for trader in traders:
            meigarad[trader.get_code()] = [trader.get_forecasted_trade_mode(), trader.get_desc()]
    return meigarad
Exemplo n.º 2
0
def get_meigaras(cnt, datestr, diagdays=20):
    json = f.get_json_data("ml_train_tf")
    must_meigaras = json["must_meigaras"]
    
    meigaras = kf.get_goodmeigaras(datestr=datestr, cnt=cnt, diagdays=diagdays)
    for m_code in must_meigaras:
        include_flg = False
        for code in meigaras:
            if str(code) == str(m_code):
                include_flg = True
                break
        if include_flg == False:
            meigaras.append(m_code)
    
    return meigaras
Exemplo n.º 3
0
def simulate(dates):
    dates.sort()
    for i in range(1, len(dates)):
        startd = dates[i-1]
        endd = dates[i]
        files = glob.glob("%s/20*" % PNFCKPT_DIR)
        files.sort()
        ckptdir = ""
        for f in reversed(files):
            if os.path.isdir(f):
                foldername = f.split("/")[-1]
                if startd >= foldername:
                    ckptdir = foldername
                    break
        if ckptdir == "":
            f.log("No learned data")
            exit(1)
        
        meigaras = kf.get_goodmeigaras(endd, 20)
        s = Simulator3(meigaras, "BOTH", "%s.log" % ckptdir, ckptdir)
        s.simulate(startd, endd)
        s = None
Exemplo n.º 4
0
'''
Created on 2016/04/09

@author: kot
'''
from engines.kabuka_lines import *
from engines.simulator3 import *
import actions.gen_pf_line as gpl
import lib.common_funcs as f
import lib.kabuka_funcs as kf


if __name__ == '__main__':
    f.log("Starting report")
    #meigaras = kf.get_rndmeigaras(100)
    meigaras = kf.get_goodmeigaras(datestr="20160301", cnt=100, maxprice=2500, high_vol_first=True)
    
    #meigaras = [6502, 3148]
    #meigaras = ['1928']
    #meigaras=["9984"]
    #meigaras=[]
    #meigaras=["6473"]
    #for i in range(len(meigaras)):
    #    meigaras[i] = str(meigaras[i])
    
    #gpl.gen_pf_line("20110101", "20160201", meigaras)
    
    s = Simulator3(meigaras, "BOTH")
    s.simulate()