Simple trading bot that uses past stock history to buy on dips and sell on peaks.
More Documentation to come. Here is a short explanation.
- Estimate_Profits...py
- Simulates a trading bot.
- The bot buys at the the first price available (previous_buy - last price the stock was purchased at).
- It loops through prices until the price dips to a new buy price or raises to a new sell price. where buy_price = previous_buy*(1-buy_proportion) and sell_price = average_buy*(1+sell_proportion)
- If more stock was bought, it updates the average buy price and continues looping until a new buy price or sell price is hit. (The bot was stop buying more stock after it has bought buys_allowed times.
- If stock was sold, it continues looping through prices and buys when the stock dips by new_buy_proportion below the sell price.
- When the end of the price data is reached, it calculates the estimated profit the bot obtained.
- Loops over multiple new_buy_proportions, buy_propotions, and/or sell_proportions and calculates profit for each.
- Based on the estimated profit on price history data, set a particular new_buy_propotion, buy_proportion, and/or sell_proportion for each ticker. As of right now, this is something that needs to be done manually in InitialTransactionsDictionary.py.
- Setup additional parameters for the bot to use. Examples:
- transactions[ticker]['Available Balance'] - amount of money available for each ticker
- transactions['Max Buys'] - the maximum number of times the bot can buy the same stock
- Open and run 'Main_Bot_Runner.py'. Bot will place buy and and sell orders on your TD Ameritrade account. I recommend setting the sell_proportion at 3 percent or more; otherwise, TD Ameritrade may contact you to make trades less frequently.
- Type in 'Check' into the terminal. The transactions dictionary will be printed to the screen.