Comments (8)
def QA_fetch_get_stock_list(type_='stock', ip=best_ip, port=7709):
api = TdxHq_API()
with api.connect(ip, port):
data = pd.concat([pd.concat([api.to_df(api.get_security_list(j, i * 1000)).assign(sse='sz' if j == 0 else 'sh').set_index(
['code', 'sse'], drop=False) for i in range(int(api.get_security_count(j) / 1000) + 1)], axis=0) for j in range(2)], axis=0)
if type_ in ['stock', 'gp']:
return pd.concat([data[data['sse'] == 'sz'][data.assign(code=data['code'].apply(lambda x: int(x)))['code'] // 10000 <= 30][data.assign(code=data['code'].apply(lambda x: int(x)))['code'] // 100000 != 2],
data[data['sse'] == 'sh'][data.assign(code=data['code'].apply(lambda x: int(x)))['code'] // 100000 == 6]]).assign(code=data['code'].apply(lambda x: str(x)))
elif type_ in ['index', 'zs']:
return pd.concat([data[data['sse'] == 'sz'][data.assign(code=data['code'].apply(lambda x: int(x)))['code'] // 1000 >= 399],
data[data['sse'] == 'sh'][data.assign(code=data['code'].apply(lambda x: int(x)))['code'] // 1000 == 0]]).assign(code=data['code'].apply(lambda x: str(x)))
else:
return data.assign(code=data['code'].apply(lambda x: str(x)))
from pytdx.
上面的图漏了一些。对,000系列的还有上海指数,但是指数是不交易的,因为我的这个表格是主要针对可交易品种的。
from pytdx.
除了股票之外,目前还支持基金,债券等类别,不知道是不是会判断错误..
from pytdx.
这个应该是准确的,上面那个的话,大部分股票是没问题的,我再修改一下吧
from pytdx.
应该不止吧 上海的000系列 是指数 @JaysonAlbert @rainx
from pytdx.
我在回测框架里面存的时候 就存了股票和指数哈哈 你这个表格不错
from pytdx.
那就再加一个判断,如果是指数的话,而且是000开头就是上海的 @yutiansut @rainx
from pytdx.
我的判断代码写在上面了#50 (comment) @JaysonAlbert
from pytdx.
Related Issues (20)
- 扩展行情的IP都没有可以连接的。 HOT 1
- 扩展行情里面有没有可以获取多个行情quotes的接口?
- get_security_list 请问一下这个是用来获取股票列表的吗? HOT 2
- 请教一下下载的财务数据的 315个列字段的意义问题. HOT 1
- get_security_list这个函数的pre_close有误 HOT 10
- get_security_bars取出来的vol值差了1个 HOT 4
- 跳过的4个字节估计是上一日收盘价
- get_security_list获取的数据中的pre_close有解析正确有些解析不正确 HOT 1
- 不支持美股了?
- AttributeError: __enter__
- 怎么获取行情服务器的IP HOT 1
- 官方文档代码某行缺失 HOT 1
- 请问有办法获取涨停价和跌停价吗 HOT 1
- 可以获取level2的逐笔成交明细吗? HOT 1
- 心跳包还有多线程有没有详细的文档解释? HOT 1
- TdxDailyBarReader() 读取 上海 688 的时候,异常 Unknown security type ! HOT 1
- 盘口价格是不是颠倒了 HOT 1
- exhq.py文件 运行报错 AttributeError: __enter__
- debian python 3.7 get_security_quotes 解析 servertime 报错 HOT 2
- 如何判断股票代码是否指数
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytdx.