/limit-order-api

Order Book API in Python 📈💰

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

License People Stars Forks Watches Last Updated

Order Book API in Python 📈💰

limit-order-api is an api that provides order book functionality for trading.

  • Easy to use REST API.
  • OpenAPI documentation included.
  • Easy setup and package management with Poetry.
  • Implemented with Test Driven Development (>90% Coverage).
  • Fast and powerful CI with GitHub actions.

⚡ Setup

⚙️ Requirements

  • Python 3.10+
  • Poetry (run curl -sSL https://install.python-poetry.org | python3 -)

💻 Setup

Setting up limit-order-api is as simple as cloning and running the server.

git clone https://github.com/2kabhishek/limit-order-api
cd limit-order-api

# install dependencies
poetry install

# database migrations
poetry run alembic upgrade head

# run tests
poetry run pytest

# run server
poetry run uvicorn limit_order_api.main:app --reload
# or
poetry run dev

The Open API documentation is available at http://localhost:8000/docs once the server is running.

🚀 Usage

📦 More Commands

# create a new migration
poetry run alembic revision --autogenerate -m "migration message"

# migration history
poetry run alembic history

# run tests with coverage
poetry run pytest --cov=limit_order_api

🏗️ What's Next

✅ To-Do

  • Add a trade execution and publisher system as a separate service.
  • Setup docker compose for easy deployment and testing.

🧑‍💻 Behind The Code

🌈 Inspiration

Learning more about trading systems and trying out some python libs.

💡 Challenges/Learnings

  • FastAPI with Poetry, Alembic, and SQLAlchemy was interesting to setup.

🧰 Tooling


⭐ hit the star button if you found this useful ⭐

Source | Blog | Twitter | LinkedIn | More Links | Other Projects