├── .github └── FUNDING.yml ├── FiAi.png ├── FiAi.py ├── LICENSE └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | 2 | github: [CorvusCodex] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 3 | patreon: # Replace with a single Patreon username 4 | open_collective: # Replace with a single Open Collective username 5 | ko_fi: corvuscodex 6 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 7 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 8 | liberapay: corvuscodex 9 | issuehunt: # Replace with a single IssueHunt username 10 | otechie: # Replace with a single Otechie username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /FiAi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CorvusCodex/FiAi/97e84804dae8ca20d260700ff6e7771d4b18c31e/FiAi.png -------------------------------------------------------------------------------- /FiAi.py: -------------------------------------------------------------------------------- 1 | import yfinance as yf 2 | from sklearn.model_selection import train_test_split 3 | from sklearn.linear_model import LinearRegression 4 | from sklearn import metrics 5 | import numpy as np 6 | import datetime 7 | from art import text2art 8 | 9 | today = datetime.date.today() 10 | 11 | # Generate ASCII art as logo 12 | ascii_art = text2art("FiAi") 13 | 14 | print("============================================================") 15 | 16 | # Print the generated ASCII art 17 | print(ascii_art) 18 | print("Simple price prediction artificial intelligence") 19 | print("============================================================") 20 | print("Created by: Corvus Codex") 21 | print("Github: https://github.com/CorvusCodex/") 22 | print("Licence : MIT License") 23 | print("Support my work:") 24 | print("BTC: bc1q7wth254atug2p4v9j3krk9kauc0ehys2u8tgg3") 25 | print("ETH & BNB: 0x68B6D33Ad1A3e0aFaDA60d6ADf8594601BE492F0") 26 | print("Buy me a coffee: https://www.buymeacoffee.com/CorvusCodex") 27 | print("============================================================") 28 | print("For Symbols use https://finance.yahoo.com/lookup/") 29 | print("============================================================") 30 | 31 | # Ask the user for the stock or currency symbol 32 | symbol = input("Enter the symbol of the stock or currency: ") 33 | 34 | # Download historical data 35 | print("Downloading historical data for training...") 36 | today = datetime.date.today() 37 | data = yf.download(symbol, start='2010-07-17', end=today) 38 | print("Downloaded.") 39 | print("Training...") 40 | 41 | # Prepare data for model and make predictions for high, low, and close prices 42 | predictions = {} 43 | for price_type in ['High', 'Low', 'Close']: 44 | temp_data = data.copy() 45 | temp_data['Prediction'] = temp_data[price_type].shift(-1) 46 | temp_data.dropna(inplace=True) 47 | X = np.array(temp_data.drop(['Prediction'], axis=1)) 48 | Y = np.array(temp_data['Prediction']) 49 | 50 | # Split data into training set and test set 51 | x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.2) 52 | 53 | # Train the model 54 | model = LinearRegression() 55 | model.fit(x_train, y_train) 56 | 57 | # Make predictions 58 | temp_data['Prediction'] = model.predict(np.array(temp_data.drop(['Prediction'], axis=1))) 59 | 60 | # Store predictions 61 | predictions[price_type] = temp_data['Prediction'] 62 | 63 | # Print the predicted price for tomorrow, 7 days, 30 days, 1 year and 10 years from now 64 | print("Training complete.") 65 | print("============================================================") 66 | 67 | for i in [1, 7, 30, 365, 3650]: 68 | if len(data) > i: 69 | print(f"Predicted prices for {i} day(s) from now:") 70 | print(f"High: {predictions['High'].iloc[-i]}") 71 | print(f"Low: {predictions['Low'].iloc[-i]}") 72 | print(f"Close: {predictions['Close'].iloc[-i]}") 73 | print("============================================================") 74 | 75 | print("If you love this program, buy me a coffee: https://www.buymeacoffee.com/CorvusCodex") 76 | print("============================================================") 77 | 78 | # Prevent the window from closing immediately 79 | input('Press ENTER to exit') 80 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 CorvusCodex 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |