Code Monkey home page Code Monkey logo

grs's People

Contributors

maxi119 avatar toomore 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grs's Issues

ImportError: No module named grs

Dear Toomore,
I run test_unittest.py by the following command
python test_unittest.py

But the following error occurred.
Traceback (most recent call last):
File "test_unittest.py", line 3, in
import grs
ImportError: No module named grs

Do you have any suggestion?

Thanks in advance!

snowuyl

有時候會抓到神奇的東西

驗證資料時發現資料裡有時候會混雜著

94/08/29,1085.0,65851.0,59.4,62.5,59.4,60.2,0.80,478.0
94/08/30,906.0,52032.0,60.3,60.5,56.0,56.0,-4.20,364.0
94/08/31,1266.0,68393.0,55.8,57.5,52.1,52.6,-3.40,478.0
¦@18µ§
1.¡u¡¯¡vªí¥Ü¸Ó¤é¬°¸ÓªÑ²¼¤WÂd±¾µP­º¤é¡A¨ä±¾µP­º¤é¤§º¦¶^«Y¥H·í¤é¦¬½L»ù´î©Ó¾P»ù­pºâ¦Ó±o¡C
94/09/02,827.0,46129.0,53.8,56.2,53.7,56.2,3.60,244.0
94/09/05,512.0,28293.0,56.9,56.9,54.1,54.1,-2.10,268.0
94/09/06,1029.0,55870.0,54.1,56.2,52.5,56.0,1.90,372.0

之類的一行亂碼,不知道是什麼東西~

Not able to install: SyntaxError with invalid syntax

Collecting grs
  Using cached grs-0.7.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/y8/04ps3r3d52q3mz7wfy_mgc8m0000gn/T/pip-build-og6hoafl/grs/setup.py", line 4, in <module>
        import grs
      File "/private/var/folders/y8/04ps3r3d52q3mz7wfy_mgc8m0000gn/T/pip-build-og6hoafl/grs/grs/__init__.py", line 33, in <module>
        from .fetch_data import Stock
      File "/private/var/folders/y8/04ps3r3d52q3mz7wfy_mgc8m0000gn/T/pip-build-og6hoafl/grs/grs/fetch_data.py", line 497
        raise ConnectionError(), u'IN OFFLINE, NO DATA FETCH.'
                               ^
    SyntaxError: invalid syntax

I am running it on macOS Sierra & Python 2.7 virtual environment.
Even I got your repository in local environment and run setup.py, it still failed anyway.
Please help out how to install this package successfully.
Thanks for all help.

程式下單

不知道有沒有可能利用 selenium 執行 網頁程式下單

鏈接一直失敗

我使用pycharm+django+python2.7
在使用grs模塊的時候一直出現此錯誤:HTTPConnectionPool(host='mis.tse.com.tw', port=None): Max retries exceeded with url: /stock/api/getStockInfo.jsp?ex_ch=otc_070279.tw_20141118&json=1&delay=0&_=1416282457 (Caused by ProtocolError('Connection aborted.', error(10060, '')))
我不知道什麼原因,應該怎麼解決?

有關一些建議

1.cvs資料檔停留在2013/12/18,可否要更新,或建立自動上網更新機制
2.TWSENo().industry_code.keys()與TWSENo().industry_comps.keys()兩者資料不盡相同,可否更改一下!
3.有些股票如果抓太多資料(24月) stock('xxxx',24),無法讀取
4.遇到剛剛下市的股票,會出現錯誤,,無法讀取
 ex:<2015.2.4>代號:2384 --> AttributeError: 'Stock' object has no attribute  '_SimpleAnalytics__raw_data'

感謝你!你的程式很好用。

grs 很多功能都不能啟用

我已經安裝 python-dateutil 1.5、ujson、urllib3,但是經常出現不能連接上的問題。

例如Stock導入的時候也報錯,我看了錯誤報告,是缺少dateutil的庫,於是我安裝了之後可以導入。但很不穩定,經常會報錯,錯誤是:WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(10060, ''))': /ch/trading/exchange/STOCK_DAY/STOCK_DAY_print.php?genpage=genpage/Report201411/201411_F3_1_8_2618.php&type=csv&r=859600
<grs.fetch_data.Stock object at 0x01C69D50>;

還有其他的功能也不能使用,例如:RealtimeTWSE,報:WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(10060, ''))': /stock/api/getStockInfo.jsp?ex_ch=tse_2618.tw_20141118&json=1&delay=0&=1416278929
WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(10060, ''))': /stock/api/getStockInfo.jsp?ex_ch=tse_2618.tw_20141118&json=1&delay=0&
=1416278929
WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(10060, ''))': /stock/api/getStockInfo.jsp?ex_ch=tse_2618.tw_20141118&json=1&delay=0&_=1416278929

