Skip to content

dancost/trading_platform_sim

Repository files navigation

Trading Platform Simulator

This repository contains the Trading Platform Simulator, a FastAPI application that supports WebSockets connections and related tests.

Table of Contents

Prerequisites

Before running the application and tests, ensure you have the following installed:

Setup

Windows

  1. Clone the repository:
    git clone https://github.com/dancost/trading_platform_sim.git
    cd trading_platform_sim

Linux

  1. Clone the repository:
    git clone https://github.com/dancost/trading_platform_sim.git
    cd trading_platform_sim

Running the Server and Tests

Windows

  1. Ensure Docker is running.

  2. Open a terminal (PowerShell) and navigate to the project directory:

    cd trading_platform_sim
  3. Define the environment variable for the desired test plan:

    • Smoke test plan:

      $env:PYTEST_ARGS="-s -v -m smoke --html=test_results/report.html --self-contained-html --capture=sys"
    • Negative test plan:

      $env:PYTEST_ARGS="-s -v -m negative --html=test_results/report.html --self-contained-html --capture=sys"
    • Websockets test plan:

      $env:PYTEST_ARGS="-s -v -m ws --html=test_results/report.html --self-contained-html --capture=sys"
    • Performance test plan:

      $env:PYTEST_ARGS="-s -v -m performance --html=test_results/report.html --self-contained-html --capture=sys"
    • Run all tests:

      $env:PYTEST_ARGS="-s -v --html=test_results/report.html --self-contained-html --capture=sys"
  4. Build and run the Docker containers:

    docker-compose up --build

Linux

Tested on:

  • Docker version 24.0.7
  • docker-compose version 1.29.2
  • Ubuntu 22.04.1
  1. Ensure Docker is running.

  2. Open a terminal and navigate to the project directory:

    cd trading_platform_sim
  3. Define the environment variable for the desired test plan:

    • Smoke test plan:

      export PYTEST_ARGS="-s -v -m smoke --html=test_results/report.html --self-contained-html --capture=sys"
    • Negative test plan:

      export PYTEST_ARGS="-s -v -m negative --html=test_results/report.html --self-contained-html --capture=sys"
    • Websockets test plan:

      export PYTEST_ARGS="-s -v -m ws --html=test_results/report.html --self-contained-html --capture=sys"
    • Performance test plan:

      export PYTEST_ARGS="-s -v -m performance --html=test_results/report.html --self-contained-html --capture=sys"
    • Run all tests:

      export PYTEST_ARGS="-s -v --html=test_results/report.html --self-contained-html --capture=sys"
  4. Build and run the Docker containers:

    docker-compose up --build

Swagger Documentation

Once the server is running, you can access the Swagger documentation at the following URL:

This documentation provides an interactive interface to explore the API endpoints and test them.

  • an offline version of the openapi.yaml can also be found here

Test Report

The test report will be generated and can be found at:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages