Example #1
0
def compare_4000_history_value(index_value,
                               days=select_field('content', 's_content',
                                                 {'id': 2})):
    sql = "select yesterday_end from shanghai_index order by update_time desc limit %s;" % str(
        days)
    r = selects(sql)
    print("yesterday_end: " + str(r))
    flag = True
    for dic in r:
        if index_value < float(dic['yesterday_end']):
            flag = False
    # 如果一天内猛涨120点
    if index_value - float(r[0]['yesterday_end']) >= 120:
        flag = True
    # 如果两天内猛涨200点
    if index_value - float(r[0]['yesterday_end']) >= 200:
        flag = True
    print("compare_4000_history_value Flag: " + str(flag))
    return flag
Example #2
0
def compare_3000_history_value(index_value,
                               days=select_field('content', 's_content',
                                                 {'id': 2})):
    offset = float(select_field('content', 's_content', {'id': 4}))
    sql = "select yesterday_end from shanghai_index order by update_time desc limit %s;" % str(
        days)
    r = selects(sql)
    print("yesterday_end: " + str(r))
    flag = True
    if (index_value - offset) > float(r[0]['yesterday_end']):
        flag = False
    else:
        for dic in r:
            if index_value > float(dic['yesterday_end']):
                flag = False
    # 如果一天内猛跌70点
    if float(r[0]['yesterday_end']) - index_value >= 70:
        flag = True
    # 如果两天内猛跌120点
    if float(r[1]['yesterday_end']) - index_value >= 120:
        flag = True
    print("compare_3000_history_value Flag: " + str(flag))
    return flag
Example #3
0
def select_managers():
    fund_sql = "select f.code_id,f.name as name,m.name as manager_name from fund_info f,fund_manager m where f.manager_id=m.id and f.useful='1';"
    stock_sql = "select s.code_id,s.name as name,m.name as manager_name from stock_info s,fund_manager m where s.manager_id=m.id and s.useful='1';"
    return selects(fund_sql) + selects(stock_sql)
Example #4
0
def get_update_funds_list():
    sql = "select * from fund_info where useful = '9';"
    return selects(sql)
Example #5
0
def get_funds_list():
    sql = "select * from fund_info where worth_to_buy is not null;"
    return selects(sql)
Example #6
0
def main2():
    '''
    每日估算净值监控
    '''
    res = selects(
        "select code_id, name from fund_info where worth is not null")
Example #7
0
def get_avg_index_last_days(days):
    sql = "select avg(y.yesterday_end) AVG,max(y.yesterday_end) MAX,min(y.yesterday_end) MIN from (select yesterday_end from shanghai_index order by update_time desc limit {days}) as y;".format(
        days=days)
    res = selects(sql)
    return res[0]
Example #8
0
def select_my_fund(mode='fund'):
    sql = "select * from {mode}_info where useful = '2';".format(mode=mode)
    return selects(sql)
Example #9
0
def select_fund_seek_bank(mode='fund'):
    sql = "select * from {mode}_info where useful >= '1';".format(mode=mode)
    return selects(sql)