From 79bc5f2409318d11d697999dd34bc24b259b1520 Mon Sep 17 00:00:00 2001 From: Toomore Chiang Date: Sat, 17 May 2014 23:54:54 +0800 Subject: [PATCH 1/4] Turn `check_moving_average_bias_ratio` to classmethod. --- grs/fetch_data.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grs/fetch_data.py b/grs/fetch_data.py index 9391499..077a572 100644 --- a/grs/fetch_data.py +++ b/grs/fetch_data.py @@ -414,7 +414,8 @@ def __cal_ma_bias_ratio_point(cls, data, sample=5, sample - sample_data.index(ckvalue) - 1, ckvalue) - def check_moving_average_bias_ratio(self, data, sample=5, + @classmethod + def check_moving_average_bias_ratio(cls, data, sample=5, positive_or_negative=False): """判斷正負乖離轉折點位置 @@ -424,9 +425,10 @@ def check_moving_average_bias_ratio(self, data, sample=5, :rtype: tuple :returns: (True or False, 第幾個轉折日, 轉折點值) """ - return self.__cal_ma_bias_ratio_point(data, sample, + return cls.__cal_ma_bias_ratio_point(data, sample, positive_or_negative) + @classmethod def CKMAO(self, *args, **kwargs): """ alias :func:`grs.fetch_data.SimpleAnalytics.check_moving_average_bias_ratio()` """ return self.check_moving_average_bias_ratio(*args, **kwargs) From 98f1bb7271727336be2f6e8843119d4c8f1d8f62 Mon Sep 17 00:00:00 2001 From: Toomore Chiang Date: Sun, 18 May 2014 00:08:02 +0800 Subject: [PATCH 2/4] Update version to v0.5.5 --- README.rst | 7 ++++++- docs/source/index.rst | 5 ++++- grs/__init__.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d5fb51d..44490f6 100644 --- a/README.rst +++ b/README.rst @@ -27,7 +27,7 @@ grs 台灣上市上櫃股票價格擷取 ----------------------------- :Authors: Toomore Chiang -:Version: 0.5.4 of 2014/05/12 +:Version: 0.5.5 of 2014/05/18 :Python Version: Python 2.7, PyPy :Docs: http://grs-docs.toomore.net/ @@ -302,6 +302,11 @@ Quick Start Change Logs ----------------------------- +0.5.5 2014/05/18 +==================================== + +- 修正: xxx. + 0.5.4 2014/05/12 ==================================== diff --git a/docs/source/index.rst b/docs/source/index.rst index e616c3b..412b51a 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -35,7 +35,7 @@ grs 台灣上市上櫃股票價格擷取 ----------------------------- :Authors: Toomore Chiang -:Version: 0.5.4 of 2014/05/12 +:Version: 0.5.5 of 2014/05/18 :Python Version: Python 2.7, PyPy :Docs: http://grs-docs.toomore.net/ @@ -81,6 +81,9 @@ Feature Change Logs ----------------------------- +* 0.5.5 2014/05/18 + - 修正: xxx. + * 0.5.4 2014/05/12 - 新增:MA, MAO, MAV, CKMAO into :class:`grs.fetch_data.SimpleAnalytics`. diff --git a/grs/__init__.py b/grs/__init__.py index 22e5d9e..d4ed459 100644 --- a/grs/__init__.py +++ b/grs/__init__.py @@ -21,7 +21,7 @@ # THE SOFTWARE. __title__ = 'grs' -__version__ = '0.5.4' +__version__ = '0.5.5' __author__ = 'Toomore Chiang' __license__ = 'MIT' __copyright__ = 'Copyright (C) 2012, 2013, 2014 Toomore Chiang' From 4c3feb84d8884d0427357c5714a8aec0a12c900c Mon Sep 17 00:00:00 2001 From: Toomore Chiang Date: Sun, 18 May 2014 00:16:23 +0800 Subject: [PATCH 3/4] Add `test_CKMAO_classmethod` into test_unittest. --- test_unittest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test_unittest.py b/test_unittest.py index fd1d95d..e71b9cd 100644 --- a/test_unittest.py +++ b/test_unittest.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- ''' Unittest ''' +import grs +import unittest from datetime import datetime from types import BooleanType from types import NoneType -import grs -import unittest class TestGrs(unittest.TestCase): @@ -49,6 +49,12 @@ def test_check_moving_average_bias_ratio(self): assert isinstance(result, BooleanType) assert result == self.data.CKMAO(*param)[0] + def test_CKMAO_classmethod(self): + self.get_data() + result = grs.fetch_data.SimpleAnalytics.CKMAO(self.data.MAO(3, 6)[0]) + assert isinstance(result, tuple) + assert len(result) == 3 + def test_stock_value(self): self.get_data() assert isinstance(self.data.price, list) From abda1f4e10fd82d973c26bad1263d07af2bcfd04 Mon Sep 17 00:00:00 2001 From: Toomore Chiang Date: Sun, 18 May 2014 00:28:13 +0800 Subject: [PATCH 4/4] Update docs. --- README.rst | 2 +- docs/source/index.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 44490f6..083ddd1 100644 --- a/README.rst +++ b/README.rst @@ -305,7 +305,7 @@ Change Logs 0.5.5 2014/05/18 ==================================== -- 修正: xxx. +- 修正: `grs.fetch_data.SimpleAnalytics.CKMAO` to be classmethod. 0.5.4 2014/05/12 ==================================== diff --git a/docs/source/index.rst b/docs/source/index.rst index 412b51a..3b6f3f4 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -82,7 +82,7 @@ Change Logs ----------------------------- * 0.5.5 2014/05/18 - - 修正: xxx. + - 修正: :func:`grs.fetch_data.SimpleAnalytics.CKMAO` to be classmethod. * 0.5.4 2014/05/12 - 新增:MA, MAO, MAV, CKMAO into :class:`grs.fetch_data.SimpleAnalytics`.