コード例 #1
0
ファイル: backtest.py プロジェクト: xiebing77/xquant
def sub_cmd_chart_diff(args):
    print(args.siis)
    print(len(args.siis))
    siis = args.siis
    if len(siis) != 2:
        exit(1)

    instance_a = get_instance(siis[0])
    instance_b = get_instance(siis[1])
    if instance_a['sc'] != instance_b['sc']:
        print(instance_a['sc'])
        print(instance_b['sc'])
        exit(1)

    start_time = min(instance_a['start_time'], instance_b['start_time'])
    end_time = max(instance_a['end_time'], instance_b['end_time'])
    orders_a = instance_a['orders']
    orders_b = instance_b['orders']

    md = DBMD(instance_a['mds'])
    md.tick_time = end_time

    config = xq.get_strategy_config(instance_a['sc'])
    symbol = config["symbol"]
    interval = config["kline"]["interval"]
    title = symbol + '  ' + config['kline']['interval'] + ' ' + config[
        'class_name']

    ordersets = []
    ordersets.append(orders_a)
    ordersets.append(orders_b)

    chart(title, md, symbol, interval, start_time, end_time, ordersets, args)
コード例 #2
0
ファイル: backtest.py プロジェクト: leezizi/xquant
def sub_cmd_chart(args):
    instance_id = args.sii
    instance = get_instance(instance_id)

    start_time = instance['start_time']
    end_time = instance['end_time']
    orders = instance['orders']

    md = DBMD(instance['mds'])
    md.tick_time = end_time

    config = xq.get_strategy_config(instance['sc'])
    symbol = config["symbol"]
    interval = config["kline"]["interval"]
    title = symbol + '  ' + config['kline']['interval'] + ' ' + config['class_name']

    ordersets = []
    ordersets.append(orders)

    chart(title, md, symbol, interval, start_time, end_time, ordersets, args)
コード例 #3
0
ファイル: show.py プロジェクト: ydx2099/xquant
                        help='exchange')
    parser.add_argument('-s', help='symbol (btc_usdt)')
    parser.add_argument('-i', help='interval')
    parser.add_argument('-r', help='time range')
    parser.add_argument('-di',
                        help='display indicators,egg: macd,kdj,MACD,KDJ,RSI')

    add_argument_overlap_studies(parser)

    args = parser.parse_args()
    # print(args)

    if not (args.r and args.i and args.s and args.di and args.e):
        parser.print_help()
        exit(1)

    interval = args.i
    start_time, end_time = ts.parse_date_range(args.r)
    display_count = int((end_time - start_time).total_seconds() /
                        xq.get_interval_seconds(interval))
    print("display_count: %s" % display_count)

    md = DBMD(args.e)
    md.tick_time = datetime.now()
    pre_count = 150
    klines = md.get_klines(args.s, interval, pre_count + display_count,
                           start_time - xq.get_timedelta(interval, pre_count))

    show(args, klines, md.kline_column_names, display_count,
         ts.parse_ic_keys(args.di))