Пример #1
0
def test_transaction():
    engine = Engine(best_ip=True, thread_num=1)
    with engine.connect():
        df = engine.get_k_data('000001', '20170601', '20171231', '1m')

        df = engine.get_security_bars(['000001', '000521'],
                                      '1d',
                                      start=pd.to_datetime('20180102'))
Пример #2
0
def main():
    engine = Engine(best_ip=True, thread_num=1)
    with engine.connect():
        engine.get_k_data('000001', '20161201', '20171231', '1m')
Пример #3
0
def main():
    engine = Engine(best_ip=True, thread_num=1)
    with engine.connect():
        engine.get_k_data('000001', '20161201', '20171231', '1m')


def test_transaction():
    engine = Engine(best_ip=True, thread_num=1)
    with engine.connect():
        df = engine.get_k_data('000001', '20170601', '20171231', '1m')

        df = engine.get_security_bars(['000001', '000521'],
                                      '1d',
                                      start=pd.to_datetime('20180102'))


if __name__ == '__main__':
    engine = Engine(best_ip=True, thread_num=1)
    with engine.connect():
        print(engine.api.get_security_count(0))
        print(engine.api.get_security_count(1))
        lists = engine.stock_list
        print(
            engine.get_security_bars('300737', '1d',
                                     pd.to_datetime('20161201'),
                                     pd.to_datetime('20171231')))
        print(engine.get_k_data('300737', '20161201', '20171231', '1d'))
    print(timeit.timeit(test_transaction, number=1))
    print(timeit.timeit(main, number=1))
Пример #4
0
def transactions():
    eg = Engine(best_ip=True, auto_retry=True)
    eg.connect()
    m1 = eg.get_k_data('000001', '20170101', '20180101', '1m')
Пример #5
0
def main():
    logbook.StderrHandler().push_application()
    engine = Engine(best_ip=True, thread_num=1)
    with engine.connect():
        engine.get_k_data('000002', '20100921', '20100930', '1m')
Пример #6
0
        # print(fs)

    print((datetime.datetime.now() - now).total_seconds())


def test_quotes():
    start_dt = datetime.datetime.now()
    quote = engine.stock_quotes()
    print(datetime.datetime.now() - start_dt).total_seconds()
    process_quotes(quote)


if __name__ == '__main__':
    engine = Engine(auto_retry=True, multithread=True, thread_num=8)
    with engine.connect():

        start = '20171001'
        end = '20171010'
        code = '000001'
        time = datetime.datetime.now()
        print(engine.get_k_data(code, start, end, "1min"))
        print((datetime.datetime.now() - time).total_seconds())

        # with click.progressbar(timestamp2int(sessions),
        #                        item_show_func=lambda e: e if e is None else str(e[0])
        #                        ) as date:
        #     print(engine.get_transaction('000001', date))

        # test_quotes()
        # print(engine.get_security_bars('513500','1d'))