Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

GrahamboJangles/TradeBotPy

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
63 Commits
 
 
 
 
 
 

Repository files navigation

Open In Colab

  • The most turn-key open-source trading framework.

  • Uses Alpaca

  • Is lite enough to run on a Raspberry Pi Zero.

  • Backtesting and live trading in the same script, just change the backtesting variable.

  • Just add your own strategy and have it return an advice column.

  • Enter your own email credentials for error reporting.

  • Enter your own API keys.

  • Pull requests welcome.

Instructions:

  • Input your Alpaca API Key and API Secret key to lines 23 and 24.
  • Add your own strategy to get_advice() (line 500). The strategy should return a list advice (["buy", "sell", "buy", "buy", "sell"]) and a variable last_advice of the last string in advice.

TO DO:

  • limit the amount of data downloaded during live trading, right now it downloads all data since first trade but that will slow down the script over time
    • i just limited it to 100 minutes as of right now
  • if order declined due to pattern day trading protections, wait till tomorrow?
    • maybe if last_equity < 25k and day_trades == 3, don't allow any trades

kind of done:

  • if past market hours and holding positions, close them

Low priority:

  • correlation graph of bot performance backtest & profit
  • add some additional statistical analysis to the backtesting (STD, # of days up/# of days down)
  • backtest AMZN ext market limit order, gradually increase limit_order difference if not filled with no shorting

DONE:

  • might need to add something to check if this has already been run because it appends over and over if i run it multiple times
  • get rid of HOLD, and just replace with previous action
  • if we can't buy QUANTITY, then trade CASH / limit_price
  • MAKE SURE THAT WE'RE NOT GOING SHORT EVER ok maybe not
  • backtest on AMZN cuz of its high price - DONE, it performed awful
  • make it so the loading bar is only called if it will take a certain amount of time
  • replace orders with order function
  • add margin options
  • check if need to trade during extended hours
  • maybe I shouldn't do extended hours, it doesn't really seem to be worth it
  • additonally, backtest closing positions before market close
  • backtest with 2-4x margin during market hours
  • maybe stop using market orders, seem to be losing quite a bit to slippage depending on volitility
  • add a test to see if we actually get filled, and if not, try again
  • maybe add a debugging mode to print stuff
  • add a graph using Alpaca order data and put it underneath the backtesting graph to compare
  • change the wait time until next day to wait for a specific time delta instead of checking every minute
  • change the closing all positions because of using too much cash to correct to the amount of shares that we want instead of closing out
  • add loading bar for waiting until open
  • sometimes the market closes early on holiday's, should change the close early to a variable using API close times
  • check the amount of usable cash before each trade to prevent overbuying or selling
  • make strategy volatility adjustable
  • going from short to long makes the bot buy too much, but is corrected shortly
Morty Proxy This is a proxified and sanitized view of the page, visit original site.