Git Product home page Git Product logo

jqdatasdk's People

Contributors

baiqianyi avatar buaawcy avatar gabrielvon avatar joinquant-czw avatar joinquanter avatar kuanghy avatar ldsink avatar shenxin2022 avatar sunzhy avatar vhysug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jqdatasdk's Issues

numpy: cannot import name 'get_all_securities' from 'jqdatasdk'

调用接口get_all_securities 时
Traceback (most recent call last):
File "D:/workspace/tanliang/temp1/stock_singal/main.py", line 2, in
from jqdatasdk import auth
File "D:\workspace\tanliang\stock_singal\venv\lib\site-packages\jqdatasdk_init_.py", line 6, in
from .api import *
File "D:\workspace\tanliang\stock_singal\venv\lib\site-packages\jqdatasdk\api.py", line 5, in
from .utils import *
File "D:\workspace\tanliang\stock_singal\venv\lib\site-packages\jqdatasdk\utils.py", line 9, in
import pandas as pd
File "D:\workspace\tanliang\stock_singal\venv\lib\site-packages\pandas_init_.py", line 17, in
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: cannot import name 'get_all_securities' from 'jqdatasdk' (D:\workspace\tanliang\stock_singal\venv\lib\site-packages\jqdatasdk_init_.py)

Different API functions return the same data in different ways

get_money_flow, when given a list of tickers, will return a table like this:

image

get_price will return a table like this:

image

and get_current_tick will return a table like this:

image

So here we have 3 different functions returning data in 3 different ways. The first two change the names of the columns, and the third puts the stock tickers as the index to the returned dataframe, and again changes the name of the date column.

This makes it very difficult for a developer to use!

Could you please choose a consistent way to refer to dates/datetimes and stock tickers?

使用 jqdatasdk 查询基金持仓出现无限递归调用

无论是查询股票持仓还是债券持仓,都出现:

import jqdatasdk
print(jqdatasdk.__version__)

from jqdatasdk import finance, query

q=query(finance.FUND_PORTFOLIO_STOCK).filter(finance.FUND_PORTFOLIO_STOCK.code=="000001") \
                                     .order_by(finance.FUND_PORTFOLIO_STOCK.pub_date.desc()) \
                                     .limit(10)
df=finance.run_query(q)
print(df)

错误信息:

1.8.6
---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-49-00948b92b9fb> in <module>
     17 from jqdatasdk import finance, query
     18 
---> 19 q=query(finance.FUND_PORTFOLIO_STOCK).filter(finance.FUND_PORTFOLIO_STOCK.code=="000001") \
     20                                      .order_by(finance.FUND_PORTFOLIO_STOCK.pub_date.desc()) \
     21                                      .limit(10)

~/anaconda3/envs/qu/lib/python3.8/site-packages/jqdatasdk/table.py in __getattr__(self, key)
     76         # 只对table的名字调用getattr, 否则会无限递归
     77         if key in self.__table_names:
---> 78             return getattr(self, key)
     79         else:
     80             raise AttributeError("database %r has no table %r" % (self.db_name, key))

... last 1 frames repeated, from the frame below ...

~/anaconda3/envs/qu/lib/python3.8/site-packages/jqdatasdk/table.py in __getattr__(self, key)
     76         # 只对table的名字调用getattr, 否则会无限递归
     77         if key in self.__table_names:
---> 78             return getattr(self, key)
     79         else:
     80             raise AttributeError("database %r has no table %r" % (self.db_name, key))

RecursionError: maximum recursion depth exceeded while calling a Python object

最新版jqdatasdk无法获取行业指数和概念指数的行情数据

无法获取行业指数的行情数据:

jq.get_price('801010','2019-01-01','2019-01-10')
Traceback (most recent call last):

  File "<ipython-input-55-1e1b2cc4592b>", line 1, in <module>
    jq.get_price('801010','2019-01-01','2019-01-10')

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/utils.py", line 223, in _wrapper
    return func(*args, **kwargs)

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/api.py", line 29, in get_price
    return JQDataClient.instance().get_price(**locals())

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/client.py", line 143, in <lambda>
    return lambda **kwargs: self(method, **kwargs)

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/client.py", line 138, in __call__
    raise err

Exception: 找不到标的801010

无法获得概念指数的行情数据:

jq.get_price('GN001','2019-01-01','2019-01-10')
Traceback (most recent call last):

  File "<ipython-input-57-8ad36cc698fb>", line 1, in <module>
    jq.get_price('GN001','2019-01-01','2019-01-10')

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/utils.py", line 223, in _wrapper
    return func(*args, **kwargs)

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/api.py", line 29, in get_price
    return JQDataClient.instance().get_price(**locals())

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/client.py", line 143, in <lambda>
    return lambda **kwargs: self(method, **kwargs)

  File "/home/luyao/anaconda3/lib/python3.6/site-packages/jqdatasdk/client.py", line 138, in __call__
    raise err

Exception: 找不到标的GN001

get_current_tick auth implementation

