Skip to main content

RealtimeStock

Build Status Coverage Status PyPI PyPI - Downloads PyPI - Python Version PyPI - Wheel GitHub contributors GitHub issues GitHub Action GitHub

This package is supported realtime stock quote from Shanghai Exchange, Shenzhen Exchange, HongKong Exchange, and US Market(NASDAQ, NYSE, AMEX).

  • The method getQuote will random choose one of the method to get the realtime quote, this will avoid being blocked by one of the sources when doing heavy requests.

  • Realtime SH/SZ: sinaQuote, futuQuote, tigerQuote, xueqiuQuote, tencentQuote

  • Realtime HK: xueqiuQuote, tigerQuote

  • Realtime US: xueqiuQuote, tigerQuote, tencentQuote

  • Delay HK: sinaQuote, futuQuote

  • Delay US: futuQuote

Install

pip install RealtimeStock

or

pip install --upgrade RealtimeStock

Usage

  • Initializing
from RealtimeStock import sinaQuote, futuQuote, tigerQuote,xueqiuQuote, tencentQuote, getQuote
  • Get realtime quote (HKEX)
print(xueqiuQuote('hk','07200'))
print(tigerQuote('hk','07200'))
print(getQuote('hk','07200'))

Sample output

{'code': '07200', 'name': 'FL 二南方恒指', 'price': 8.74, 'time': '2020-11-16 16:08:36'}
{'code': '07200', 'name': 'FL二南方恒指', 'price': 8.74, 'time': '2020-11-16 16:08:36'}
{'code': '07200', 'name': 'FL二南方恒指', 'price': 8.74, 'time': '2020-11-16 16:08:36'}
  • Get realtime quote (ShanghaiExchange)
print(sinaQuote('sh','600320'))
print(futuQuote('sh','600320'))
print(xueqiuQuote('sh','600320'))
print(tigerQuote('sh','600320'))
print(tencentQuote('sh','600320'))
print(getQuote('sh','600320'))

Sample output

{'code': '600320', 'name': '振华重工', 'price': 3.07, 'time': '2020-11-16 16:00:00'}
{'code': '600320', 'name': '振华重工', 'en_name': 'Shanghai Zhenhua Heavy Industries', 'price': 3.07, 'time': '2020-11-16 16:00:00'}
{'code': '600320', 'name': '振华重工', 'price': 3.07, 'time': '2020-11-16 15:00:00'}
{'code': '600320', 'name': '振华重工', 'price': 3.07, 'time': '2020-11-16 15:03:57'}
{'code': '600320', 'name': '振华重工', 'price': 3.07, 'time': '2020-11-16 16:00:00'}
{'code': '600320', 'name': '振华重工', 'price': 3.07, 'time': '2020-11-16 16:00:00'}
  • Get realtime quote (Shenzhen Exchange)
print(sinaQuote('sz','002122'))
print(futuQuote('sz','002122'))
print(xueqiuQuote('sz','002122'))
print(tigerQuote('sz','002122'))
print(tencentQuote('sz','002122'))
print(getQuote('sz','002122'))

Sample output

{'code': '002122', 'name': '*ST天马', 'price': 2.17, 'time': '2020-11-16 16:00:00'}
{'code': '002122', 'name': '*ST天马', 'en_name': 'Tianma Bearing Group', 'price': 2.17, 'time': '2020-11-16 16:00:00'}
{'code': '002122', 'name': '*ST天马', 'price': 2.17, 'time': '2020-11-16 15:04:03'}
{'code': '002122', 'name': '*ST天马', 'price': 2.17, 'time': '2020-11-16 15:03:03'}
{'code': '002122', 'name': '*ST天马', 'price': 2.17, 'time': '2020-11-16 16:00:00'}
{'code': '002122', 'name': '*ST天马', 'price': 2.17, 'time': '2020-11-16 16:00:00'}
  • Get realtime quote (NASDAQ/NYSE/AMEX)
print(xueqiuQuote('us','VRSK'))
print(tigerQuote('us','VRSK'))
print(tencentQuote('us','VRSK'))
print(getQuote('us','VRSK'))

Sample output

{'code': 'VRSK', 'name': 'Verisk分析', 'price': 205.25, 'time': '2020-11-16 16:00:00'}
{'code': 'VRSK', 'name': 'Verisk Analytics', 'price': 205.25, 'time': '2020-11-16 16:00:00'}
{'code': 'VRSK', 'name': 'Verisk Analytics Inc', 'price': 205.25, 'time': '2020-11-16 16:00:00'}
{'code': 'VRSK', 'name': 'Verisk Analytics', 'price': 205.25, 'time': '2020-11-16 16:00:00'}

Metadata

Release files for RealtimeStock 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RealtimeStock 1.0.2
File Size Uploaded
RealtimeStock-1.0.2.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for RealtimeStock 1.0.2
File Interpreter ABI Platform
RealtimeStock-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / RealtimeStock-1.0.2.tar.gz

Download URL RealtimeStock-1.0.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
881b3aeac709d30a0606319555ceda8efe092e000bd34b164e3dcb91ae48015f
BLAKE2b-256 checksum
How to use checksums
0b200111ed66ca94dd87e58ba176b91e534063667251edf973a471e9407615c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

Release files / RealtimeStock-1.0.2-py3-none-any.whl

Download URL RealtimeStock-1.0.2-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9dabb75873fb75cd6fc992b37c560672c79243eca31823f94da908ba41c39a0
BLAKE2b-256 checksum
How to use checksums
001c175774a0a451ddf582757bc76f166f59c3aebfff33c931510bdb15751b39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page