quickQuantCFR 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Christian Rafferty
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: quickQuantCFR
3
+ Version: 1.0.0
4
+ Summary: A simple quantitative finance library for Python
5
+ Author-email: Christian Rafferty <cfr081709@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ChristianRafferty/quickQuantCFR
8
+ Project-URL: Repository, https://github.com/ChristianRafferty/quickQuantCFR
9
+ Project-URL: Readme, https://github.com/cfr081709/quickQuantCFR/blob/main/README.md
10
+ Project-URL: License, https://github.com/cfr081709/quickQuantCFR/blob/main/LICENSE
11
+ Project-URL: Changelog, https://github.com/cfr081709/quickQuantCFR/blob/main/CHANGELOG.txt
12
+ Requires-Python: >=3.11.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE.txt
15
+ Requires-Dist: numpy>=2.4.1
16
+ Requires-Dist: pandas>=2.3.1
17
+ Requires-Dist: yfinance>=0.2.65
18
+ Dynamic: license-file
19
+
20
+ Library Overview
21
+ This library provides tools for retrieving, managing, and analyzing stock market data. Data access and preprocessing are handled within the dataCollectionAndModification class, while core computational logic and baseline signal generation are implemented in the stockStandardSignalRetrieval class. The evaluationOfSignals class functions help to evaluate signals collected in the stockStandardSignalRetrieval class.
22
+
23
+ Disclaimer
24
+ ⚠️ This library is intended strictly for educational and research purposes. It is not designed to provide financial advice or investment recommendations. Do not use this software as a basis for making real-world investment decisions.
@@ -0,0 +1,5 @@
1
+ Library Overview
2
+ This library provides tools for retrieving, managing, and analyzing stock market data. Data access and preprocessing are handled within the dataCollectionAndModification class, while core computational logic and baseline signal generation are implemented in the stockStandardSignalRetrieval class. The evaluationOfSignals class functions help to evaluate signals collected in the stockStandardSignalRetrieval class.
3
+
4
+ Disclaimer
5
+ ⚠️ This library is intended strictly for educational and research purposes. It is not designed to provide financial advice or investment recommendations. Do not use this software as a basis for making real-world investment decisions.
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "quickQuantCFR"
7
+ version = "1.0.0"
8
+ description = "A simple quantitative finance library for Python"
9
+ authors = [{name = "Christian Rafferty", email = "cfr081709@gmail.com"}]
10
+ license = {text = "MIT"}
11
+ readme = "README.md"
12
+ requires-python = ">=3.11.9"
13
+ dependencies = [
14
+ "numpy>=2.4.1",
15
+ "pandas>=2.3.1",
16
+ "yfinance>=0.2.65"
17
+ ]
18
+
19
+ [project.urls]
20
+ Homepage = "https://github.com/ChristianRafferty/quickQuantCFR"
21
+ Repository = "https://github.com/ChristianRafferty/quickQuantCFR"
22
+ Readme = "https://github.com/cfr081709/quickQuantCFR/blob/main/README.md"
23
+ License = "https://github.com/cfr081709/quickQuantCFR/blob/main/LICENSE"
24
+ Changelog = "https://github.com/cfr081709/quickQuantCFR/blob/main/CHANGELOG.txt"
25
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,146 @@
1
+ import numpy as np
2
+ import pandas as pd
3
+ import yfinance as yf
4
+
5
+ exponentialMovingAverages = []
6
+ simpleMovingAverages = []
7
+
8
+ class dataCollectionAndModification:
9
+ def collectData(ticker, start_date, end_date):
10
+ data = yf.download(ticker, start=start_date, end=end_date)
11
+ return data
12
+ def collectAndStoreData(ticker, start_date, end_date, filename):
13
+ data= yf.download(ticker, start=start_date, end=end_date)
14
+ data.to_csv(filename)
15
+ print("Data stored in file {filename}")
16
+ return
17
+ def readData(filename, should_print):
18
+ data = pd.read_csv(filename, index_col='Date', parse_dates=True)
19
+ if should_print:
20
+ print(data)
21
+ return data
22
+ def clearDataFile(filename):
23
+ open(filename, 'w').close()
24
+ return
25
+
26
+ class stockStandardSignalRetrieval:
27
+ def getEMA(ticker, start_date, end_date, Print=False):
28
+ exponentialMovingAverages = []
29
+ data = yf.download(ticker, start=start_date, end=end_date)
30
+ data['EMA_12'] = data['Close'].ewm(span=12, adjust=False).mean()
31
+ data['EMA_26'] = data['Close'].ewm(span=26, adjust=False).mean()
32
+ data['EMA_50'] = data['Close'].ewm(span=50, adjust=False).mean()
33
+ data['EMA_200'] = data['Close'].ewm(span=200, adjust=False).mean()
34
+ exponentialMovingAverages.append(data['EMA_12'])
35
+ exponentialMovingAverages.append(data['EMA_26'])
36
+ exponentialMovingAverages.append(data['EMA_50'])
37
+ exponentialMovingAverages.append(data['EMA_200'])
38
+ if Print:
39
+ print(exponentialMovingAverages)
40
+ return exponentialMovingAverages
41
+ def getSMA(ticker, start_date, end_date, Print=False):
42
+ simpleMovingAverages = []
43
+ data = yf.download(ticker, start=start_date, end=end_date)
44
+ data['SMA_20'] = data['Close'].rolling(window=20).mean()
45
+ data['SMA_50'] = data['Close'].rolling(window=50).mean()
46
+ data['SMA_100'] = data['Close'].rolling(window=100).mean()
47
+ data['SMA_200'] = data['Close'].rolling(window=200).mean()
48
+ simpleMovingAverages.append(data['SMA_20'])
49
+ simpleMovingAverages.append(data['SMA_50'])
50
+ simpleMovingAverages.append(data['SMA_100'])
51
+ simpleMovingAverages.append(data['SMA_200'])
52
+ if Print:
53
+ print(simpleMovingAverages)
54
+ return simpleMovingAverages
55
+ def getMACD(ticker, start_date, end_date, Print=False):
56
+ data = yf.download(ticker, start=start_date, end=end_date)
57
+ data['EMA_12'] = data['Close'].ewm(span=12, adjust=False).mean()
58
+ data['EMA_26'] = data['Close'].ewm(span=26, adjust=False).mean()
59
+ data['MACD'] = data['EMA_12'] - data['EMA_26']
60
+ if Print:
61
+ print(data['MACD'])
62
+ return data['MACD']
63
+ def getADX(ticker, start_date, end_date, Print=False):
64
+ data = yf.download(ticker, start=start_date, end=end_date)
65
+ data['ADX'] = (data['High'] - data['Low']) / data['Close']
66
+ if Print:
67
+ print(data['ADX'])
68
+ return data['ADX']
69
+ def getRSI(ticker, start_date, end_date, Print=False):
70
+ data = yf.download(ticker, start=start_date, end=end_date)
71
+ delta = data['Close'].diff()
72
+ gain = (delta.where(delta > 0, 0)).rolling(window=14).mean()
73
+ loss = (-delta.where(delta < 0, 0)).rolling(window=14).mean()
74
+ rs = gain / loss
75
+ data['RSI'] = 100 - (100 / (1 + rs))
76
+ if Print:
77
+ print(data['RSI'])
78
+ return data['RSI']
79
+ def getOBV(ticker, start_date, end_date, Print=False):
80
+ data = yf.download(ticker, start=start_date, end=end_date)
81
+ data['OBV'] = (np.sign(data['Close'].diff()) * data['Volume']).fillna(0).cumsum()
82
+ if Print:
83
+ print(data['OBV'])
84
+ return data['OBV']
85
+
86
+ class evaluationOfSignals:
87
+ def evaluateEMA(ema_12, ema_26, ema_50, ema_200, Print=False):
88
+ if ema_12.iloc[-1] > ema_26.iloc[-1] and ema_12.iloc[-1] > ema_50.iloc[-1] and ema_12.iloc[-1] > ema_200.iloc[-1]:
89
+ signal = "Buy"
90
+ elif ema_12.iloc[-1] < ema_26.iloc[-1] and ema_12.iloc[-1] < ema_50.iloc[-1] and ema_12.iloc[-1] < ema_200.iloc[-1]:
91
+ signal = "Sell"
92
+ else:
93
+ signal = "Hold"
94
+ if Print:
95
+ print(signal)
96
+ return signal
97
+ def evaluateSMA(sma_20, sma_50, sma_100, sma_200, Print=False):
98
+ if sma_20.iloc[-1] > sma_50.iloc[-1] and sma_20.iloc[-1] > sma_100.iloc[-1] and sma_20.iloc[-1] > sma_200.iloc[-1]:
99
+ signal = "Buy"
100
+ elif sma_20.iloc[-1] < sma_50.iloc[-1] and sma_20.iloc[-1] < sma_100.iloc[-1] and sma_20.iloc[-1] < sma_200.iloc[-1]:
101
+ signal = "Sell"
102
+ else:
103
+ signal = "Hold"
104
+ if Print:
105
+ print(signal)
106
+ return signal
107
+ def evaluateMACD(macd, Print=False):
108
+ if macd.iloc[-1] > 0:
109
+ signal = "Buy"
110
+ elif macd.iloc[-1] < 0:
111
+ signal = "Sell"
112
+ else:
113
+ signal = "Hold"
114
+ if Print:
115
+ print(signal)
116
+ return signal
117
+ def evaluateADX(adx, Print=False):
118
+ if adx.iloc[-1] > 25:
119
+ signal = "Strong Trend"
120
+ elif adx.iloc[-1] < 20:
121
+ signal = "Weak Trend"
122
+ else:
123
+ signal = "Neutral Trend"
124
+ if Print:
125
+ print(signal)
126
+ return signal
127
+ def evaluateRSI(rsi, Print=False):
128
+ if rsi.iloc[-1] > 70:
129
+ signal = "Overbought - Sell Signal"
130
+ elif rsi.iloc[-1] < 30:
131
+ signal = "Oversold - Buy Signal"
132
+ else:
133
+ signal = "Neutral - Hold Signal"
134
+ if Print:
135
+ print(signal)
136
+ return signal
137
+ def evaluateOBV(obv, Print=False):
138
+ if obv.diff().iloc[-1] > 0:
139
+ signal = "Buying Pressure - Buy Signal"
140
+ elif obv.diff().iloc[-1] < 0:
141
+ signal = "Selling Pressure - Sell Signal"
142
+ else:
143
+ signal = "Neutral - Hold Signal"
144
+ if Print:
145
+ print(signal)
146
+ return signal
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: quickQuantCFR
3
+ Version: 1.0.0
4
+ Summary: A simple quantitative finance library for Python
5
+ Author-email: Christian Rafferty <cfr081709@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ChristianRafferty/quickQuantCFR
8
+ Project-URL: Repository, https://github.com/ChristianRafferty/quickQuantCFR
9
+ Project-URL: Readme, https://github.com/cfr081709/quickQuantCFR/blob/main/README.md
10
+ Project-URL: License, https://github.com/cfr081709/quickQuantCFR/blob/main/LICENSE
11
+ Project-URL: Changelog, https://github.com/cfr081709/quickQuantCFR/blob/main/CHANGELOG.txt
12
+ Requires-Python: >=3.11.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE.txt
15
+ Requires-Dist: numpy>=2.4.1
16
+ Requires-Dist: pandas>=2.3.1
17
+ Requires-Dist: yfinance>=0.2.65
18
+ Dynamic: license-file
19
+
20
+ Library Overview
21
+ This library provides tools for retrieving, managing, and analyzing stock market data. Data access and preprocessing are handled within the dataCollectionAndModification class, while core computational logic and baseline signal generation are implemented in the stockStandardSignalRetrieval class. The evaluationOfSignals class functions help to evaluate signals collected in the stockStandardSignalRetrieval class.
22
+
23
+ Disclaimer
24
+ ⚠️ This library is intended strictly for educational and research purposes. It is not designed to provide financial advice or investment recommendations. Do not use this software as a basis for making real-world investment decisions.
@@ -0,0 +1,11 @@
1
+ LICENSE.txt
2
+ README.md
3
+ pyproject.toml
4
+ src/quickQuantCFR/__init__.py
5
+ src/quickQuantCFR/core.py
6
+ src/quickQuantCFR.egg-info/PKG-INFO
7
+ src/quickQuantCFR.egg-info/SOURCES.txt
8
+ src/quickQuantCFR.egg-info/dependency_links.txt
9
+ src/quickQuantCFR.egg-info/requires.txt
10
+ src/quickQuantCFR.egg-info/top_level.txt
11
+ tests/test_core.py
@@ -0,0 +1,3 @@
1
+ numpy>=2.4.1
2
+ pandas>=2.3.1
3
+ yfinance>=0.2.65
@@ -0,0 +1 @@
1
+ quickQuantCFR
@@ -0,0 +1,264 @@
1
+ import unittest
2
+ import os
3
+ import pandas as pd
4
+ from unittest.mock import patch, MagicMock
5
+ from src.quickQuantCFR.core import dataCollectionAndModification, stockStandardSignalRetrieval, evaluationOfSignals
6
+
7
+ class TestDataCollectionAndModification(unittest.TestCase):
8
+
9
+ @patch('src.quickQuantCFR.core.yf.download')
10
+ def test_collectData(self, mock_download):
11
+ # Mock the yfinance download
12
+ mock_data = pd.DataFrame({
13
+ 'Open': [100, 101],
14
+ 'High': [105, 106],
15
+ 'Low': [95, 96],
16
+ 'Close': [102, 103],
17
+ 'Volume': [1000, 1100]
18
+ })
19
+ mock_download.return_value = mock_data
20
+
21
+ result = dataCollectionAndModification.collectData('AAPL', '2020-01-01', '2020-12-31')
22
+ self.assertIsInstance(result, pd.DataFrame)
23
+ self.assertEqual(len(result), 2)
24
+ mock_download.assert_called_once_with('AAPL', start='2020-01-01', end='2020-12-31')
25
+
26
+ @patch('src.quickQuantCFR.core.yf.download')
27
+ @patch('src.quickQuantCFR.core.pd.DataFrame.to_csv')
28
+ @patch('builtins.print')
29
+ def test_collectAndStoreData(self, mock_print, mock_to_csv, mock_download):
30
+ mock_data = pd.DataFrame({'Close': [100, 101]})
31
+ mock_download.return_value = mock_data
32
+
33
+ dataCollectionAndModification.collectAndStoreData('AAPL', '2020-01-01', '2020-12-31', 'test.csv')
34
+ mock_download.assert_called_once_with('AAPL', start='2020-01-01', end='2020-12-31')
35
+ mock_to_csv.assert_called_once_with('test.csv')
36
+ mock_print.assert_called_once_with("Data stored in file {filename}")
37
+
38
+ @patch('src.quickQuantCFR.core.pd.read_csv')
39
+ @patch('builtins.print')
40
+ def test_readData_with_print(self, mock_print, mock_read_csv):
41
+ mock_data = pd.DataFrame({'Close': [100, 101]})
42
+ mock_read_csv.return_value = mock_data
43
+
44
+ result = dataCollectionAndModification.readData('test.csv', True)
45
+ self.assertIsInstance(result, pd.DataFrame)
46
+ mock_read_csv.assert_called_once_with('test.csv', index_col='Date', parse_dates=True)
47
+ mock_print.assert_called_once_with(mock_data)
48
+
49
+ @patch('src.quickQuantCFR.core.pd.read_csv')
50
+ @patch('builtins.print')
51
+ def test_readData_without_print(self, mock_print, mock_read_csv):
52
+ mock_data = pd.DataFrame({'Close': [100, 101]})
53
+ mock_read_csv.return_value = mock_data
54
+
55
+ result = dataCollectionAndModification.readData('test.csv', False)
56
+ self.assertIsInstance(result, pd.DataFrame)
57
+ mock_print.assert_not_called()
58
+
59
+ @patch('builtins.open')
60
+ def test_clearDataFile(self, mock_open):
61
+ mock_file = MagicMock()
62
+ mock_open.return_value = mock_file
63
+
64
+ dataCollectionAndModification.clearDataFile('test.csv')
65
+ mock_open.assert_called_once_with('test.csv', 'w')
66
+ mock_file.close.assert_called_once()
67
+
68
+ class TestStockStandardSignalRetrieval(unittest.TestCase):
69
+
70
+ @patch('src.quickQuantCFR.core.yf.download')
71
+ def test_getEMA(self, mock_download):
72
+ mock_data = pd.DataFrame({
73
+ 'Close': [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200]
74
+ })
75
+ mock_download.return_value = mock_data
76
+
77
+ result = stockStandardSignalRetrieval.getEMA('AAPL', '2020-01-01', '2020-12-31', Print=False)
78
+ self.assertIsInstance(result, list)
79
+ self.assertEqual(len(result), 4) # EMA_12, EMA_26, EMA_50, EMA_200
80
+
81
+ @patch('src.quickQuantCFR.core.yf.download')
82
+ def test_getSMA(self, mock_download):
83
+ mock_data = pd.DataFrame({
84
+ 'Close': [100] * 200
85
+ })
86
+ mock_download.return_value = mock_data
87
+
88
+ result = stockStandardSignalRetrieval.getSMA('AAPL', '2020-01-01', '2020-12-31', Print=False)
89
+ self.assertIsInstance(result, list)
90
+ self.assertEqual(len(result), 4) # SMA_20, SMA_50, SMA_100, SMA_200
91
+
92
+ @patch('src.quickQuantCFR.core.yf.download')
93
+ def test_getMACD(self, mock_download):
94
+ mock_data = pd.DataFrame({
95
+ 'Close': [100] * 50
96
+ })
97
+ mock_download.return_value = mock_data
98
+
99
+ result = stockStandardSignalRetrieval.getMACD('AAPL', '2020-01-01', '2020-12-31', Print=False)
100
+ self.assertIsInstance(result, pd.Series)
101
+
102
+ @patch('src.quickQuantCFR.core.yf.download')
103
+ def test_getADX(self, mock_download):
104
+ mock_data = pd.DataFrame({
105
+ 'High': [105] * 10,
106
+ 'Low': [95] * 10,
107
+ 'Close': [100] * 10
108
+ })
109
+ mock_download.return_value = mock_data
110
+
111
+ result = stockStandardSignalRetrieval.getADX('AAPL', '2020-01-01', '2020-12-31', Print=False)
112
+ self.assertIsInstance(result, pd.Series)
113
+
114
+ @patch('src.quickQuantCFR.core.yf.download')
115
+ def test_getRSI(self, mock_download):
116
+ mock_data = pd.DataFrame({
117
+ 'Close': [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150]
118
+ })
119
+ mock_download.return_value = mock_data
120
+
121
+ result = stockStandardSignalRetrieval.getRSI('AAPL', '2020-01-01', '2020-12-31', Print=False)
122
+ self.assertIsInstance(result, pd.Series)
123
+
124
+ @patch('src.quickQuantCFR.core.yf.download')
125
+ def test_getOBV(self, mock_download):
126
+ mock_data = pd.DataFrame({
127
+ 'Close': [100, 101, 99, 102],
128
+ 'Volume': [1000, 1100, 900, 1200]
129
+ })
130
+ mock_download.return_value = mock_data
131
+
132
+ result = stockStandardSignalRetrieval.getOBV('AAPL', '2020-01-01', '2020-12-31', Print=False)
133
+ self.assertIsInstance(result, pd.Series)
134
+
135
+ class TestEvaluationOfSignals(unittest.TestCase):
136
+
137
+ def test_evaluateEMA_buy(self):
138
+ ema_12 = pd.Series([100, 101, 102])
139
+ ema_26 = pd.Series([95, 96, 97])
140
+ ema_50 = pd.Series([90, 91, 92])
141
+ ema_200 = pd.Series([85, 86, 87])
142
+
143
+ result = evaluationOfSignals.evaluateEMA(ema_12, ema_26, ema_50, ema_200, Print=False)
144
+ self.assertEqual(result, "Buy")
145
+
146
+ def test_evaluateEMA_sell(self):
147
+ ema_12 = pd.Series([85, 86, 87])
148
+ ema_26 = pd.Series([95, 96, 97])
149
+ ema_50 = pd.Series([90, 91, 92])
150
+ ema_200 = pd.Series([100, 101, 102])
151
+
152
+ result = evaluationOfSignals.evaluateEMA(ema_12, ema_26, ema_50, ema_200, Print=False)
153
+ self.assertEqual(result, "Sell")
154
+
155
+ def test_evaluateEMA_hold(self):
156
+ ema_12 = pd.Series([95, 96, 97])
157
+ ema_26 = pd.Series([95, 96, 97])
158
+ ema_50 = pd.Series([90, 91, 92])
159
+ ema_200 = pd.Series([100, 101, 102])
160
+
161
+ result = evaluationOfSignals.evaluateEMA(ema_12, ema_26, ema_50, ema_200, Print=False)
162
+ self.assertEqual(result, "Hold")
163
+
164
+ def test_evaluateSMA_buy(self):
165
+ sma_20 = pd.Series([100, 101, 102])
166
+ sma_50 = pd.Series([95, 96, 97])
167
+ sma_100 = pd.Series([90, 91, 92])
168
+ sma_200 = pd.Series([85, 86, 87])
169
+
170
+ result = evaluationOfSignals.evaluateSMA(sma_20, sma_50, sma_100, sma_200, Print=False)
171
+ self.assertEqual(result, "Buy")
172
+
173
+ def test_evaluateSMA_sell(self):
174
+ sma_20 = pd.Series([85, 86, 87])
175
+ sma_50 = pd.Series([95, 96, 97])
176
+ sma_100 = pd.Series([90, 91, 92])
177
+ sma_200 = pd.Series([100, 101, 102])
178
+
179
+ result = evaluationOfSignals.evaluateSMA(sma_20, sma_50, sma_100, sma_200, Print=False)
180
+ self.assertEqual(result, "Sell")
181
+
182
+ def test_evaluateSMA_hold(self):
183
+ sma_20 = pd.Series([95, 96, 97])
184
+ sma_50 = pd.Series([95, 96, 97])
185
+ sma_100 = pd.Series([90, 91, 92])
186
+ sma_200 = pd.Series([100, 101, 102])
187
+
188
+ result = evaluationOfSignals.evaluateSMA(sma_20, sma_50, sma_100, sma_200, Print=False)
189
+ self.assertEqual(result, "Hold")
190
+
191
+ def test_evaluateMACD_buy(self):
192
+ macd = pd.Series([-1, 0, 1])
193
+
194
+ result = evaluationOfSignals.evaluateMACD(macd, Print=False)
195
+ self.assertEqual(result, "Buy")
196
+
197
+ def test_evaluateMACD_sell(self):
198
+ macd = pd.Series([1, 0, -1])
199
+
200
+ result = evaluationOfSignals.evaluateMACD(macd, Print=False)
201
+ self.assertEqual(result, "Sell")
202
+
203
+ def test_evaluateMACD_hold(self):
204
+ macd = pd.Series([-1, 0, 0])
205
+
206
+ result = evaluationOfSignals.evaluateMACD(macd, Print=False)
207
+ self.assertEqual(result, "Hold")
208
+
209
+ def test_evaluateADX_strong_trend(self):
210
+ adx = pd.Series([20, 25, 30])
211
+
212
+ result = evaluationOfSignals.evaluateADX(adx, Print=False)
213
+ self.assertEqual(result, "Strong Trend")
214
+
215
+ def test_evaluateADX_weak_trend(self):
216
+ adx = pd.Series([25, 20, 15])
217
+
218
+ result = evaluationOfSignals.evaluateADX(adx, Print=False)
219
+ self.assertEqual(result, "Weak Trend")
220
+
221
+ def test_evaluateADX_neutral_trend(self):
222
+ adx = pd.Series([20, 22, 23])
223
+
224
+ result = evaluationOfSignals.evaluateADX(adx, Print=False)
225
+ self.assertEqual(result, "Neutral Trend")
226
+
227
+ def test_evaluateRSI_overbought(self):
228
+ rsi = pd.Series([65, 70, 75])
229
+
230
+ result = evaluationOfSignals.evaluateRSI(rsi, Print=False)
231
+ self.assertEqual(result, "Overbought - Sell Signal")
232
+
233
+ def test_evaluateRSI_oversold(self):
234
+ rsi = pd.Series([35, 30, 25])
235
+
236
+ result = evaluationOfSignals.evaluateRSI(rsi, Print=False)
237
+ self.assertEqual(result, "Oversold - Buy Signal")
238
+
239
+ def test_evaluateRSI_neutral(self):
240
+ rsi = pd.Series([45, 50, 55])
241
+
242
+ result = evaluationOfSignals.evaluateRSI(rsi, Print=False)
243
+ self.assertEqual(result, "Neutral - Hold Signal")
244
+
245
+ def test_evaluateOBV_buy(self):
246
+ obv = pd.Series([1000, 1100, 1200])
247
+
248
+ result = evaluationOfSignals.evaluateOBV(obv, Print=False)
249
+ self.assertEqual(result, "Buying Pressure - Buy Signal")
250
+
251
+ def test_evaluateOBV_sell(self):
252
+ obv = pd.Series([1200, 1100, 1000])
253
+
254
+ result = evaluationOfSignals.evaluateOBV(obv, Print=False)
255
+ self.assertEqual(result, "Selling Pressure - Sell Signal")
256
+
257
+ def test_evaluateOBV_hold(self):
258
+ obv = pd.Series([1000, 1000, 1000])
259
+
260
+ result = evaluationOfSignals.evaluateOBV(obv, Print=False)
261
+ self.assertEqual(result, "Neutral - Hold Signal")
262
+
263
+ if __name__ == '__main__':
264
+ unittest.main()