stock-prediction-deep-neural-learning

stock-prediction-deep-neural-learning

基于深度学习的股票价格预测系统

这个开源项目利用LSTM神经网络和TensorFlow实现股票价格时间序列预测。它通过yFinance库获取市场数据,分析股票信息、持有人等关键数据。该系统旨在识别股票价格模式,提高预测准确性,为投资决策提供参考。这是一个面向股市分析的人工智能解决方案。

股票预测深度神经网络LSTM时间序列预测yFinanceGithub开源项目

Stock prediction using deep neural learning

Predicting stock prices can be a challenging task as it often does not follow any specific pattern. However, deep neural learning can be used to identify patterns through machine learning. One of the most effective techniques for series forecasting is using LSTM (long short-term memory) networks, which are a type of recurrent neural network (RNN) capable of remembering information over a long period of time. This makes them extremely useful for predicting stock prices.

This TensorFlow implementation of an LSTM neural network can be used for time series forecasting. Successful prediction of a stock's future price can yield significant profits for investors.

1) Introduction

Predicting stock prices is a complex task, as it is influenced by various factors such as market trends, political events, and economic indicators. The fluctuations in the stock prices are driven by the forces of supply and demand, which can be unpredictable at times. To identify patterns and trends in stock prices, deep learning techniques can be used for machine learning. Long short-term memory (LSTM) is a type of recurrent neural network (RNN) that is specifically designed for sequence modeling and prediction. LSTM is capable of retaining information over an extended period of time, making it an ideal approach for predicting stock prices. As a result, RNNs are well-suited to time series data, where they process data step-by-step, maintaining an internal state where they store the information they have seen so far in a compressed form. Accurate prediction of a stock's future price can provide significant financial gain to investors.

2) Stock Market Data

To gather the necessary market data for our stock prediction model, we will utilize the yFinance library in Python. This library is designed specifically for downloading relevant information on a given ticker symbol from the Yahoo Finance Finance webpage. By using yFinance, we can easily access the latest market data and incorporate it into our model.

For our purposes, we will be using the ticker symbol "GOOG", which is a well-known technology company. Here's an example screenshot of the ticker symbol on the Yahoo Finance page:

2.1) Market Info Download

To download the data info, we will need the yFinance library installed and then we will only need to perform the following operation to download all the relevant information of a given Stock using its ticker symbol. Please make sure you use the latest version of the library (pip install yfinance==0.2.33) as I have seen errors with previous versions.

Below is the output from the [download_market_data_info.py] file that is able to download financial data from Yahoo Finance.

