<jupyter_start><jupyter_text>1、获取股票行情<jupyter_code>#股票日线行情
df = ts.bar('600000', conn=cons, freq='D', start_date='2016-01-01', end_date='')
df.head(5)<jupyter_output><empty_output><jupyter_text>2、股票因子数据<jupyter_code>#带因子的行情
df = ts.bar('600000', conn=cons, start_date='2016-01-01', end_date='', ma=[5, 10, 20], factors=['vr', 'tor'])
df.head(5)<jupyter_output><empty_output><jupyter_text>3、复权数据<jupyter_code>#复权行情, adj=qfq(前复权)， hfq（后复权），默认None不复权
df = ts.bar('600000', conn=cons, adj='qfq', start_date='2016-01-01', end_date='')
df.head(5)<jupyter_output><empty_output><jupyter_text>4、分钟和其它频度数据<jupyter_code>#分钟数据, 设置freq参数，分别为1min/5min/15min/30min/60min，D(日)/W(周)/M(月)/Q(季)/Y(年)
df = ts.bar('600000', conn=cons, freq='1min', start_date='2016-01-01', end_date='')
df.head(15)<jupyter_output><empty_output><jupyter_text>指数行情<jupyter_code>#指数日行情, 设置asset='INDEX'
df = ts.bar('000300', conn=cons, asset='INDEX', start_date='2016-01-01', end_date='')
df.head(5)<jupyter_output><empty_output><jupyter_text>5、港股数据<jupyter_code>#港股数据, 设置asset='X'
df = ts.bar('00981', conn=cons, asset='X', start_date='2016-01-01', end_date='')
df.head(5)<jupyter_output><empty_output><jupyter_text>6、期货数据<jupyter_code>#期货数据, 设置asset='X'
df = ts.bar('CU1801', conn=cons, asset='X', start_date='2016-01-01', end_date='')
df.head(5)<jupyter_output><empty_output><jupyter_text>7、美股数据<jupyter_code>#美股数据, 设置asset='X'
df = ts.bar('BABA', conn=cons, asset='X', start_date='2016-01-01', end_date='')
df.head(5)<jupyter_output><empty_output><jupyter_text>8,股票tick<jupyter_code>#股票tick,type:买卖方向，0-买入 1-卖出 2-集合竞价成交
df = ts.tick('600000', conn=cons, date='2017-10-26')
df.head(20)<jupyter_output><empty_output><jupyter_text>9,期货tick<jupyter_code>#期货tick,type:买卖方向，0:开仓  1:多开   -1:空开
df = ts.tick('CU1801', conn=cons, asset='X', date='2017-10-25')
df.head(20)<jupyter_output><empty_output><jupyter_text>沪深港通资金流向<jupyter_code>#沪/深港通每日资金流向(南向/北向资金)
df = ts.moneyflow_hsgt()
df.sort_values('date', ascending=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21524663677130046, 'fraction_numerical': 0.08520179372197309, 'mean_word_length': 11.789808917197453, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '169473', 'license': 'Apache-2.0', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1074, 'n_words': 87, 'path': 'ts/tushare_new.ipynb', 'repo_name': 'jt120/start-ml', 'size': '2007'}