Skip to content

This application uses the Flask framework to interact with the Alpaca API for trading and real-time data updates via WebSocket. It provides endpoints to start a WebSocket connection, handle trades, and respond to webhooks from TradingView.

Notifications You must be signed in to change notification settings

blkpvnthr/algo-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome!

📡 algo-bot

A real-time trading assistant built with Flask and Python that connects to the Alpaca Markets API to execute live trades, respond to price movements, and receive TradingView alerts via webhooks.


🚀 Features

  • 🔄 Real-Time Data via WebSocket (Alpaca IEX)
  • 🛒 Market Order Execution via Alpaca Trading API
  • 🧠 Trade Triggers Based on Price Movement
  • 📤 Webhook Endpoint for TradingView Alerts
  • 🧵 Multithreaded WebSocket Handling
  • 📋 JSON-Formatted Order Logs for Easy Auditing

🧱 Tech Stack

Tool Purpose
Python Core programming language
Flask Web server and API routing
Alpaca API Trading and market data
WebSocketApp Real-time data stream
HTML/Jinja2 Frontend rendering (basic)
threading Concurrent WebSocket execution

⚙️ API & Webhook Endpoints

POST /trade

Manually submit a trade order:

curl -X POST http://localhost:5000/trade -d "symbol=AAPL&qty=1&side=buy"

POST /webhook

Handle alerts from TradingView or external systems:

{
  "symbol": "AAPL",
  "side": "buy",
  "qty": 1
}

🧪 Strategy Logic (Example)

If QBTS price drops more than $0.05 compared to last recorded trade price → trigger a market buy.


📂 Project Structure

algo-bot/
├── app.py               # Flask + Alpaca integration
├── templates/           # HTML templates (index, response, webhook)
├── static/              # Optional for CSS/JS
├── requirements.txt     # Dependencies

🔒 Security Note

Do NOT commit your Alpaca API credentials. Use environment variables or a secrets manager in production.


🎓 Educational Use

This project was built by Asmaa Abdul-Amin. It demonstrates skills aligned with Quant Developer roles, including:

  • Real-time data ingestion
  • RESTful API integration
  • Conditional logic for trade execution
  • Logging and data serialization

🧠 Author

Asmaa Abdul-Amin
🔗 Portfolio
🐙 GitHub
💼 LinkedIn


⚠️ This project is for educational use only. It does not constitute financial advice or real trading recommendations.

About

This application uses the Flask framework to interact with the Alpaca API for trading and real-time data updates via WebSocket. It provides endpoints to start a WebSocket connection, handle trades, and respond to webhooks from TradingView.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published