Git Product home page Git Product logo

Comments (17)

yutiansut avatar yutiansut commented on July 23, 2024

这么做的原因很简单,改变指针的位置

分别是

0-799

800-1599

1600-2399

....

依次

然后需要注意的是 0代表的是今天的指针 ,所以 指针获取方式要翻过来写
首先是 7200-7999的数据

最后才是0-799的数据

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

基本上 日线级别 8000条足够覆盖了

分钟线,小时线要长一点

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

封装成函数

from pytdx.hq import  TdxHq_API
api=TdxHq_API()


def get_all_day_data():
   with api.connect():
        data=[]

        for i in range(10):
              data+=api.get_security_bars(9,0,'000001',(9-i)*800,800)
    print(api.to_df(data))

from pytdx.

rainx avatar rainx commented on July 23, 2024

nice, 我后面把它整理到文档里,作为FAQ的一部分 :P

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

@rainx 这里有个问题 因为tdx的官网的最大显示就是24000条 所以1min和5min数据 最多只能取24000条左右 这个没法再多了 其他的没啥影响

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

我代码写在我自己的quantaxis里面了 https://github.com/yutiansut/QUANTAXIS/blob/0.4.0-beta/QUANTAXIS/QASU/save_tdx.py

from pytdx.

rainx avatar rainx commented on July 23, 2024

@yutiansut 是的,条数是有限制的,我们现在有个程序,每天盘后把分钟线保存起来 :)

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

@rainx 挖 我在维护一个datatools 来自动化维护数据 包括tushare,tdx,同花顺这些 尽量自动化清洗掉 然后做成Damon 前面用quantaxis_web可视化清洗进程和任务

from pytdx.

rainx avatar rainx commented on July 23, 2024

@yutiansut 期待啊...

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

#27

from pytdx.

lipq525 avatar lipq525 commented on July 23, 2024

这个能获取香港市场上的分钟线数据否?

from pytdx.

user20171001 avatar user20171001 commented on July 23, 2024

start=0
while True:
    part=api.get_security_bars(9,0,'000001',start,800)
    if len(part)<800:
          break
    start +=800
    data+=part

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

没必要 因为已知最大20800条 直接写循环的次数就行了

from pytdx.

haohello avatar haohello commented on July 23, 2024

@yutiansut @rainx 这个语句遇到没有数据的情况,就会报错的。
data+=api.get_security_bars(9,0,'000001',(9-i)*800,800)
TypeError: 'NoneType' object is not iterable

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024
try:
  .......
except TypeError:
   pass

@haohello

from pytdx.

haohello avatar haohello commented on July 23, 2024

@yutiansut 这样子的话岂不是一大堆的数据就会给丢掉了

from pytdx.

yutiansut avatar yutiansut commented on July 23, 2024

@haohello 我就是告诉你这种处理的方法...你不要写pass 重试不就好了....

from pytdx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.