Git Product home page Git Product logo

minibook's Introduction

A book includes all securities that the institution regularly buys and sells on
the stock market. A bid is the price that an institution is willing to buy and
an offer is the price that an institution is willing to sell.

We want you to implement a Mini-Book class in Java. The following are the requirements:
    - Mini-Book receives quotes as input.
    - A quote is a 5-tuple string containing: QuoteID/{B|O}/{N|U|D}/Price/Volume
        * QuoteID : alphanumeric string which uniquely identifies a quote.
        * B/O: whether the quote is for Bid or Offer side.
        * N/U/D: whether this is a new quote or an update or delete for a previously
          received quote. A quote update can update either volume or price or both.
          A delete for a quote id of “0” will delete the entire book i.e. 0/B/D/0/0
          will delete the entire bid book and 0/O/D/0/0 will delete the entire offer
          book.
        * Price: price associated with this quote.
        * Volume: volume associated with this quote.
    - Mini-Book then sorts the offers and the bids from the quotes that it receives.
    - For offer, the best price is the lowest price and for bid, the best price is
      the highest price.
    - The best price is the first price that is displayed.
    - If two quotes have the same price, they are then sorted by volume (from high to low).
    - If two quotes have the same price and volume, they are then ranked by time - most
      recent to least recent.
    - There should be a function for dumping the contents of the book.
    - Optimize the code for speed and maintenance (simplicity is a good virtue)


Example:
Given the following sequence of quotes as input:

Q1/O/N/1.31/1000000
Q2/B/N/1.21/1000000
Q3/B/N/1.22/1000000
Q4/B/N/1.20/1000000
Q5/B/N/1.20/1000000
Q6/O/N/1.32/1000000
Q7/O/N/1.33/200000
Q5/B/U/1.20/500000
Q7/O/U/1.33/100000
Q7/O/D/0/0


MiniBook’s contents should be displayed as follows:

OFFER
Q1/1.31/1000000
Q6/1.32/1000000

BID
Q3/1.22/1000000
Q2/1.21/1000000
Q4/1.20/1000000
Q5/1.20/500000

minibook's People

Contributors

assent222 avatar

Watchers

James Cloos 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.