Traceback (most recent call last):
File "<pyshell#2>", line 1, in
realtime_stock = RealtimeTWSE('2618')
File "C:\Python27\lib\site-packages\grs-0.6.1-py2.7.egg\grs\realtime2.py", line 132, in init
super(RealtimeTWSE, self).init(no, date)
File "C:\Python27\lib\site-packages\grs-0.6.1-py2.7.egg\grs\realtime2.py", line 35, in init
self.result = URL.request('GET', STOCKPATH % params)
File "build\bdist.win32\egg\urllib3\request.py", line 68, in request
*_urlopen_kw)
File "build\bdist.win32\egg\urllib3\request.py", line 81, in request_encode_url
return self.urlopen(method, url, *_urlopen_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 579, in urlopen
release_conn=release_conn, *_response_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 579, in urlopen
release_conn=release_conn, *_response_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 579, in urlopen
release_conn=release_conn, **response_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 559, in urlopen
_pool=self, _stacktrace=stacktrace)
File "build\bdist.win32\egg\urllib3\util\retry.py", line 265, in increment
raise MaxRetryError(pool, url, error)
MaxRetryError: HTTPConnectionPool(host='mis.tse.com.tw', port=None): Max retries exceeded with url: /stock/api/getStockInfo.jsp?ex_ch=tse_2618.tw_20141118&json=1&delay=0&
=1416278929 (Caused by ProtocolError('Connection aborted.', error(10060, '')));

我不知道是什麼原因導致這個錯誤,有時候是可以使用的,另外還有RealtimeOTC,錯誤:WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(10060, ''))': /stock/api/getStockInfo.jsp?ex_ch=otc_2618.tw_20141118&json=1&delay=0&=1416279071
WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(10060, ''))': /stock/api/getStockInfo.jsp?ex_ch=otc_2618.tw_20141118&json=1&delay=0&
=1416279071
WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(10060, ''))': /stock/api/getStockInfo.jsp?ex_ch=otc_2618.tw_20141118&json=1&delay=0&_=1416279071

Traceback (most recent call last):
File "<pyshell#3>", line 1, in
RealtimeOTC('2618')
File "C:\Python27\lib\site-packages\grs-0.6.1-py2.7.egg\grs\realtime2.py", line 146, in init
super(RealtimeOTC, self).init(no, date)
File "C:\Python27\lib\site-packages\grs-0.6.1-py2.7.egg\grs\realtime2.py", line 35, in init
self.result = URL.request('GET', STOCKPATH % params)
File "build\bdist.win32\egg\urllib3\request.py", line 68, in request
*_urlopen_kw)
File "build\bdist.win32\egg\urllib3\request.py", line 81, in request_encode_url
return self.urlopen(method, url, *_urlopen_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 579, in urlopen
release_conn=release_conn, *_response_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 579, in urlopen
release_conn=release_conn, *_response_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 579, in urlopen
release_conn=release_conn, **response_kw)
File "build\bdist.win32\egg\urllib3\connectionpool.py", line 559, in urlopen
_pool=self, _stacktrace=stacktrace)
File "build\bdist.win32\egg\urllib3\util\retry.py", line 265, in increment
raise MaxRetryError(pool, url, error)
MaxRetryError: HTTPConnectionPool(host='mis.tse.com.tw', port=None): Max retries exceeded with url: /stock/api/getStockInfo.jsp?ex_ch=otc_2618.tw_20141118&json=1&delay=0&
=1416279071 (Caused by ProtocolError('Connection aborted.', error(10060, '')));
而TWSENo().all_stock 得到所有號碼及名稱是一直可以使用的。
我應該如何解決這些問題?

RealtimeTWSE 出現錯誤

可以問一下這部分的錯誤訊息嗎 ??

>>> from grs import RealtimeTWSE
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name RealtimeTWSE

謝謝

擷取華研即時股價出現錯誤??

Traceback (most recent call last):
File "E:/git/stock/stockgrs.py", line 118, in
realtime_stock = RealtimeOTC('8446') # 擷取華研即時股價
File "C:\Python27\lib\site-packages\grs\realtime2.py", line 146, in init
super(RealtimeOTC, self).init(no, date)
File "C:\Python27\lib\site-packages\grs\realtime2.py", line 35, in init
self.result = URL.request('GET', STOCKPATH % params)
File "C:\Python27\lib\site-packages\urllib3\request.py", line 66, in request
**urlopen_kw)
File "C:\Python27\lib\site-packages\urllib3\request.py", line 87, in request_encode_url
return self.urlopen(method, url, **extra_kw)
File "C:\Python27\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
release_conn=release_conn, **response_kw)
File "C:\Python27\lib\site-packages\urllib3\connectionpool.py", line 549, in urlopen
raise HostChangedError(self, url, retries)
urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='mis.tse.com.tw', port=80): Tried to open a foreign host with url: http://1.1.1.8

