Example #1
0
            risk = pf_src[0][0]
            weight = pf_src[0][1]
            print "risk:", risk, "weight:", weight
            if bt.strategy == 'avg':
                weight = []
                for j in range(len(stock_pool)):
                    weight.append(1.0 / len(stock_pool))
            print weight
            Filter.filter_main(portfolio_pool, date_seq[i], date_seq[i - 1],
                               weight)
            print "date_seq[i],date_seq[i-1],weight", date_seq[i], date_seq[
                i - 1], weight
        else:
            print "not 5 days"
            Filter.filter_main([], date_seq[i], date_seq[i - 1], [])
            cap_update_ans = cap_update.cap_update_daily(date_seq[i])
        print('Runnig to Date :  ' + str(date_seq[i]))
        # aa=raw_input('wait...')
    print('ALL FINISHED!!')

    sharp, c_std = get_sharp_rate()
    print('Sharp Rate : ' + str(sharp))
    print('Risk Factor : ' + str(c_std))

    sql_show_btc = "select * from stock_index a where a.stock_code = 'sh' and a.state_dt >= '%s' and a.state_dt <= '%s' order by state_dt asc" % (
        date_seq_start, date_seq_end)
    cursor.execute(sql_show_btc)
    done_set_show_btc = cursor.fetchall()
    #btc_x = [x[0] for x in done_set_show_btc]
    btc_x = list(range(len(done_set_show_btc)))
    # print btc_x,done_set_show_btc[0][3]
Example #2
0
def update_only(aday, pre_day):
    Filter.filter_main([], aday, pre_day, [])
    cap_update_ans = cap_update.cap_update_daily(aday)