Giter Club home page Giter Club logo

drf_transactions's Introduction

Intro

This project contains a simple Django REST framework webserver which allows for tracking of financial trading transactions. In its simplest form, it will ingest a payload containing decimal parameters of "price", "quantity", and string parameter of "symbol", then calculate the total transaction cost and add it to a database.

The project could be enhanced with an additional parameter of "purchased timestamp", indicating when the order was originally executed.

Setup

From within the 'drf_transactions' project folder containing 'manage.py', perform the following steps.

Create & Activate Python3 virtual environment

The following commands will create a new Python3 virtual environment named 'env' and activate it. This allows for project-based isolation of your Python3 environment, ensuring a fresh installation for each project.

python3 -m venv env
source env/bin/activate

Install Django and Django REST Framework

pip install django
pip install djangorestframework

Initialize Database

python manage.py makemigrations transactions
python manage.py migrate transactions

Run Development Webserver

The following command will start the Django development webserver, which listens on 0.0.0.0:8000 by default.

python manage.py runserver

This can be modified by specifying [address]:[port] following the 'runserver' parameter. For example, the following will start the webserver and listen on port 8443.

python manage.py runserver 0.0.0.0:8443

Your Transactions webserver should now be listening on 127.0.0.1:8000, unless a custom port was specified.

Testing

Example POST

POST http://127.0.0.1:8000/transactions/
{
    "price": "35000.00",
    "quantity": ".000015",
    "symbol": "btc"
}

Example List all Transactions

GET http://127.0.0.1:8000/transactions/

drf_transactions's People

Watchers

Matt Bowler 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.