Beispiel #1
0
md.init('*****@*****.**', '123456')
# 提取tick数据
r = md.get_ticks(
    'SHSE.600000',
    '2016-01-04 09:00:00',
    '2016-01-04 12:00:00',
)
print('get_ticks: ', len(r))

#提取tick快照
r = md.get_last_ticks('SHSE.600000')
print('get_last_ticks: ', len(r))

#提取最新N笔tick数据
r = md.get_last_n_ticks(
    'SHSE.600000', 10)
print('get_last_n_ticks(10): ', len(r))

#提起一分钟分时数据(freq=60 seconds)
r = md.get_bars(
    'SHSE.600000',
    60,
    '2015-12-01 09:30:00',
    '2015-12-10 09:31:00',
)
print('get_bars: ', len(r))

#提取bar快照
r = md.get_last_bars('SHSE.600000,', 60)
print('get_last_bars: ', len(r))
Beispiel #2
0
def get_last_n_ticks(symbol, n):
    end_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    var = md.get_last_n_ticks(symbol, n, end_time)
    ret = tick_topd(var,'date')
    return ret
from gmsdk import md

md.init('*****@*****.**', '123456')

r = md.get_ticks(
    'CFFEX.IF1512,CFFEX.IF1512',
    '2015-03-19 11:29:00',
    '2015-03-19 12:00:00',
)
print('get_ticks: ', len(r))

r = md.get_last_ticks('CFFEX.IF1512,')
print('get_last_ticks: ', len(r))

r = md.get_last_n_ticks(
    'CFFEX.IF1512', 10)
print('get_last_n_ticks(10): ', len(r))

r = md.get_bars(
    'CFFEX.IF1512',
    60,
    '2015-05-01 09:30:00',
    '2015-05-10 09:31:00',
)
print('get_bars: ', len(r))

r = md.get_last_bars('CFFEX.IF1512,', 60)
print('get_last_bars: ', len(r))

r = md.get_last_n_bars(
    'CFFEX.IF1512',
Beispiel #4
0
def get_last_n_ticks(symbol, n):
    end_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    var = md.get_last_n_ticks(symbol, n, end_time)
    ret = tick_topd(var, 'date')
    return ret