mirror of
https://github.com/andrewkdinh/fund-indicators.git
synced 2024-11-23 02:34:18 -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:
|
||||
|
||||
1. Read the [code of conduct](https://github.com/andrewkdinh/fund-indicators/blob/master/CODE-OF-CONDUCT.md)
|
||||
2. Install normally, as documented in the [README](https://github.com/andrewkdinh/fund-indicators#quickstart)
|
||||
1. Read the [code of conduct](./CODE-OF-CONDUCT.md)
|
||||
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)
|
||||
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
|
||||
|
||||
import sys
|
||||
@ -256,20 +273,3 @@ def main():
|
||||
|
||||
if __name__ == "__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
|
||||
|
||||
[![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)
|
||||
![](https://img.shields.io/github/languages/top/andrewkdinh/fund-indicators.svg)
|
||||
![](https://img.shields.io/github/languages/code-size/andrewkdinh/fund-indicators.svg)
|
||||
@ -45,7 +45,7 @@ python main.py
|
||||
|
||||
## 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
|
||||
|
||||
|
106
main.py
106
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
|
||||
import Functions
|
||||
@ -551,17 +573,24 @@ class Stock:
|
||||
plt.ylabel('Close Values')
|
||||
|
||||
# function to show plot
|
||||
plt.show(block=False)
|
||||
for i in range(3, 0, -1):
|
||||
if i == 1:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' second \r')
|
||||
else:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' seconds \r')
|
||||
plt.pause(1)
|
||||
try:
|
||||
t = Stock.timePlotIndicatorRegression
|
||||
plt.show(block=False)
|
||||
for i in range(t, 0, -1):
|
||||
if i == 1:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' second \r')
|
||||
else:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' seconds \r')
|
||||
plt.pause(1)
|
||||
sys.stdout.flush()
|
||||
sys.stdout.write(' \r')
|
||||
sys.stdout.flush()
|
||||
plt.close()
|
||||
except:
|
||||
sys.stdout.write(' \r')
|
||||
sys.stdout.flush()
|
||||
plt.close()
|
||||
|
||||
def scrapeYahooFinance(self):
|
||||
# Determine if ETF, Mutual fund, or stock
|
||||
@ -1394,21 +1423,24 @@ def plot_regression_line(x, y, b, i):
|
||||
plt.ylabel(listOfReturnStrings[i])
|
||||
|
||||
# function to show plot
|
||||
t = Stock.timePlotIndicatorRegression
|
||||
plt.show(block=False)
|
||||
for i in range(t, 0, -1):
|
||||
if i == 1:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' second \r')
|
||||
else:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' seconds \r')
|
||||
plt.pause(1)
|
||||
try:
|
||||
t = Stock.timePlotIndicatorRegression
|
||||
plt.show(block=False)
|
||||
for i in range(t, 0, -1):
|
||||
if i == 1:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' second \r')
|
||||
else:
|
||||
sys.stdout.write('Keeping plot open for ' +
|
||||
str(i) + ' seconds \r')
|
||||
plt.pause(1)
|
||||
sys.stdout.flush()
|
||||
sys.stdout.write(' \r')
|
||||
sys.stdout.flush()
|
||||
plt.close()
|
||||
except:
|
||||
sys.stdout.write(' \r')
|
||||
sys.stdout.flush()
|
||||
sys.stdout.write(
|
||||
' \r')
|
||||
sys.stdout.flush()
|
||||
plt.close()
|
||||
|
||||
|
||||
def persistenceTimeFrame():
|
||||
@ -1612,7 +1644,6 @@ def main():
|
||||
|
||||
runningProgram = True
|
||||
while runningProgram is True:
|
||||
|
||||
if Stock.config == 'N/A':
|
||||
# Check that all required packages are installed
|
||||
packagesInstalled = Functions.checkPackages(
|
||||
@ -1739,20 +1770,3 @@ def main():
|
||||
|
||||
if __name__ == "__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