Skip to content

Commit

Permalink
Merge branch 'v0.5.5rc' of github.com:toomore/grs
Browse files Browse the repository at this point in the history
  • Loading branch information
toomore committed May 17, 2014
2 parents ca3da87 + abda1f4 commit bc6d945
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down Expand Up @@ -302,6 +302,11 @@ Quick Start
Change Logs
-----------------------------

0.5.5 2014/05/18
====================================

- 修正: `grs.fetch_data.SimpleAnalytics.CKMAO` to be classmethod.

0.5.4 2014/05/12
====================================

Expand Down
5 changes: 4 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down Expand Up @@ -81,6 +81,9 @@ Feature
Change Logs
-----------------------------

* 0.5.5 2014/05/18
- 修正: :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`.

Expand Down
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.5.4'
__version__ = '0.5.5'
__author__ = 'Toomore Chiang'
__license__ = 'MIT'
__copyright__ = 'Copyright (C) 2012, 2013, 2014 Toomore Chiang'
Expand Down
6 changes: 4 additions & 2 deletions grs/fetch_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""判斷正負乖離轉折點位置
Expand All @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions test_unittest.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit bc6d945

Please sign in to comment.