All Projects → TimRivoli → Stock Price Trade Analyzer

TimRivoli / Stock Price Trade Analyzer

Licence: gpl-3.0
This is a Python 3.0 project for analyzing stock prices and methods of stock trading. It uses native Python tools and Google TensorFlow machine learning.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Stock Price Trade Analyzer

Kupi Terminal
Ccxt based, open source, customized, extendable trading platform that supports 130+ crypto exchanges.
Stars: ✭ 104 (+197.14%)
Mutual labels:  trading-api, trading-strategies, stock-data
Tradinggym
Trading and Backtesting environment for training reinforcement learning agent or simple rule base algo.
Stars: ✭ 813 (+2222.86%)
Mutual labels:  trading-api, trading-strategies, reinforcement-learning
FAIG
Fully Automated IG Trading
Stars: ✭ 134 (+282.86%)
Mutual labels:  trading-api, trading-strategies, stock-data
Personae
📈 Personae is a repo of implements and environment of Deep Reinforcement Learning & Supervised Learning for Quantitative Trading.
Stars: ✭ 1,140 (+3157.14%)
Mutual labels:  stock-data, reinforcement-learning
Machine Learning Notebooks
Machine Learning notebooks for refreshing concepts.
Stars: ✭ 222 (+534.29%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Aleph star
Reinforcement learning with A* and a deep heuristic
Stars: ✭ 235 (+571.43%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Quant
Codera Quant is a Java framework for algorithmic trading strategies development, execution and backtesting via Interactive Brokers TWS API or other brokers API
Stars: ✭ 104 (+197.14%)
Mutual labels:  trading-api, trading-strategies
Sumzerotrading
A Java API for Developing Automated Trading Applications for the Equity, Futures, and Currency Markets
Stars: ✭ 128 (+265.71%)
Mutual labels:  trading-api, stock-data
Zerodha live automate trading using ai ml on indian stock market Using Basic Python
Online trading using Artificial Intelligence Machine leaning with basic python on Indian Stock Market, trading using live bots indicator screener and back tester using rest API and websocket 😊
Stars: ✭ 131 (+274.29%)
Mutual labels:  trading-api, trading-strategies
Awesome Monte Carlo Tree Search Papers
A curated list of Monte Carlo tree search papers with implementations.
Stars: ✭ 387 (+1005.71%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Machine Learning And Ai In Trading
Applying Machine Learning and AI Algorithms applied to Trading for better performance and low Std.
Stars: ✭ 258 (+637.14%)
Mutual labels:  trading-strategies, machine-learning-algorithms
Machine Learning Articles
Monthly Series - Top 10 Machine Learning Articles
Stars: ✭ 516 (+1374.29%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Free Ai Resources
🚀 FREE AI Resources - 🎓 Courses, 👷 Jobs, 📝 Blogs, 🔬 AI Research, and many more - for everyone!
Stars: ✭ 192 (+448.57%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Aixijs
AIXIjs - General Reinforcement Learning in the Browser
Stars: ✭ 128 (+265.71%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Learningx
Deep & Classical Reinforcement Learning + Machine Learning Examples in Python
Stars: ✭ 241 (+588.57%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Machine learning lectures
Collection of lectures and lab lectures on machine learning and deep learning. Lab practices in Python and TensorFlow.
Stars: ✭ 118 (+237.14%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Papers Literature Ml Dl Rl Ai
Highly cited and useful papers related to machine learning, deep learning, AI, game theory, reinforcement learning
Stars: ✭ 1,341 (+3731.43%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Machine Learning From Scratch
Succinct Machine Learning algorithm implementations from scratch in Python, solving real-world problems (Notebooks and Book). Examples of Logistic Regression, Linear Regression, Decision Trees, K-means clustering, Sentiment Analysis, Recommender Systems, Neural Networks and Reinforcement Learning.
Stars: ✭ 42 (+20%)
Mutual labels:  reinforcement-learning, machine-learning-algorithms
Kelp
Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Stars: ✭ 580 (+1557.14%)
Mutual labels:  trading-api, trading-strategies
Awesome Quant
A curated list of insanely awesome libraries, packages and resources for Quants (Quantitative Finance)
Stars: ✭ 8,205 (+23342.86%)
Mutual labels:  trading-strategies, stock-data

This is a Python 3.0 project for analyzing stock prices and methods of stock trading. It uses native Python tools and Google TensorFlow machine learning. It has two main class modules PriceTradeAnalyzer and SeriesPrediction described below.

Module: PriceTradeAnalyzer Class PricingData Given a stock ticker, this will go out and download historical price data from https://stooq.com. I've had good success with this site. The data set for ^SPX on stooq.com goes by to May 1, 1789 which is fairly comprehensive considering the index was created in 1926. Downloaded data is cached to .csv file and stored in a Pandas dataframe which is easy to manipulate. PricingData helper functions allow you to TrimToDateRange, ConvertToPercentages, NormalizePrices, CalculateStats (EMA, channels, momentum, etc), perform time frame graphing (using matplotlib), and a few other bells and whistles. There are also several prediction models for predicting future prices. Two options use the SeriesPrediction.py class to perform LSTM and CNN machine learning for their predictions.

EvaluatePrices.py shows how to use the PricingData class to PlotAnnualPerformance of a stock, DownloadAndGraphStocks for a list of stocks such as the S&P 500, CalculatePriceCorrelation of a list of stocks, OpportunityFinder to identify recent drops or over-bought/over-sold conditions from a list of stocks.

Classes Portfolio and TradingModel are used to test emulations of trading strategies. EvaluateTradeModels.py shows examples of how to the TradingModel class to create and test trading strategies. The models will use actual historical prices from PricingData. You specify the stocks you want to work with, the time frame you want to test against, and the logic you want to use for buying and selling. Example strategies are included for BuyAndHold, Seasonal investing, and two different Trending approaches. The resulting daily value and trade history are dataframes which are graphed and saved to .csv and .png files so you can view the performance details later. ExtendedDurationTest allows you to test the performance of any model over various time frames and durations. CompareModels allows you to compare the performance of any two models over a given time period. It would be great to create a re-enforcement learning module using Deep Q or Policy Gradient. I'm also thinking of making a stock trading game and using the code to run it against historical time periods. It could be a good educational tool. I know it has been for me!

Class ForcastModel has been added to forecast the effect of a series of potential actions on a TradingModel. I'm using this to create a "best actions" sequence for supervised machine learning in another project. Given a market state and a sequence of actions (or every possible action) which one produces the best result after X days. This can then be used to train a robotic trainer with supervised learning.

Module: SeriesPrediction Class StockPredictionNN uses LSTM (Long Short Term Memory) and CNN (Convolutional Neural Network) learning functions to predict future prices. These use Google TensorFlow 1.5.0. The LSTM and CNN models have been updated to use Keras which greatly simplifies the code.

TrainPrices.py shows samples of using the StockPredictionNN class to train and test PricingData using LSTM and CNN machine learning techniques.

PredictionExperiment.py tests three methods of predicting future stock prices. Linear (future price in x days with be a straight line from the previous x days), CNN Learning, and LSTM learning. This tests three questions: 1) Linear - How often can future prices be directly determined by plotting a straight line from past prices? 2) CNN - to what extent does the visual shape of past prices determine future prices 3) LSTM - are there patterns in the series of prices which can be used to predict future prices? The answers certainly surpised me. Feel free to run your own tests. The results in "Prediction Accuracy Tests.ods" are from the models used in the March version of the code which has since been reworked. I haven't re-run all the same tests. The tests were for 750 epochs using the SP500 index data from 1950 to the present with prices normalized. I stopped at 750 epochs because I didn't find the accuracy improving much with futher interations. I was surprised that normalization improved the accuracy, while converting the numbers to percentage change from the previous day greatly reduced the accuracy, as did introducing additional features to the input. If you would like to do your own tests I recommend using TestPredictionModels from TrainPrices.py as it will do all the work of conversions and plotting for you with just a few parameter values.

Special thanks to these people for helping me understand deep neural network machine learning: Siraj Raval: https://www.linkedin.com/in/sirajraval/ Magnus Erik Hvass Pedersen: https://github.com/Hvass-Labs/TensorFlow-Tutorials Nicholas T. Smith https://nicholastsmith.wordpress.com/ Luka Anicin: https://github.com/lucko515/tesla-stocks-prediction

I've tested this on both Windows 10 Python 3.6.4 and AWS Linux Python 3.6.2. Both versions use TensorFlow 1.5.0. Requirements: happily all native Python 3.6 and no C++ compilers Windows PIP install requirements with: pip install numpy pip install pandas pip install matplotlib pip install tensorflow pip install keras

AWS install requirements with: python3 -m pip install numpy --upgrade python3 -m pip install pandas --upgrade python3 -m pip install tensorflow --upgrade python3 -m pip install keras --upgrade

Note about using an AWS instance: There is no GUI so I've added a switch to enable the Agg non-interactive back-end for matplotlib. Also, it can be difficult to access web sites from within AWS as some sites block hosted IP ranges and python response headers, so I've added a web-proxy option to get around this. We should bear in mind that the reason sites put these blocks in place is to avoid abuse of their services, so please be kind and don't abuse free services.

Have fun and keep programming! -Tim

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].