C:\Users\thund\Source\Repos\stock-prediction-deep-neural-learning>python download_market_data_info.py Info { "52WeekChange": 0.26037383, "SandP52WeekChange": 0.034871936, "address1": "1600 Amphitheatre Parkway", "algorithm": null, "annualHoldingsTurnover": null, "annualReportExpenseRatio": null, "ask": 1432.77, "askSize": 1400, "averageDailyVolume10Day": 2011171, "averageVolume": 1857809, "averageVolume10days": 2011171, "beta": 1.068946, "beta3Year": null, "bid": 1432.16, "bidSize": 3000, "bookValue": 297.759, "category": null, "circulatingSupply": null, "city": "Mountain View", "companyOfficers": [], "country": "United States", "currency": "USD", "dateShortInterest": 1592179200, "dayHigh": 1441.19, "dayLow": 1409.82, "dividendRate": null, "dividendYield": null, "earningsQuarterlyGrowth": 0.027, "enterpriseToEbitda": 17.899, "enterpriseToRevenue": 5.187, "enterpriseValue": 864533741568, "exDividendDate": null, "exchange": "NMS", "exchangeTimezoneName": "America/New_York", "exchangeTimezoneShortName": "EDT", "expireDate": null, "fiftyDayAverage": 1417.009, "fiftyTwoWeekHigh": 1532.106, "fiftyTwoWeekLow": 1013.536, "fiveYearAverageReturn": null, "fiveYearAvgDividendYield": null, "floatShares": 613293304, "forwardEps": 55.05, "forwardPE": 26.028149, "fromCurrency": null, "fullTimeEmployees": 123048, "fundFamily": null, "fundInceptionDate": null, "gmtOffSetMilliseconds": "-14400000", "heldPercentInsiders": 0.05746, "heldPercentInstitutions": 0.7062, "industry": "Internet Content & Information", "isEsgPopulated": false, "lastCapGain": null, "lastDividendValue": null, "lastFiscalYearEnd": 1577750400, "lastMarket": null, "lastSplitDate": 1430092800, "lastSplitFactor": "10000000:10000000", "legalType": null, "logo_url": "https://logo.clearbit.com/abc.xyz", "longBusinessSummary": "Alphabet Inc. provides online advertising services in the United States, Europe, the Middle East, Africa, the Asia-Pacific, Canada, and Latin America. It offers performance and brand advertising services. The company operates through Google and Other Bets segments. The Google segment offers products, such as Ads, Android, Chrome, Google Cloud, Google Maps, Google Play, Hardware, Search, and YouTube, as well as technical infrastructure. It also offers digital content, cloud services, hardware devices, and other miscellaneous products and services. The Other Bets segment includes businesses, including Access, Calico, CapitalG, GV, Verily, Waymo, and X, as well as Internet and television services. Alphabet Inc. was founded in 1998 and is headquartered in Mountain View, California.", "longName": "Alphabet Inc.", "market": "us_market", "marketCap": 979650805760, "maxAge": 1, "maxSupply": null, "messageBoardId": "finmb_29096", "morningStarOverallRating": null, "morningStarRiskRating": null, "mostRecentQuarter": 1585612800, "navPrice": null, "netIncomeToCommon": 34522001408, "nextFiscalYearEnd": 1640908800, "open": 1411.1, "openInterest": null, "payoutRatio": 0, "pegRatio": 4.38, "phone": "650-253-0000", "previousClose": 1413.61, "priceHint": 2, "priceToBook": 4.812112, "priceToSalesTrailing12Months": 5.87754, "profitMargins": 0.20712, "quoteType": "EQUITY", "regularMarketDayHigh": 1441.19, "regularMarketDayLow": 1409.82, "regularMarketOpen": 1411.1, "regularMarketPreviousClose": 1413.61, "regularMarketPrice": 1411.1, "regularMarketVolume": 1084440, "revenueQuarterlyGrowth": null, "sector": "Communication Services", "sharesOutstanding": 336161984, "sharesPercentSharesOut": 0.0049, "sharesShort": 3371476, "sharesShortPreviousMonthDate": 1589500800, "sharesShortPriorMonth": 3462105, "shortName": "Alphabet Inc.", "shortPercentOfFloat": null, "shortRatio": 1.9, "startDate": null, "state": "CA", "strikePrice": null, "symbol": "GOOG", "threeYearAverageReturn": null, "toCurrency": null, "totalAssets": null, "tradeable": false, "trailingAnnualDividendRate": null, "trailingAnnualDividendYield": null, "trailingEps": 49.572, "trailingPE": 28.904415, "twoHundredDayAverage": 1352.9939, "volume": 1084440, "volume24Hr": null, "volumeAllCurrencies": null, "website": "http://www.abc.xyz", "yield": null, "ytdReturn": null, "zip": "94043" } ISIN - Major Holders 0 1 0 5.75% % of Shares Held by All Insider 1 70.62% % of Shares Held by Institutions 2 74.93% % of Float Held by Institutions 3 3304 Number of Institutions Holding Shares Institutional Holders Holder Shares Date Reported % Out Value 0 Vanguard Group, Inc. (The) 23162950 2020-03-30 0.0687 26934109889 1 Blackrock Inc. 20264225 2020-03-30 0.0601 23563443472 2 Price (T.Rowe) Associates Inc 12520058 2020-03-30 0.0371 14558448642 3 State Street Corporation 11814026 2020-03-30 0.0350 13737467573 4 FMR, LLC 8331868 2020-03-30 0.0247 9688379429 5 Capital International Investors 4555880 2020-03-30 0.0135 5297622822 6 Geode Capital Management, LLC 4403934 2020-03-30 0.0131 5120938494 7 Northern Trust Corporation 4017009 2020-03-30 0.0119 4671018235 8 JP Morgan Chase & Company 3707376 2020-03-30 0.0110 4310973886 9 AllianceBernstein, L.P. 3483382 2020-03-30 0.0103 4050511423 Dividents Series([], Name: Dividends, dtype: int64) Splits Date 2014-03-27 2.002 2015-04-27 1.000 Name: Stock Splits, dtype: float64 Actions Dividends Stock Splits Date 2014-03-27 0.0 2.002 2015-04-27 0.0 1.000 Calendar Empty DataFrame Columns: [] Index: [Earnings Date, Earnings Average, Earnings Low, Earnings High, Revenue Average, Revenue Low, Revenue High] Recommendations Firm To Grade From Grade Action Date 2012-03-14 15:28:00 Oxen Group Hold init 2012-03-28 06:29:00 Citigroup Buy main 2012-04-03 08:45:00 Global Equities Research Overweight main 2012-04-05 06:34:00 Deutsche Bank Buy main 2012-04-09 06:03:00 Pivotal Research Buy main 2012-04-10 11:32:00 UBS Buy main 2012-04-13 06:16:00 Deutsche Bank Buy main 2012-04-13 06:18:00 Jefferies Buy main 2012-04-13 06:37:00 PiperJaffray Overweight main 2012-04-13 06:38:00 Goldman Sachs Neutral main 2012-04-13 06:41:00 JP Morgan Overweight main 2012-04-13 06:51:00 Oppenheimer Outperform main 2012-04-13 07:13:00 Benchmark Hold main 2012-04-13 08:46:00 BMO Capital Outperform main 2012-04-16 06:52:00 Hilliard Lyons Buy main 2012-06-06 06:17:00 Deutsche Bank Buy main 2012-06-06 06:56:00 JP Morgan Overweight main 2012-06-22 06:15:00 Citigroup Buy main 2012-07-13 05:57:00 Wedbush Neutral init 2012-07-17 09:33:00 Outperform main 2012-07-20 06:43:00 Benchmark Hold main 2012-07-20 06:54:00 Deutsche Bank Buy main 2012-07-20 06:59:00 Bank of America Buy main 2012-08-13 05:49:00 Morgan Stanley Overweight Equal-Weight up 2012-09-17 06:07:00 Global Equities Research Overweight main 2012-09-21 06:28:00 Cantor Fitzgerald Buy init 2012-09-24 06:11:00 Citigroup Buy main 2012-09-24 09:05:00 Pivotal Research Buy main 2012-09-25 07:20:00 Capstone Buy main 2012-09-26 05:48:00 Canaccord Genuity Buy main ... ... ... ... ... 2017-10-27 19:29:31 UBS Buy main 2018-02-02 14:04:52 PiperJaffray Overweight Overweight main 2018-04-24 11:43:49 JP Morgan Overweight Overweight main 2018-04-24 12:24:37 Deutsche Bank Buy Buy main 2018-05-05 14:00:37 B. Riley FBR Buy main 2018-07-13 13:49:13 Cowen & Co. Outperform Outperform main 2018-07-24 11:50:55 Cowen & Co. Outperform Outperform main 2018-07-24 13:33:47 Raymond James Outperform Outperform main 2018-10-23 11:18:00 Deutsche Bank Buy Buy main 2018-10-26 15:17:08 Raymond James Outperform Outperform main 2019-01-23 12:55:04 Deutsche Bank Buy Buy main 2019-02-05 12:55:12 Deutsche Bank Buy Buy main 2019-02-05 13:18:47 PiperJaffray Overweight Overweight main 2019-05-15 12:34:54 Deutsche Bank Buy main 2019-10-23 12:58:59 Credit Suisse Outperform main 2019-10-29 11:58:09 Raymond James Outperform main 2019-10-29 14:15:40 Deutsche Bank Buy main 2019-10-29 15:48:29 UBS Buy main 2020-01-06 11:22:07 Pivotal Research Buy Hold up 2020-01-17 13:01:48 UBS Buy main 2020-02-04 12:26:56 Piper Sandler Overweight main 2020-02-04 12:41:00 Raymond James Outperform main 2020-02-04 14:00:36 Deutsche Bank Buy main 2020-02-06 11:34:20 CFRA Strong Buy main 2020-03-18 13:52:51 JP Morgan Overweight main 2020-03-30 13:26:16 UBS Buy main 2020-04-17 13:01:41 Oppenheimer Outperform main 2020-04-20 19:29:50 Credit Suisse Outperform main 2020-04-29 14:01:51 UBS Buy main 2020-05-05 12:44:16 Deutsche Bank Buy main [219 rows x 4 columns] Earnings Empty DataFrame Columns: [Open, High, Low, Close, Adj Close, Volume] Index: [] Quarterly Earnings Empty DataFrame Columns: [Open, High, Low, Close,

编辑推荐精选

TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
蛙蛙写作

蛙蛙写作

AI小说写作助手,一站式润色、改写、扩写

蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。

AI辅助写作AI工具蛙蛙写作AI写作工具学术助手办公助手营销助手AI助手
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

热门AI助手AI对话AI工具聊天机器人
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

下拉加载更多