Smart Stock Trader

Built a voice-controlled, standalone device to execute trades and interact with your trading portfolio and the stock market in real-time. I designed a multithreaded, full-software solution in Python, with websockets to handle incoming trade data and a Tkinter based UI. Additionally, I integrated the program onto a Raspberry Pi with sensors for motion-based activation and displays to show stock and portfolio performance. A CAD enclosure was built to house most wiring and to provide a stand for the screen.

By running this program on a Raspberry Pi with a monitor, microphone, PIR sensor, and LED strip, you can have a small desk helper that you can leave running at all times that activates depending on whether you are present or not. This program can also be run on a standard computer (MacOS, Windows, Linux) if desired. Additionally, the PIR sensor and LED strip are not required to run this on the Raspberry Pi.

Software/Embedded concepts and tools used:

  • Multi-Threading (Threads, Thread pools, Locks) to deal with blocking I/O operations
  • HTTP Requests and Websocket connections (with Alpaca finance API)
  • Timers and Interrupts to perform periodic data updates on displayed stocks and for device compatability across market open/close
  • SPI for interfacing with LED strip, RPI.GPIO library used for sensor/hardware interfacing
  • OpenAI's Whisper Speech-to-Text model and Python's SpeechRecognition library for voice capture and command control
  • Tkinter and Matplotlib to build the GUI

Functionality includes:

  • Screen turns on upon detecting your arrival and stays on until you leave
  • Complete voice control
  • View multiple stock graphs + current price
    • Real time updates when markets open through live websocket connections
    • Change time frame of stock graphs (1min, 1h, 1d, 1w, 1m, 1y, 5y)
    • Calibration updates based on if market is open or closed and time frame
  • Change (add, remove, replace) stocks on view with:
    • Specific stocks
    • Top movers (gainers or losers)
    • Stocks in your portfolio
  • Execute market or limit trades (buy or sell) for any stock
    • Quantity of stocks or dollar value of stocks
    • Confirmation and invalid trade checking
    • Paper or real money
  • Green or red glow to signal portfolio gain or loss on the day, respectively

View a live demo at the following link: Video Link