Giter Club home page Giter Club logo

Comments (4)

mlouielu avatar mlouielu commented on June 5, 2024 1

hi
now code
>>> twstock.realtime.get('00881')
or else ETF (like 00878)

get

{'msgArray': [], 'queryTime': {'sessionFromTime': -1, 'sessionLatestTime': -1, 'sessionStr': 'UserSession', 'showChart': False, 'stockInfo': 223564, 'stockInfoItem': 2203, 'sysDate': '20210518', 'sysTime': '20:04:57'}, 'referer': '', 'rtcode': '5001', 'rtmessage': 'Empty Query.', 'success': False, 'userDelay': 5000}

but the other stock(like 2330) is Success XD

Please update your codes first.

>>> import twstock
>>> twstock.realtime.get('00878')
{'timestamp': 1621319400.0, 'info': {'code': '00878', 'channel': '00878.tw', 'name': '國泰永續高股息', 'fullname': '國泰台灣高股息傘型證券投資信託基金之台灣ESG永續高股息ETF證券投資信託基金', 'time': '2021-05-18 14:30:00'}, 'realtime': {'latest_trade_price': '17.9000', 'trade_volume': '283', 'accumulate_trade_volume': '15047', 'best_bid_price': ['17.8900', '17.8800', '17.8700', '17.8600', '17.8500'], 'best_bid_volume': ['491', '143', '574', '215', '668'], 'best_ask_price': ['17.9000', '17.9100', '17.9200', '17.9300', '17.9400'], 'best_ask_volume': ['38', '28', '73', '132', '220'], 'open': '17.4500', 'high': '17.9000', 'low': '17.4000'}, 'success': True}
>>> twstock.realtime.get('00881')
{'timestamp': 1621319400.0, 'info': {'code': '00881', 'channel': '00881.tw', 'name': '國泰台灣5G+', 'fullname': '國泰台灣5G PLUS ETF證券投資信託基金', 'time': '2021-05-18 14:30:00'}, 'realtime': {'latest_trade_price': '16.9000', 'trade_volume': '1359', 'accumulate_trade_volume': '50975', 'best_bid_price': ['16.9000', '16.8900', '16.8800', '16.8700', '16.8600'], 'best_bid_volume': ['522', '23', '298', '750', '455'], 'best_ask_price': ['16.9100', '16.9200', '16.9300', '16.9400', '16.9500'], 'best_ask_volume': ['518', '204', '341', '158', '224'], 'open': '16.3000', 'high': '16.9100', 'low': '16.2600'}, 'success': True}
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2021, 5, 18, 20, 12, 10, 187091)

from twstock.

mlouielu avatar mlouielu commented on June 5, 2024

Please update your codes

$ python -m twstock -U
Start to update codes
Done!

Then

Python 3.9.1 (default, Dec 13 2020, 11:55:53) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import twstock
>>> twstock.realtime.get('00881')
{'msgArray': [{'tv': '6', 'ps': '-', 'nu': 'https://www.cathaysite.com.tw/funds/etf/estimate.aspx?fc=CR', 'pz': '-', 'a': '18.6200_18.6300_18.6400_18.6500_18.6600_', 'b': '18.6100_18.6000_18.5900_18.5800_18.5700_', 'c': '00881', 'd': '20210429', 'ch': '00881.tw', 'tlong': '1619665928000', 'f': '68_291_741_1176_785_', 'ip': '0', 'g': '221_266_431_486_370_', 'mt': '719150', 'h': '18.6900', 'it': '02', 'l': '18.5300', 'n': '國泰台灣5G+', 'o': '18.5300', 'p': '0', 'ex': 'tse', 's': '3', 't': '11:12:08', 'u': '20.1800', 'v': '46141', 'w': '16.5200', 'nf': '國泰台灣5G PLUS ETF證券投資信託基金', 'y': '18.3500', 'z': '18.6200', 'ts': '0'}], 'referer': '', 'userDelay': 5000, 'rtcode': '0000', 'queryTime': {'sysDate': '20210429', 'stockInfoItem': 530, 'stockInfo': 534395, 'sessionStr': 'UserSession', 'sysTime': '11:12:10', 'showChart': False, 'sessionFromTime': -1, 'sessionLatestTime': -1}, 'rtmessage': 'OK'}
{'timestamp': 1619665928.0, 'info': {'code': '00881', 'channel': '00881.tw', 'name': '國泰台灣5G+', 'fullname': '國泰台灣5G PLUS ETF證券投資信託基金', 'time': '2021-04-29 11:12:08'}, 'realtime': {'latest_trade_price': '18.6200', 'trade_volume': '6', 'accumulate_trade_volume': '46141', 'best_bid_price': ['18.6100', '18.6000', '18.5900', '18.5800', '18.5700'], 'best_bid_volume': ['221', '266', '431', '486', '370'], 'best_ask_price': ['18.6200', '18.6300', '18.6400', '18.6500', '18.6600'], 'best_ask_volume': ['68', '291', '741', '1176', '785'], 'open': '18.5300', 'high': '18.6900', 'low': '18.5300'}, 'success': True}

from twstock.

dennis8989 avatar dennis8989 commented on June 5, 2024

不好意思再請問一下
可以查詢大盤指數嗎

from twstock.

momolly1024 avatar momolly1024 commented on June 5, 2024

hi
now code
>>> twstock.realtime.get('00881')
or else ETF (like 00878)

get

{'msgArray': [], 'queryTime': {'sessionFromTime': -1, 'sessionLatestTime': -1, 'sessionStr': 'UserSession', 'showChart': False, 'stockInfo': 223564, 'stockInfoItem': 2203, 'sysDate': '20210518', 'sysTime': '20:04:57'}, 'referer': '', 'rtcode': '5001', 'rtmessage': 'Empty Query.', 'success': False, 'userDelay': 5000}

but the other stock(like 2330) is Success XD

from twstock.

Related Issues (20)

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.