Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

grs 台灣上市股票價格擷取

主要開發擷取台灣股市(TWSE)股價資料,資料來源 證券交易所網站 。

版本資訊

Authors:

Toomore Chiang

Version:

0.0.1x of 2012/03/18

Python Version:

Python 2.6-2.7

Report Issue or get involved

Web Demo

Quick Start

簡單計算

from grs import stock

g = stock(2618)        # 擷取長榮航股價
print g.MA(5)          # 計算五日均價與持續天數
print g.MAV(5)         # 計算五日均量與持續天數

擷取 12 個月份資料

g = stock(2618, 12)

輸出 CSV 檔

g.out_putfile('/dev/shm/2618.csv')

其他功能

顯示台灣時間:TWTime

適用於其他時區查詢台灣當地時間。

from grs import TWTime

t = TWTime()
t.now                   # 顯示台灣此刻時間
t.localtime             # 顯示當地此刻時間

判斷台灣股市是否開市:twseopen

from grs import twseopen
from datetime import datetime

t = twseopen()

t.Dday(datetime.today())        # 判斷今天是否開市,回傳 True or False
t.Dday(datetime(2012, 12, 22))  # 判斷 2012/12/22 是否開市

各股即時盤資訊:rt_stock

from grs import rt_stock

rl = rt_stock(2618)       # 擷取長榮航即時股價
rl.raw                    # 原始資料
rl.real                   # 回傳 type: dict(如下表)
name:

股票名稱 Unicode

no:

股票代碼

range:

漲跌價

ranges:

漲跌判斷 True, False

time:

取得時間

max:

漲停價

min:

跌停價

unch:

昨日收盤價

pp:

漲跌幅 %

o:

開盤價

h:

當日最高價

l:

當日最低價

c:

成交價/收盤價

value:

累計成交量

pvalue:

該盤成交量

top5buy:

最佳五檔買進價量資訊

top5sell:

最佳五檔賣出價量資訊

crosspic:

K線圖 by Google Chart

大盤即時盤資訊:rt_weight

from grs import rt_weight

w = rt_weight()            # 擷取即時大盤資訊
w.raw                      # 原始檔案
w.real                     # 回傳 type: dict(如下表)

原始檔案包含其他資訊請參閱 對照表

no:

編號

date:

日期

time:

時間

c:

加權指數

value:

成交金額(億)

range:

漲跌指數

ud:

回傳漲(True)、跌(False)

單日倒數時間:Countdown

適用於設定 cache 時間。

from grs import Countdown

c = Countdown(h=14, m=30)  # 預設為 14:30
c.nextday                  # 下一個 14:30 日期
c.countdown                # 到數秒數
c.exptime                  # 下一個 14:30 日期時間(type: datetime)
c.lastmod                  # 前一個 14:30 日期時間(type: datetime)

Metadata

Release files for grs 0.0.1a0318

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

Source distribution (sdist)

Source distribution for grs 0.0.1a0318
File Size Uploaded Provenance Actions
grs-0.0.1a0318.tar.gz 13.2 kB Without provenance Details for grs-0.0.1a0318.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for grs 0.0.1a0318
File Interpreter ABI Platform Actions
grs-0.0.1a0318-py2.7.egg Legacy Egg format - - Details for grs-0.0.1a0318-py2.7.egg

Total release size: 32.9 kB

Release files / grs-0.0.1a0318.tar.gz

Download URL grs-0.0.1a0318.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
275264401cfffa5297d53c9217af4779176e93a4da074d05a159819ec892b344
BLAKE2b-256 checksum
How to use checksums
ac63d7632e9842230a5cf03fca1ca3d4179d2b83f3d50d51d2d25dbf8f3ecc14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / grs-0.0.1a0318-py2.7.egg

Download URL grs-0.0.1a0318-py2.7.egg
Size 19.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
e9a0158792b41a34ce2d48adbda946bdf7f8e9720cc1f6305091d9acdca80fb2
BLAKE2b-256 checksum
How to use checksums
f2655333428bd92b04849b6fb85306bbcf2d7204d1ac221d59ede54bca6c2ccc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for grs 0.0.1a0318

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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