Found 261 repositories(showing 30)
notadamking
A custom OpenAI gym environment for simulating stock trades on historical price data.
MingyuJ666
[Preprint] Large Language Model-based Stock Trading in Simulated Real-world Environments
notadamking
A simple, yet elegant visualization of our stock trading RL agent environment.
This project uses Deep Reinforcement Learning (DRL) to develop and evaluate stock trading strategies. By implementing agents like PPO, A2C, DDPG, SAC, and TD3 in a realistic trading environment with transaction costs, it aims to optimize trading decisions based on return, volatility, and Sharpe ratio.
This is a repo for deep reinforcement learning in trading. I used value based double DQN variant for single stock trading. The agent learn to make decision between selling, holding and buying stock with fixed amount based on the reward returned from the environment.
Performing a trading strategy using deep deterministic policy gradients to know when to buy, hold or sell stocks in a virtual environment that simulates stock prices.
Maran1947
Stockify is a virtual trading platform designed to provide users with an interactive experience in simulated stock trading. With a range of features and risk management tools, Stockify allows users to practice trading in a realistic environment without the risk of losing real money.
ginking
Archimedes 1 is a bot based sentient based trader, heavily influenced on forked existing bots, with a few enhancements here or there, this was completed to understand how the bots worked to roll the forward in our own manner to our own complete ai based trading system (Archimedes 2:0) This bot watches [followed accounts] tweets and waits for them to mention any publicly traded companies. When they do, sentiment analysis is used determine whether the opinions are positive or negative toward those companies. The bot then automatically executes trades on the relevant stocks according to the expected market reaction. The code is written in Python and is meant to run on a Google Compute Engine instance. It uses the Twitter Streaming APIs (however new version) to get notified whenever tweets within remit are of interest. The entity detection and sentiment analysis is done using Google's Cloud Natural Language API and the Wikidata Query Service provides the company data. The TradeKing (ALLY) API does the stock trading (changed to ALLY). The main module defines a callback where incoming tweets are handled and starts streaming user's feed: def twitter_callback(tweet): companies = analysis.find_companies(tweet) if companies: trading.make_trades(companies) twitter.tweet(companies, tweet) if __name__ == "__main__": twitter.start_streaming(twitter_callback) The core algorithms are implemented in the analysis and trading modules. The former finds mentions of companies in the text of the tweet, figures out what their ticker symbol is, and assigns a sentiment score to them. The latter chooses a trading strategy, which is either buy now and sell at close or sell short now and buy to cover at close. The twitter module deals with streaming and tweeting out the summary. Follow these steps to run the code yourself: 1. Create VM instance Check out the quickstart to create a Cloud Platform project and a Linux VM instance with Compute Engine, then SSH into it for the steps below. The predefined machine type g1-small (1 vCPU, 1.7 GB memory) seems to work well. 2. Set up auth The authentication keys for the different APIs are read from shell environment variables. Each service has different steps to obtain them. Twitter Log in to your Twitter account and create a new application. Under the Keys and Access Tokens tab for your app you'll find the Consumer Key and Consumer Secret. Export both to environment variables: export TWITTER_CONSUMER_KEY="<YOUR_CONSUMER_KEY>" export TWITTER_CONSUMER_SECRET="<YOUR_CONSUMER_SECRET>" If you want the tweets to come from the same account that owns the application, simply use the Access Token and Access Token Secret on the same page. If you want to tweet from a different account, follow the steps to obtain an access token. Then export both to environment variables: export TWITTER_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" export TWITTER_ACCESS_TOKEN_SECRET="<YOUR_ACCESS_TOKEN_SECRET>" Google Follow the Google Application Default Credentials instructions to create, download, and export a service account key. export GOOGLE_APPLICATION_CREDENTIALS="/path/to/credentials-file.json" You also need to enable the Cloud Natural Language API for your Google Cloud Platform project. TradeKing (ALLY) Log in to your TradeKing (ALLY account and create a new application. Behind the Details button for your application you'll find the Consumer Key, Consumer Secret, OAuth (Access) Token, and Oauth (Access) Token Secret. Export them all to environment variables: export TRADEKING_CONSUMER_KEY="<YOUR_CONSUMER_KEY>" export TRADEKING_CONSUMER_SECRET="<YOUR_CONSUMER_SECRET>" export TRADEKING_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" export TRADEKING_ACCESS_TOKEN_SECRET="<YOUR_ACCESS_TOKEN_SECRET>" Also export your TradeKing (ALLY) account number, which you'll find under My Accounts: export TRADEKING_ACCOUNT_NUMBER="<YOUR_ACCOUNT_NUMBER>" 3. Install dependencies There are a few library dependencies, which you can install using pip: $ pip install -r requirements.txt 4. Run the tests Verify that everything is working as intended by running the tests with pytest using this command: $ export USE_REAL_MONEY=NO && pytest *.py --verbose 5. Run the benchmark The benchmark report shows how the current implementation of the analysis and trading algorithms would have performed against historical data. You can run it again to benchmark any changes you may have made: $ ./benchmark.py > benchmark.md 6. Start the bot Enable real orders that use your money: $ export USE_REAL_MONEY=YES Have the code start running in the background with this command: $ nohup ./main.py & License Archimedes (edits under Invacio) Max Braun Frame under Max Braun, licence under Apache V2 License. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
hoangsonww
📈 This repository hosts a Stock Market Simulation in Python, providing tools to mimic market behaviors, portfolio management, and trading strategies. It serves as an educational resource for learning about financial markets and algorithmic trading, offering a practical platform for testing theories and strategies in a risk-free environment.
TimRivoli
This is a supervised Recurrent Neural Network (RNN) learning project treating stock trading as a classification problem. Given input of a 60 day window of pricing data, choose the best action for maximum profit. This uses my earlier https://github.com/TimRivoli/Stock-Price-Trade-Analyzer project for a trading environment, and its SeriesPrediction module for data preparation and model training.
The basis of this project involves analyzing Amgen future profitability based on its current business environment and financial performance. Technical Analysis, on the other hand, includes reading the charts and using statistical figures to identify the trends in the stock market. The dataset used for this analysis was downloaded from Yahoo finance for year 2009 to 2019. There are multiple variables in the dataset – date, open, high, low, volume. Adjusted close. The columns Open and Close represent the starting and final price at which the stock is traded on a day. High and Low represent the maximum, minimum price of the share for the day. The profit or loss calculation is usually determined by the closing price of a stock for the day, I used the adjusted closing price as the target variable. I downloaded data on the inflation rate, unemployment rate, Industrial Production Index, Consumer Price Index for All Urban Consumers: All Items and Real Gross Domestic Product as independent variables, Quarterly Financial Report: U.S. Corporations: Cash Dividends Charged to Retained Earnings All Manufacturing: All Nondurable Manufacturing: Chemicals: Pharmaceuticals and Medicines Industry, Producer Price Index by Industry: Pharmaceutical Preparation Manufacturing, 30-Year Treasury Constant Maturity Rate, and Producer Price Index by Industry: Pharmaceutical and Medicine Manufacturing Index. The independent variables are economic parameters which was obtained from Federal Reserve Economic Data (FRED) website. Methodology 1. Linear Regression: The linear regression model returns an equation that determines the relationship between the independent variables and the dependent variable. I used linear regression tool in Alteryx with ARIMA tool to forecast the stock prices for the year. The algorithm was trained with the historical data to see how the variables impact on the dependent variable. The test data was used to predict the adjusted closing price for the year and predicted a stock price of $193.38. 2. Support Vector Machines (SVM): Support Vector Networks (SVN), are a popular set of supervised learning algorithms originally developed for classification (categorical target) problems and can be used for regression (numerical target) problems. SVMs are memory efficient and can address many predictor variables. This model finds the best equation of one predictor, a plane (two predictors) or a hyperplane (three or more predictors) that maximally separates the groups of records, based on a measure of distance into different groups based on the target variable. A kernel function provides the measure of distance that causes to records to be placed in the same or different groups and involves taking a function of the predictor variables to define the distance metric. I used the SVM tool in Alteryx with ARIMA tool to forecast the stock prices for the year and predicted a stock price of $189.44. 3. Spline Model: The Spline Model tool was used because it provides the multivariate adaptive regression splines (or MARS) algorithm of Friedman. This statistical learning model self-determines which subset of fields best predict a target field of interest and can capture highly nonlinear relationships and interactions between fields. I used the Spline tool in Alteryx with ARIMA tool to forecast the stock prices for the year and predicted a stock price of $201.84. The results from the models was weighted by comparing the RMSE of each model. A lower RMSE indicates that the model’s predictions were closer to the actual values. However, a simpler model with the same RMSE as a more complex model is generally better, as simpler models are less likely to be overfit. Though the Spline model had a lower RMSE, the Linear Regression model had fewer variables. Thus, we combined the 3 models with the ARIMA forecast in a model ensemble, which allows us to use the results of multiple models. The forecasted stock price is $197.99 with 1.5% increase for 31st December 2019. Apart from economic parameters, stock price is affected by the news about the company and other factors like demonetization or merger/demerger of the companies. There are certain intangible factors which can often be impossible to predict beforehand hence the model predicts that the stock price of Amgen will continue to rise except there is a drastic downturn of the company.
cTatu
Gym environment for stock trading featuring indicators, time series normalization and backtesting
Tahernezhad
DQN stock-trading agent with a custom Gymnasium environment and yfinance data.
Ketan-coder
The Paper Trading Web Application is a Django-based platform that simulates stock and options trading in a risk-free environment.
Trading AAPL stock with an agent using stablebaselines3 and anytrading environment.
MFaizan18
Experience the fusion of finance and artificial intelligence with this cutting-edge project that implements a deep reinforcement learning agent for automated stock trading. Leveraging advanced neural network architectures and a meticulously crafted reward function, the agent learns to make profitable trading decisions in a simulated environment
vishalvijay
Match Your Market (Mym) Introduction The application is a game called “Match Your Market” (Mym). The game is divided into two parts where the user is given a Virtual Share Market to get a feel of functioning of trading and a Quiz part to enrich his know how about the various technicalities related to trading. He is provided with an environment which emulates a market and allowed to perform basic functions such as buy and sell shares of a particular company which is enlisted. The aim is to familiarize a person to the environment of the share market in a fun way where he can get a sense of how the market functions. The player should aim to maximize his profits to end up on top of the leader board and claim the title of “The Richest Man Alive”. This drives the player to make calculated and smart decisions in order to make it to the top. The Quiz part of the game is to help the player understand about various things related to the world of trading. Through the Quiz the player stands to earn money to be used to trade in “The Market”. The objective of the Quiz is to create awareness and educate the player about the terminologies and other basics related to share market. Application Components Splash Screen: The splash screen consists of the application name being displayed whilst the application is loading. Menu: The user can pull out the menu panel by performing the swipe motion from the extreme right part of the screen to the left or by performing the touch gesture on the “Mym” logo. The Menu consists of 6 sections: Quiz: This section takes the user to the Quiz part of the game. The basic aim of the quiz is to help the players get familiar to the world of trading. The quiz is a medium for the players to generate money to be used in “The Market” part of the application. The Quiz can be attended at any time and the user can increase his capital using the Quiz. The Market: This section is the Virtual market presented to the user. The virtual market is created to give a feel of how the market operates and what are the basic operations that take place in the market. Each session of “The Market” lasts for an hour. The moment the user starts “The Market” that particular session lasts for an hour and after that the market closes for that session. Stock Status: This section shows the players the status of the stock when the market is closed. My Shares: This section is an account of all the shares purchased by the user. Here the user can find how much money he has invested in a particular company and the amount of shares he holds. 1 Leaderboard: This section is used to introduce competitiveness among the users. The person with the maximum money in hand leads the board. This will encourage the players to use the application more in order to obtain the coveted title of “The Richest Man Alive”, which is given to the person who leads the table. News: The News section features the latest news related to the market and the financial world. This section will help keep the user up-to-date with the latest happenings and help him enhance his knowledge . Scores: The user can score from both the Quiz part and the market part of the game. Quiz-Scoring pattern: The user is awarded Rs.500/- for a correct answer. If the user continues giving the right answers for the succeeding questions then he is given a multiple of the spree as reward for that question. This encourages the users to take the Quiz as an opportunity to redeem themselves in case they run into a low in the Market part. For Example: Suppose the user answers one question correct he is given Rs.500/-. If he answers the next one correct he is awarded a sum of 2*Rs500/-=Rs.1000/-, for the second question. If he gets 3 in a row the third question will contain a value of 3*Rs500/-=Rs.1500/- and so on. Market-Scoring Pattern: The user is allowed to use the money he generates from the quiz in the market where he can do the basic operations like buy and sell. The market brings in the entertain quotient to the game where the user stands a chance to make a fortune by making investments. Help: This section gives a detail on the scoring pattern and the goal of the game.
jawadrada
The Stock Simulation App is a platform designed to simplify stock trading for beginners by providing a risk-free, virtual trading environment.
MoHoss007
This project implements a stock trading simulation environment and trains reinforcement learning agents to make buy/sell/hold decisions.
kush-agra-soni
This project implements a real-time stock price prediction system using machine learning models. It gathers live market data, preprocesses it, and predicts future stock prices. The system can be used for financial analysis or trading strategies, with a focus on accuracy and speed in real-time environments.
Ayushix17
This is about designing a self-learning agent tha interacts with the stock market data(or crypto/forex) and learns to buy/sell/hold based on reward signals. The tools and techniques used are - Custom Trading Environments and Financial APIs(like Alpha Vantage, Yahoo Finance)
VinayJogani14
Implemented a Deep Q-Network (DQN) based reinforcement learning system for automated pairs trading. Built a custom Gym-like environment with real-time feature engineering on stock spreads, volatility, and rolling means, enabling dynamic decision-making and optimized portfolio performance in varying market conditions.
priyankag12
This project is a paper trading platform designed to help users simulate stock market trading in a gamified environment.
melseifi
basic trading environment using stock prices
willarliss
Continuous stock trading environment for reinforcement learning.
Ankit-Saha-2003
Gym environment for reinforcement learning in stock trading
mverost44
TradeStation Client: Built with React, allows users to test trading strategies in a safe market environment. It features real-time market data from a 3rd party API and interactive stock charts.
KodeUniverse
Deep RL backtesting on cryptocurrency. Code repurposed from https://github.com/notadamking/Stock-Trading-Environment.
karimelhage
Build of a Stock Trading Game using Open AI's gym Environment and implementation of RL agents to attempt to maximise a portfolio's reward.
jtylerleake
A reinforcement learning framework that combines Gramian Angular Field image encodings with multi-stock trading environments to train RL agents on visual representations of timeseries data.