quickQuantCFR 1.0.0__py3-none-any.whl
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.
- quickQuantCFR/__init__.py +0 -0
- quickQuantCFR/core.py +146 -0
- quickquantcfr-1.0.0.dist-info/METADATA +24 -0
- quickquantcfr-1.0.0.dist-info/RECORD +7 -0
- quickquantcfr-1.0.0.dist-info/WHEEL +5 -0
- quickquantcfr-1.0.0.dist-info/licenses/LICENSE.txt +21 -0
- quickquantcfr-1.0.0.dist-info/top_level.txt +1 -0
|
File without changes
|
quickQuantCFR/core.py
ADDED
|
@@ -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,7 @@
|
|
|
1
|
+
quickQuantCFR/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
quickQuantCFR/core.py,sha256=aT4tJt9V0fYpFAzSrCuj14iB7cFdHsUWmu4R39c27iI,6111
|
|
3
|
+
quickquantcfr-1.0.0.dist-info/licenses/LICENSE.txt,sha256=Smblrn_VEFWW0FqWT54cAXtzIbZrnAuOT9314i11qew,1094
|
|
4
|
+
quickquantcfr-1.0.0.dist-info/METADATA,sha256=rnzp4meA1qnwcUmIP9JuZQZ1UJFycMtvNripDPxEc0w,1502
|
|
5
|
+
quickquantcfr-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
quickquantcfr-1.0.0.dist-info/top_level.txt,sha256=vL_rhh9m7jvMT3J27RliY1BlW8t-2Mrpuy7uVVe-zho,14
|
|
7
|
+
quickquantcfr-1.0.0.dist-info/RECORD,,
|
|
@@ -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 @@
|
|
|
1
|
+
quickQuantCFR
|