Skip to main content

Realtime stock quote for Python

Project description

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 futuQuote, tigerQuote, xueqiuQuote and tencentQuote support all the markets, sinaQuote is not support US Market, futuQuote is only provided 20-minute delay data for US Market and realtime data for other markets.
  • 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.

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(sinaQuote('hk','07200'))
print(futuQuote('hk','07200'))
print(xueqiuQuote('hk','07200'))
print(tigerQuote('hk','07200'))
print(tencentQuote('hk','07200'))
print(getQuote('hk','07200'))

Sample output

{'code': '07200', 'name': 'FL二南方恒指', 'en_name': 'FL2 CSOP HSI', 'price': 8.74, 'time': '2020-11-16 16:00:00'}
{'code': '07200', 'name': '南方两倍看多恒指', 'en_name': 'CSOP HANG SENG INDEX DAILY', 'price': 8.74, 'time': '2020-11-16 16:00:00'}
{'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:00:00'}
{'code': '07200', 'name': 'FL二南方恒指', 'price': 8.74, 'time': '2020-11-16 16:00:00'}
  • 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'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

RealtimeStock-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

RealtimeStock-1.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file RealtimeStock-1.0.1.tar.gz.

File metadata

  • Download URL: RealtimeStock-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for RealtimeStock-1.0.1.tar.gz
Algorithm Hash digest
SHA256 411a73ac04b928da1a31f8da01c88ffd322e6aec755b48a706de4223e4ca85e4
MD5 0393365d83b5c4f9f5d96c92cab95f43
BLAKE2b-256 9ea749b3b7dd7dbc74c003d8d06978435cf843ab06b62c58780388494e4a2608

See more details on using hashes here.

File details

Details for the file RealtimeStock-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: RealtimeStock-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for RealtimeStock-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d61af77a8ada5cfa5b87f5d792f6546ae14d636cc9e38f857de646fb2d9c58cc
MD5 22e855b69606a4b4fbf68c27260b3b9d
BLAKE2b-256 510224970f3900e34e2b6ce9e7b5ea5d72e97322f9567b54db0bfe51cf7c0d89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page