Git Product home page Git Product logo

realtimestock's Introduction

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'}

realtimestock's People

Contributors

hurinhu 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

Watchers

 avatar  avatar

realtimestock's Issues

brk.a

how to get brk.a or brk.b us stock price?

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.