mirror of
https://github.com/andrewkdinh/fund-indicators.git
synced 2024-11-23 05:54:19 -08:00
Error-handling for plotting linear regression
Moved copyright info to top of files Changed links to relative
This commit is contained in:
parent
67faa403eb
commit
bbc4611af3
@ -27,8 +27,8 @@ There are a few things you might consider when filing your issue:
|
|||||||
|
|
||||||
To develop on fund-indicators you'll probably want to:
|
To develop on fund-indicators you'll probably want to:
|
||||||
|
|
||||||
1. Read the [code of conduct](https://github.com/andrewkdinh/fund-indicators/blob/master/CODE-OF-CONDUCT.md)
|
1. Read the [code of conduct](./CODE-OF-CONDUCT.md)
|
||||||
2. Install normally, as documented in the [README](https://github.com/andrewkdinh/fund-indicators#quickstart)
|
2. Install normally, as documented in the [README](./README.md#quickstart)
|
||||||
3. Read the [documentation](https://github.com/andrewkdinh/fund-indicators/wiki) (although it's not much)
|
3. Read the [documentation](https://github.com/andrewkdinh/fund-indicators/wiki) (although it's not much)
|
||||||
4. Read the section above to understand the ways you could best help this project
|
4. Read the section above to understand the ways you could best help this project
|
||||||
|
|
||||||
|
34
Functions.py
34
Functions.py
@ -1,3 +1,20 @@
|
|||||||
|
'''
|
||||||
|
Copyright (C) 2019 Andrew Dinh
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
'''
|
||||||
|
|
||||||
# Python file for general functions
|
# Python file for general functions
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -256,20 +273,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
'''
|
|
||||||
Copyright (C) 2019 Andrew Dinh
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
'''
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# fund-indicators
|
# fund-indicators
|
||||||
|
|
||||||
[![License](https://img.shields.io/github/license/andrewkdinh/fund-indicators.svg)](https://raw.githubusercontent.com/andrewkdinh/fund-indicators/master/LICENSE)
|
[![License](https://img.shields.io/github/license/andrewkdinh/fund-indicators.svg)](./LICENSE)
|
||||||
[![Latest Commits](https://img.shields.io/github/last-commit/andrewkdinh/fund-indicators.svg)](https://github.com/andrewkdinh/fund-indicators/commits/master)
|
[![Latest Commits](https://img.shields.io/github/last-commit/andrewkdinh/fund-indicators.svg)](https://github.com/andrewkdinh/fund-indicators/commits/master)
|
||||||
![](https://img.shields.io/github/languages/top/andrewkdinh/fund-indicators.svg)
|
![](https://img.shields.io/github/languages/top/andrewkdinh/fund-indicators.svg)
|
||||||
![](https://img.shields.io/github/languages/code-size/andrewkdinh/fund-indicators.svg)
|
![](https://img.shields.io/github/languages/code-size/andrewkdinh/fund-indicators.svg)
|
||||||
@ -45,7 +45,7 @@ python main.py
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Want to help? Great! Check out the [CONTRIBUTING.md](https://github.com/andrewkdinh/fund-indicators/blob/master/CONTRIBUTING.md) file!
|
Want to help? Great! Check out the [CONTRIBUTING.md](./CONTRIBUTING.md) file!
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
64
main.py
64
main.py
@ -1,7 +1,29 @@
|
|||||||
# https://github.com/andrewkdinh/fund-indicators
|
'''
|
||||||
# Determine indicators of overperforming mutual funds
|
__ _ _ _ _ _
|
||||||
# Andrew Dinh
|
/ _| | | (_) | (_) | |
|
||||||
# Python 3.6.7
|
| |_ _ _ _ __ __| | ______ _ _ __ __| |_ ___ __ _| |_ ___ _ __ ___
|
||||||
|
| _| | | | '_ \ / _` | |______| | | '_ \ / _` | |/ __/ _` | __/ _ \| '__/ __|
|
||||||
|
| | | |_| | | | | (_| | | | | | | (_| | | (_| (_| | || (_) | | \__ \
|
||||||
|
|_| \__,_|_| |_|\__,_| |_|_| |_|\__,_|_|\___\__,_|\__\___/|_| |___/
|
||||||
|
|
||||||
|
Project homepage: https://github.com/andrewkdinh/fund-indicators
|
||||||
|
Author: Andrew Dinh <fund-indicators@andrewkdinh.com>
|
||||||
|
|
||||||
|
Copyright (C) 2019 Andrew Dinh
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
'''
|
||||||
|
|
||||||
# PYTHON FILES
|
# PYTHON FILES
|
||||||
import Functions
|
import Functions
|
||||||
@ -551,8 +573,10 @@ class Stock:
|
|||||||
plt.ylabel('Close Values')
|
plt.ylabel('Close Values')
|
||||||
|
|
||||||
# function to show plot
|
# function to show plot
|
||||||
|
try:
|
||||||
|
t = Stock.timePlotIndicatorRegression
|
||||||
plt.show(block=False)
|
plt.show(block=False)
|
||||||
for i in range(3, 0, -1):
|
for i in range(t, 0, -1):
|
||||||
if i == 1:
|
if i == 1:
|
||||||
sys.stdout.write('Keeping plot open for ' +
|
sys.stdout.write('Keeping plot open for ' +
|
||||||
str(i) + ' second \r')
|
str(i) + ' second \r')
|
||||||
@ -561,7 +585,12 @@ class Stock:
|
|||||||
str(i) + ' seconds \r')
|
str(i) + ' seconds \r')
|
||||||
plt.pause(1)
|
plt.pause(1)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
sys.stdout.write(' \r')
|
||||||
|
sys.stdout.flush()
|
||||||
plt.close()
|
plt.close()
|
||||||
|
except:
|
||||||
|
sys.stdout.write(' \r')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
def scrapeYahooFinance(self):
|
def scrapeYahooFinance(self):
|
||||||
# Determine if ETF, Mutual fund, or stock
|
# Determine if ETF, Mutual fund, or stock
|
||||||
@ -1394,6 +1423,7 @@ def plot_regression_line(x, y, b, i):
|
|||||||
plt.ylabel(listOfReturnStrings[i])
|
plt.ylabel(listOfReturnStrings[i])
|
||||||
|
|
||||||
# function to show plot
|
# function to show plot
|
||||||
|
try:
|
||||||
t = Stock.timePlotIndicatorRegression
|
t = Stock.timePlotIndicatorRegression
|
||||||
plt.show(block=False)
|
plt.show(block=False)
|
||||||
for i in range(t, 0, -1):
|
for i in range(t, 0, -1):
|
||||||
@ -1405,10 +1435,12 @@ def plot_regression_line(x, y, b, i):
|
|||||||
str(i) + ' seconds \r')
|
str(i) + ' seconds \r')
|
||||||
plt.pause(1)
|
plt.pause(1)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sys.stdout.write(
|
sys.stdout.write(' \r')
|
||||||
' \r')
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
plt.close()
|
plt.close()
|
||||||
|
except:
|
||||||
|
sys.stdout.write(' \r')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
def persistenceTimeFrame():
|
def persistenceTimeFrame():
|
||||||
@ -1612,7 +1644,6 @@ def main():
|
|||||||
|
|
||||||
runningProgram = True
|
runningProgram = True
|
||||||
while runningProgram is True:
|
while runningProgram is True:
|
||||||
|
|
||||||
if Stock.config == 'N/A':
|
if Stock.config == 'N/A':
|
||||||
# Check that all required packages are installed
|
# Check that all required packages are installed
|
||||||
packagesInstalled = Functions.checkPackages(
|
packagesInstalled = Functions.checkPackages(
|
||||||
@ -1739,20 +1770,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
'''
|
|
||||||
Copyright (C) 2019 Andrew Dinh
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
'''
|
|
||||||
|
Loading…
Reference in New Issue
Block a user