Giter Club home page Giter Club logo

developer-pratik-baisware / codebase-stock-trade-api-hackerrank Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saieshwar/stock-trade-api-hackerrank

0.0 0.0 0.0 24 KB

This is a prototype for building a brokerage company's account and trades management platform. One Requirement is for a REST API service to manage trades using the Spring Boot framework. Add functionality to add or delete transactions as well as to perform some queries.

Java 100.00%

codebase-stock-trade-api-hackerrank's Introduction

Stock-Trade-API-Hackerrank

This is a prototype for building a brokerage company's account and trades management platform. One Requirement is for a REST API service to manage trades using the Spring Boot framework. Add functionality to add or delete transactions as well as to perform some queries.

Reach out to me

LinkedIn Gmail



Each trade is a JSON entry with the following keys:

id: This is the trade unique ID.

type: This is the trade type, buy or sell.

user: The user responsible for the trade. The user itself is a JSON entry consisting of following fields:

id: This is the user unique ID.

name: This is the user name.

symbol: This is the stock symbol.

price: This is the stock price for one stock (upto two places of decimal) at the time of the trade. The stock price is between 130.42 and 195.65inclusive.

timestamp: This is the timestamp for the trade creation given in the format yyyy-MM-dd HH:mm:ss. The timezone is EST (UTC -4).

Execution

# To build the project standard maven build is sufficient
mvn clean install

# To start/run the project spring boot maven plugin is included just run
mvn spring-boot:run

# The integration test may be executed using
mvn test

Usage

Once the application is started,

  1. Erase all the trades, run below command in cURL
$curl -i -X DELETE http://localhost:8080/erase
  1. Add a new trade,
$curl -X POST http://localhost:8080/trades/  -H "content-type: application/json"
-d "
    {
        "id": 1,
        "type": "buy",
        "user": {
            "id": 2,
            "name": "Amy Palmer"
        },
        "symbol": "AA",
        "shares": 11,
        "price": 174.82,
        "timestamp": "2018-12-28 13:18:48"
    }"
  1. Return a trade filtered by ID, http://localhost:8080/trades/1 (1 -> id of trade).
  2. http://localhost:8080/trades/ , return all trades the response should be sorted in ascending order by trade ID.
  3. Get all the trades filtered by USER ID,goto http://localhost:8080/trades/users/2 the response should be sorted in ascending order by trade ID.(2 -> id of user)
  4. http://localhost:8080/trades/stocks/AA, return all the trades filtered by STOCK SYMBOL the response should be sorted in ascending order by trade ID. (AA -> stock symbol)
  5. Return all the trades filtered by USER ID & STOCK SYMBOL the response should be sorted in ascending order by trade ID, http://localhost:8080/trades/users/2/stocks/AA (2 -> id of user, AA-> stock symbol).

codebase-stock-trade-api-hackerrank's People

Contributors

saieshwar 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.