stock.price error

ticker = '2317'
month =12
stock = Stock(ticker, month)
print stock.price

會出現 error message

Traceback (most recent call last):
File "<pyshell#21>", line 1, in
print stock.price
File "C:\Python27\lib\site-packages\grs\fetch_data.py", line 391, in price
return self.__serial_price()
File "C:\Python27\lib\site-packages\grs\fetch_data.py", line 291, in __serial_price
return list(result)
File "C:\Python27\lib\site-packages\grs\fetch_data.py", line 290, in
result = (float(i[rows]) for i in self.__raw_data)
ValueError: could not convert string to float: --

想請問關於 無法連線至 mis.tse.com.tw

Traceback (most recent call last):
File "realtime2.py", line 235, in
realtime_data = RealtimeTWSE(1201)
File "realtime2.py", line 132, in init
super(RealtimeTWSE, self).init(no, date)
File "realtime2.py", line 35, in init
self.result = URL.request('GET', STOCKPATH % params)
File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 69, in request
*_urlopen_kw)
File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 90, in request_encode_url
return self.urlopen(method, url, *_extra_kw)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 652, in urlopen
release_conn=release_conn, **response_kw)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 529, in urlopen
raise HostChangedError(self, url, retries)
urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='mis.tse.com.tw', port=None): Tried to open a foreign host with url: http://1.1.1.2

moving_average_bias_ratio on manual

可以問一下在手冊裡,moving_average_bias_ratio 是 "計算乖離率(均價)",可以實際上看起來是價差,而不是百分比,是不是字面上有一些 ambiguous

謝謝

即時盤的資訊無法取得

從 GITHUB 下載了 grs 0.7.0, 執行起來一切都好唯獨無法取得即時盤的股價資訊. 查閱了歷史資料, 以前似乎也曾發生過類似的問題 (如 issue #39 擷取華研即時股價出現錯誤)

不知即時盤的資訊是只在 2016/11 月底的時候無法取得呢? 抑或是從此以後再也無法取得了呢?
請問這是因為台灣證劵交易所不提供即時的資訊嗎?
煩請不吝告知, 謝謝!

plus_mons 壞掉了>___<

stock = Stock("2618')
stock.plus_mons(1)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/grs/fetch_data.py", line 121, in plus_mons
oldraw = list(self.__raw_data)
AttributeError: 'Stock' object has no attribute '_FetchData__raw_data'

stock.moving_average(3) 出现index of range

File "grsTry.py", line 8, in
print stock.moving_average(3) # 閮?鈭???蝥予??
File "C:\Python27\lib\site-packages\grs\fetch_data.py", line 334, in moving_average
return self.__calculate_moving_average(date, 6)
File "C:\Python27\lib\site-packages\grs\fetch_data.py", line 298, in __calculate_moving_average
cal_data = self.__serial_price(row)
File "C:\Python27\lib\site-packages\grs\fetch_data.py", line 290, in __serial_price
return list(result)
File "C:\Python27\lib\site-packages\grs\fetch_data.py", line 289, in
result = (float(i[rows]) for i in self.__raw_data)
IndexError: list index out of range

pip install grs 之後,試著建立 Stock 物件會顯示 stock_no.csv 找不到

步驟:

  1. 執行 pip install grs
  2. 執行 python -i
Python 2.7.4 (default, May 17 2013, 17:07:08)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.24)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from grs import Stock
>>> s = Stock('2330')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/grs/fetch_data.py", line 452, in __new__
    elif stock_no in TWSENo().all_stock_no:
  File "/usr/local/lib/python2.7/site-packages/grs/twseno.py", line 160, in __init__
    super(TWSENo, self).__init__('stock_no.csv', 'industry_code.csv')
  File "/usr/local/lib/python2.7/site-packages/grs/twseno.py", line 37, in __init__
    self.__allstockno = self.importcsv()
  File "/usr/local/lib/python2.7/site-packages/grs/twseno.py", line 42, in importcsv
    with open(csv_path) as csv_file:
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/grs/stock_no.csv'

有關csv資料來源

作者你好
有關twse_list.csv
證期會代碼,公司簡稱,分類代碼,分類名稱
UPDATE,2013/12/18,x,x
1312,國喬,03,塑膠工業

關於分類代碼,分類名稱你是去哪邊找的?
整個csv是你自己整理的嗎?

Fail to run "pip install -U grs" on Windows 8.1

Dear Toomore,

    I run the following command on Windows 8.1

pip install -U grs

But the following error occurred.
Collecting grs
Downloading grs-0.7.0.tar.gz (96kB)
42% |█████████████▋ | 40kB 91kB/s eta 0:00:01
53% |█████████████████ | 51kB 112kB/s eta 0:0
63% |████████████████████▌ | 61kB 134kB/s eta
74% |███████████████████████▉ | 71kB 119kB/s
85% |███████████████████████████▎ | 81kB 136k
95% |██████████████████████████████▊ | 92kB 1
100% |████████████████████████████████| 102k
B 166kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\snowuyl\AppData\Local\Temp\pip-build-mcrgjp54\grs\setup.py",
line 4, in
import grs
File "C:\Users\snowuyl\AppData\Local\Temp\pip-build-mcrgjp54\grs\grs__init
_.py", line 33, in
from .fetch_data import Stock
File "C:\Users\snowuyl\AppData\Local\Temp\pip-build-mcrgjp54\grs\grs\fetch

data.py", line 497
raise ConnectionError(), u'IN OFFLINE, NO DATA FETCH.'
^
SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\snowuyl\A
ppData\Local\Temp\pip-build-mcrgjp54\grs\

Do you have any suggestion?

Thanks in advance!

snowuyl

best_ask_* 可能會有list index out of range的問題

Hi toomore,

這個module很好用!
但是我在抓一些股的時候,當他在漲停(跌停)時,沒有委賣/買,亦沒有量。
所以在realtime2.py中, 93行開始best_ask_pirce 等等,因抓不到值的問題,導致在Assign過程中,list index out of range.

我自己是加了一些簡單的判斷避開(len(best_ask_*) is not 0才做assign...),不知道toomore大是否要做一些修改XD

感謝!!

vaal

urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='mis.tse.com.tw', port=None)

