zvtvz / jqdatapy Goto Github PK
View Code? Open in Web Editor NEWpython wrapper for jqdata http api
License: MIT License
python wrapper for jqdata http api
License: MIT License
如果能取代jqdatasdk,就免去了询问取数的限制,这个主意非常好!有点遗憾是说明文件的例子如果加参数就出不来数据了。
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7ff035ea6c88>: Failed to establish a new connection: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='dataapi.joinquant.com', port=443): Max retries exceeded with url: /apis (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff035ea6c88>: Failed to establish a new connection: [Errno 110] Connection timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "examples/recorders/joinquant_data_runner2.py", line 22, in record_margin_trading
MarginTrading.record_data(provider='joinquant', sleeping_time=1)
File "/usr/local/lib/python3.7/site-packages/zvt-0.9.1-py3.7.egg/zvt/contract/schema.py", line 153, in record_data
r.run()
File "/usr/local/lib/python3.7/site-packages/zvt-0.9.1-py3.7.egg/zvt/contract/recorder.py", line 484, in run
raise raising_exception
File "/usr/local/lib/python3.7/site-packages/zvt-0.9.1-py3.7.egg/zvt/contract/recorder.py", line 403, in run
timestamps=timestamps)
File "/usr/local/lib/python3.7/site-packages/zvt-0.9.1-py3.7.egg/zvt/recorders/joinquant/fundamental/joinquant_margin_trading_recorder.py", line 31, in record
df = get_mtss(code=to_jq_entity_id(entity), date=to_time_str(start))
File "/usr/local/lib/python3.7/site-packages/jqdatapy/api.py", line 98, in get_mtss
return request_jqdata(method='get_mtss', code=code, date=date, end_date=end_date, parse_dates=['date'])
File "/usr/local/lib/python3.7/site-packages/jqdatapy/api.py", line 167, in request_jqdata
token = get_token(force=True)
File "/usr/local/lib/python3.7/site-packages/jqdatapy/api.py", line 154, in get_token
jqdata_env["token"] = _get_token(jqdata_env["username"], jqdata_env["password"])
File "/usr/local/lib/python3.7/site-packages/jqdatapy/api.py", line 187, in _get_token
response = requests.post(url, data=json.dumps(body))
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='dataapi.joinquant.com', port=443): Max retries exceeded with url: /apis (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff035ea6c88>: Failed to establish a new connection: [Errno 110] Connection timed out'))
建议增加get_price接口
api.py文件中:
(1)all 列表增加'get_price'
(2)增加函数
def get_price(code="600000.XSHG", date=None, end_date=None, unit='1d', fields=None, skip_paused=False, fq='pre', count=None, panel=True, fill_paused=True, return_type='df'):
return request_jqdata(method='get_price_period', code=code, date=date, end_date=end_date, unit=unit, fields=fields, skip_paused=skip_paused,
fq=fq, count=count, panel=panel, fill_paused=fill_paused, return_type=return_type, parse_dates=['date'])
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.