When I use get_current_tick in a multithreaded setting (see code below), it fails and prints the message "run jqdatasdk.auth first", and returns None.

When I run any other JQData API function with multithreading it runs successfully (no error) and returns a pd.DataFrame.

My guess is this has to do with the way get_current_tick does its authorization check.

Here's a reproducible example:

import jqdatasdk as jq
from concurrent.futures import ThreadPoolExecutor

jq.auth('138********', '********')

##### Multithreaded doesn't work
MAX_THREADS = 3
executor = ThreadPoolExecutor(MAX_THREADS)
stock_data = (result for result in executor.map(jq.get_current_tick, ['000001.XSHE'])) #prints error
next(stock_data) #returns None
########################

#calling it normally works
jq.get_current_tick(['000001.XSHE'])

中证500成分股历史数据有问题

2010年1月5号,中证500成分股,用get_index_stocks和get_index_weights.index取出的order_book_id不一致。

zz500 = jq.get_index_stocks("000905.XSHG", "2010-01-05")
zz500_weight = jq.get_index_weights("000905.XSHG", "2010-01-05")
len(set(zz500)^set(zz500_weight.index))
>>> 103

install failed in mac osx

在linux、win32都可以正确安装,在mac osx上出现错误
'''
/usr/local/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.6/thriftpy/transport/cybase.o -o build/lib.macosx-10.6-intel-3.6/thriftpy/transport/cybase.cpython-36m-darwin.so
ld: in '/usr/local/lib/libunwind.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libunwind.dylib for architecture i386
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/local/bin/clang' failed with exit status 1

----------------------------------------

Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;file='/private/var/folders/64/04r5rv8j2m96w_q58j125jhw0000gn/T/pip-install-onho986o/thriftpy/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/64/04r5rv8j2m96w_q58j125jhw0000gn/T/pip-record-2lr9ldu5/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/64/04r5rv8j2m96w_q58j125jhw0000gn/T/pip-install-onho986o/thriftpy/
'''

使用jqdatasdk查询场外基金净值错误

使用jqdatasdk查询场外基金净值

jqdatasdk 版本:1.8.1
python 版本:3.8.5
pandas 版本:0.25.3

`
FUND_CODE = "000001"
q = finance.run_query(query(finance.FUND_NET_VALUE).filter(finance.FUND_NET_VALUE.code==FUND_CODE).limit(30))

df=finance.run_query(q)
`

返回错误:

`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in
1 q = finance.run_query(query(finance.FUND_NET_VALUE).filter(finance.FUND_NET_VALUE.code==FUND_CODE).limit(30))
2
----> 3 df=finance.run_query(q)

~/anaconda3/lib/python3.8/site-packages/jqdatasdk/utils.py in _wrapper(*args, **kwargs)
228 print("run jqdatasdk.auth first")
229 else:
--> 230 return func(*args, **kwargs)
231 return _wrapper
232

~/anaconda3/lib/python3.8/site-packages/jqdatasdk/table.py in run_query(self, query_object)
44 from .client import JQDataClient
45 if self.__disable_join:
---> 46 check_no_join(query_object)
47
48 limit = self.RESULT_ROWS_LIMIT

~/anaconda3/lib/python3.8/site-packages/jqdatasdk/utils.py in wrapper(*args, **kwds)
52 with warnings.catch_warnings():
53 warnings.simplefilter("ignore", category=sa_exc.SAWarning)
---> 54 return f(*args, **kwds)
55 return wrapper
56

~/anaconda3/lib/python3.8/site-packages/jqdatasdk/utils.py in check_no_join(query)
65 def check_no_join(query):
66 """ 确保 query 中没有 join 语句, 也就是说: 没有引用多个表 """
---> 67 tables = get_tables_from_sql(str(query.statement))
68 if len(tables) != 1:
69 raise Exception("only a table is allowed to query every time")

~/anaconda3/lib/python3.8/site-packages/pandas/core/generic.py in getattr(self, name)
5177 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5178 return self[name]
-> 5179 return object.getattribute(self, name)
5180
5181 def setattr(self, name, value):

AttributeError: 'DataFrame' object has no attribute 'statement'`

希望能尽快支持网络代理设置

代码里面主要是socket包调用的时候没有respect系统代理,这里需要改一下相关的代码以支持代理;而requests包是默认支持系统代理的,所以requests包的调用不需要额外改代码。支持网络代理的功能很实用,希望能尽快支持一下,谢谢!

sdk无法支持多线程操作

当写多线程或者多进程代码时, 帐号超过两个线程时,会报错: 帐号登录验证问题。

请问这是有意如此,还是其他可能的原因?

setup的代码有点问题,请修复

requirements = [str(ir.req) for ir in parse_requirements("requirements.txt", session=False)]

if sys.version_info.major == 2:
requirements = [str(ir.req) for ir in parse_requirements("requirements-py2.txt", session=False)]

在代码环境是python2的时候,由于在py2下的没有req属性,在进if语句前,会直接抛异常,安装失败;可改成if-else结构

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.