Skip to content

henrydavies1/PythonTechnicalTest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Origin Markets Backend Test

Spec:

We would like you to implement an api to: ingest some data representing bonds, query an external api for some additional data, store the result, and make the resulting data queryable via api.

  • Fork this hello world repo leveraging Django & Django Rest Framework. (If you wish to use something else like flask that's fine too.)
  • Please pick and use a form of authentication, so that each user will only see their own data. (DRF Auth Options)
  • We are missing some data! Each bond will have a lei field (Legal Entity Identifier). Please use the GLEIF API to find the corresponding Legal Name of the entity which issued the bond.
  • If you are using a database, SQLite is sufficient.
  • Please test any additional logic you add.

Project Quickstart

Inside a virtual environment running Python 3:

  • pip install -r requirement.txt
  • ./manage.py runserver to run server.
  • ./manage.py test to run tests.

API

We should be able to send a request to:

POST /bonds/

to create a "bond" with data that looks like:

{
    "isin": "FR0000131104",
    "size": 100000000,
    "currency": "EUR",
    "maturity": "2025-02-28",
    "lei": "R0MUWSFPU8MPRO8K5P83"
}

We should be able to send a request to:

GET /bonds/

to see something like:

[
    {
        "isin": "FR0000131104",
        "size": 100000000,
        "currency": "EUR",
        "maturity": "2025-02-28",
        "lei": "R0MUWSFPU8MPRO8K5P83",
        "legal_name": "BNPPARIBAS"
    },
    ...
]

We would also like to be able to add a filter such as: GET /bonds/?legal_name=BNPPARIBAS

to reduce down the results.

User authentication

User authentication is implemented using tokens. To receive a token, a user must first register.

To register a new user, send a request:

POST /register/

with the following JSON data:

{ "username": username, "password": password }

Then, to receive a token send a request:

POST /api-token-auth/

with the same JSON data.

Now when making requests to the /bonds/ endpoint add a header with key Authorization and value Token {token returned from above request}.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%