Dear toomore,
I added test.py to get real time stock price of 2618.
from grs import RealtimeTWSE

realtime_stock = RealtimeTWSE('2618')
realtime_stock.raw
realtime_stock.data

But when I type the following on terminal of Ubuntu 16.04. The following error occurred.
Traceback (most recent call last):
File "test.py", line 3, in
realtime_stock = RealtimeTWSE('2618')
File "/home/snowuyl/samba/grs-master/grs/realtime2.py", line 132, in init
super(RealtimeTWSE, self).init(no, date)
File "/home/snowuyl/samba/grs-master/grs/realtime2.py", line 35, in init
self.result = URL.request('GET', STOCKPATH % params)
File "/usr/lib/python2.7/dist-packages/urllib3/request.py", line 69, in request
*_urlopen_kw)
File "/usr/lib/python2.7/dist-packages/urllib3/request.py", line 90, in request_encode_url
return self.urlopen(method, url, *_extra_kw)
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 654, in urlopen
release_conn=release_conn, **response_kw)
File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 531, in urlopen
raise HostChangedError(self, url, retries)
urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='mis.tse.com.tw', port=None): Tried to open a foreign host with url: http://1.1.1.8

Do you have any suggestion to solve this issue?

Thanks in advance!

snowuyl

ImportError: cannot import name Stock

Dear Toomore,

   My startup.py is as follows.

from grs import Stock
stock = Stock('6278')
print stock.moving_average(5)
print stock.moving_average_value(5)
print stock.moving_average_bias_ratio(5, 10)

  I run startup.py as follows.

python startup.py

  But the following error occurred

Traceback (most recent call last):
File "startup.py", line 3, in
from grs import Stock
ImportError: cannot import name Stock

Do you have any suggestion?

Thanks in advance!

snowuyl

判斷台灣股市是否開市民國年與西元年日期會有不同的結果

我輸入
open_or_not.d_day(datetime(2017, 02, 06)) #西元年 2017/02/06是否開市
True
顯示為有開市

但當我輸入
open_or_not.d_day(datetime(106, 02, 06))#民國年
False
顯示為未開市
原始資料內容
2454聯發科
[u'106/02/06', 10439845.0, 2200855430.0, 208.0, 214.0, 206.0, 212.0, u'+5.00', 5853.0, u'']
有這個天的資料的

Can't not crawl stock data

Hi,

it seems that twse changed the form of the table, so grs cannnot crawl any stock data.

Hope new version would be push soon.

Thank you.

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.