Skip to content

Commit 8f81627

Browse files
committed
Test for PercentRank
1 parent 555430d commit 8f81627

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

tests/test_ind_pctrank.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8; py-indent-offset:4 -*-
3+
###############################################################################
4+
#
5+
# Copyright (C) 2015, 2016 Daniel Rodriguez
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
#
20+
###############################################################################
21+
from __future__ import (absolute_import, division, print_function,
22+
unicode_literals)
23+
24+
import testcommon
25+
26+
import backtrader as bt
27+
import backtrader.indicators as btind
28+
29+
chkdatas = 1
30+
chkvals = [
31+
['0.900000', '0.880000', '0.980000'],
32+
]
33+
34+
chkmin = 50
35+
chkind = btind.PercentRank
36+
37+
38+
def test_run(main=False):
39+
datas = [testcommon.getdata(i) for i in range(chkdatas)]
40+
testcommon.runtest(datas,
41+
testcommon.TestStrategy,
42+
main=main,
43+
plot=main,
44+
chkind=chkind,
45+
chkmin=chkmin,
46+
chkvals=chkvals)
47+
48+
49+
if __name__ == '__main__':
50+
test_run(main=True)

0 commit comments

Comments
 (0)