GithubHelp home page GithubHelp logo

hiring-problem-statement's Introduction

Problem Statement - General Coding

{
  "name": "Reliance Industries Limited",
  "ticker": "RELIANCE",
  "transaction_type": "BUY" | "SELL",
  "price": "2350.55",
  "quantity": "55",
  "stock_type": "LARGECAP" | "MIDCAP" | "SMALLCAP",
  "sector": "chemicals",
  "trade_time": "2022-02-27T09:53:22Z"
}

The above JSON structure is of a transaction of a stock. You will be given an array of stock transaction as input JSON file.



Problem-1


Write a function that returns the profit/loss amount, invested amount, current amount and profit/loss percentage, given input as a trade_time range. If there are no transactions in that range, return 0 as value for all fields.

Sample Input:

{
  "start": "2022-02-27T09:53:22Z",
  "end": "2022-03-27T09:53:22Z"
}

Sample Output:

{
  "profit_loss_amount": "-6700",
  "invested_amount": "100000",
  "current_amount": "93300",
  "profit_loss_percentage": "-6.7%"
}

Problem-2


Write a function that would take in filter as input on the following attributes and return array of transaction history that matches those filters.

  • transaction_type
  • trade_time range
  • sector
  • stock_type
  • price_range
  • quantity range

Sample Input 1:

{
  "transaction_type": "BUY",
  "trade_time": ["2022-02-27T09:53:22Z", "2022-03-27T09:53:22Z"],
  "sector": ["chemicals", "manufacturing"],
  "stock_type": ["LARGECAP"],
  "price": [1000, 3000],
  "quantity": [10, 5000]
}

Sample Input 2:

{
  "trade_time": ["2022-02-27T09:53:22Z", "2022-03-27T09:53:22Z"],
  "stock_type": ["LARGECAP", "MIDCAP"],
}

Sample Output:

[{
  "name": "Reliance Industries Limited",
  "ticker": "RELIANCE",
  "transaction_type": "BUY",
  "price": "2350.55",
  "quantity": "55",
  "stock_type": "LARGECAP",
  "sector": "chemicals",
  "trade_time": "2022-02-27T09:53:22Z"
}]

Problem-3


Write a function that can search transactions using a free text which is a combination of one or more of the below attributes, if no transaction is found return empty array. Take into account partial string matches.

  • name
  • ticker
  • sector
  • transaction_type

Sample Input 1:

REL

Sample Output 1:

[{
  "name": "Reliance Industries Limited",
  "ticker": "RELIANCE",
  "transaction_type": "BUY",
  "price": "2350.55",
  "quantity": "55",
  "stock_type": "LARGECAP",
  "sector": "chemicals",
  "trade_time": "2022-02-27T09:53:22Z"
}]

Sample Input 2:

Chemicals BUY

Sample Output 2:

[{
  "name": "Reliance Industries Limited",
  "ticker": "RELIANCE",
  "transaction_type": "BUY",
  "price": "2350.55",
  "quantity": "55",
  "stock_type": "LARGECAP",
  "sector": "chemicals",
  "trade_time": "2022-02-27T09:53:22Z"
}, {
  "name": "Pidilite Industries",
  "ticker": "PDLITE",
  "transaction_type": "BUY",
  "price": "1250",
  "quantity": "500",
  "stock_type": "MIDCAP",
  "sector": "chemicals",
  "trade_time": "2022-05-07T09:53:22Z"
}]

hiring-problem-statement's People

Contributors

supratikrulz avatar

Stargazers

 avatar

Watchers

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