Skip to content

Commit

Permalink
Fixed timedelta and release 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
toomore committed Mar 31, 2012
1 parent 5b32f08 commit f167626
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion README.rest
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ grs 台灣上市股票價格擷取
-----------------------------

:Authors: Toomore Chiang
:Version: 0.1.1 of 2012/03/31
:Version: 0.1.2 of 2012/03/31
:Python Version: Python 2.6-2.7

-----------------------------
Expand Down Expand Up @@ -228,3 +228,13 @@ Quick Start
print 'S: {0} {1}'.format(i, info)
except: # 不作為或資料不足
print 'X: {0}'.format(i)


-----------------------------
Change Logs
-----------------------------

0.1.2 2012/03/31
====================================

- 修正:倒數時間計算錯誤(dateutil.relativedelta)
2 changes: 1 addition & 1 deletion grs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# THE SOFTWARE.

__title__ = 'grs'
__version__ = '0.1.1'
__version__ = '0.1.2'
__author__ = 'Toomore Chiang'
__license__ = 'MIT'
__copyright__ = 'Copyright (C) 2012 Toomore Chiang'
Expand Down
6 changes: 3 additions & 3 deletions grs/fetch_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from datetime import datetime, timedelta
from datetime import datetime
from dateutil.relativedelta import relativedelta
import csv
import logging
import random
import urllib2


class stock(object):
""" 擷取股票股價 """

Expand Down Expand Up @@ -109,7 +109,7 @@ def __serial_fetch(self, no, month):
""" [list] 串接每月資料 舊→新 """
re = []
for i in range(month):
nowdatetime = datetime.today() - timedelta(30 * i)
nowdatetime = datetime.today() - relativedelta(months=i)
tolist = self.__to_list(self.__fetch_data(no, nowdatetime))
re = tolist + re
return re
Expand Down

0 comments on commit f167626

Please sign in to comment.