Code Monkey home page Code Monkey logo

vest_virtual_trading's Introduction

Vest Virtual Trading

Web service (API) that simulates a test environment for trade stocks where a user can buy/sell stocks, hold stocks and track portfolio performance. Vest Virtual Trading

Project Structure

├── db.py
├── docker-compose.yml
├── Dockerfile
├── LICENSE.txt
├── main.py
├── models
│   ├── __init__.py
│   ├── stock_historic.py
│   ├── stock.py
│   └── stock_transacction.py
├── README.md
├── repo-image.jpg
├── repositories
│   ├── __init__.py
│   ├── stock_historic_repository.py
│   ├── stock_repository.py
│   └── stock_transaction_repository.py
├── requirements.txt
├── routers
│   ├── __init__.py
│   └── stocks.py
├── schemas
│   ├── __init__.py
│   ├── enums.py
│   └── stock_schema.py
├── services
│   ├── __init__.py
│   ├── nasdaq.py
│   └── __pycache__
├── tests
│   ├── __init__.py
│   ├── conftest.py
│   └── test_stock.py
├── utils.py

Tech Stack

  • Language: Python3.8
  • Framework: FastAPI
  • Database: SQLite3
  • Lib's: SQLAlchemy (ORM), fastapi_utils (Repeat Task), Pytest

Endpoints

  • POST - /stock/trade (Endpoint for transaction Buy/Sell)
  • GET - /stock/hold (Endpoint for view info of hold stock)
  • GET - /stock/historic/{symbol} (Endpoint for view historic of a stock by symbol)

Installation

Cloning repository

$ git clone https://github.com/rafnixg/vest_virtual_trading.git
$ cd vest_virtual_trading

Create virtual enviroment and install requirements.txt

$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip3 install -r requirements.txt

Usage

Running with uvicorm server development(reload)

$ source venv/bin/activate
(venv) $ uvicorn main:app --reload

Running with uvicorm server production

$ source venv/bin/activate
(venv) $ uvicorn main:app

Show API Docs http://localhost:8000/docs

Testing

Running test in virtual enviroment

$ source venv/bin/activate
(venv) $ pytest

Running test in Docker

$ docker-compose up -d  # Run container in background
$ docker exec -it vest_virtual_trading pytest  # Run test in container
$ docker-compose stop

With Docker

Need to be installed Docker and Docker-compose for run

$ docker-compose build  # Build docker image
$ docker-compose up     # Run docker container

Show API Docs http://localhost:8000/docs

For run docker container in background

$ docker-compose up  -d    # Run docker container

For Stop docker container

$ docker-compose stop     # Stop docker container

Developer Info

  • Rafnix Gabriel Guzmán Garcia, @rafnixg - rafnixg[at]gmail[dot]com

vest_virtual_trading's People

Contributors

rafnixg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.