Coder Social home page Coder Social logo

icreativedev / reactorderbook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mihailgaberov/orderbook

0.0 0.0 0.0 1.43 MB

:book: An Order Book app built with React/Typescript and powered by WebSockets.

Home Page: https://orderbook-mihailgaberov.vercel.app/

TypeScript 98.64% HTML 1.36%

reactorderbook's Introduction

Order Book

An Order Book app built with React/Typescript and powered by WebSockets.

I have written a tutorial about how I did this. You can find it here or here.


Tests Build Status

Tech stack

  • React / Typescript
  • SASS / styled-components
  • WebSockets / react-use-websocket
  • react-testing-library

Screenshots

Default View

iPhone 6/7/8

Responsive

XBTUSD Grouping: 1

ETHUSD Market

Application features:

I. Order Book

  1. The Order Book consists of two sides: the buy side and the sell side.
  2. Both sides contain information about the amount of orders opened at each price level.
  3. Each level displays the:
    1. Price - this is what defines the level. As orders must be placed at a price that is a multiple of the selected markets tick size (0.5) each level will be an increment of 0.5 (as long as there is an order open at that level).
    2. Size - the total quantity of contracts derived from open orders that have been placed at this level.
    3. Total - the summed amount of contracts derived from open orders that reside in the book at this level and above. To calculate the total of a given level we take the size of the current level and sum the sizes leading to this price level in the order book. The total is also used to calculate the depth visualizer (colored bars behind the levels), the depth of each level is calculated by taking that level's total as a percentage of the highest total in the book.

II. Grouping Select Box

  1. By default the orders are grouped by the select markets ticket size (0.5).
  2. Possible toggling of the grouping: between 0.5, 1, 2.5 for XBTUSD market and 0.05, 0.1 and 0.25 for ETHUSD market.
  3. To group levels we combine the levels rounded down to the nearest group size e.g. if we change our grouping from 0.5 to 1 then we would combine the data from prices 1000 and 1000.5 and display it under a single level in the orderbook with the price 1000.

III. Toggle Feed Button

  1. Toggles the selected market between PI_XBTUSD and PI_ETHUSD.
  2. Supports dynamic grouping logic - handles groupings for XBT (0.5, 1, 2.5) and groupings for ETH (0.05, 0.1, 0.25).

IV. Kill Feed Button

  1. Clicking this button stops the feed.
  2. Clicking this button second time renews the feed.

Demo

orderbook-mihailgaberov.vercel.app

Running the app locally

To run the app, follow these steps.

  1. Ensure that NodeJS is installed.
  2. Install yarn.
  3. From the project folder, execute the following commands:

To install dependencies:

  yarn

To run the app:

  yarn start

To run the tests:

  yarn test

Star History

Star History Chart

reactorderbook's People

Contributors

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