/Java-Binance-WebApp

Create an application in Java, Maven using Binance Java Library. The application should handle orderbook updates and save the updates into a local database of your choice. Binance Java Library can be found here - https://github.com/binance-exchange/binance-java-api General Steps in your application: Subscribe to depth events and cache any events that are received. Get a snapshot from the rest endpoint and use it to build your initial depth cache. Apply any cache events that have a final updateId later than the snapshot's update id. Start applying any newly received depth events to the depth cache. The example repeats these steps, on a new web socket, should the web socket connection be lost. Note: Snapshots of the order book can be retrieved from the REST API. Delta changes to the book can be received by subscribing for updates via the web socket API. To ensure no updates are missed, it is important to subscribe for updates on the web socket API before getting the snapshot from the REST API. Get all BTC pair data (but only that you can buy using BTC ex: ETH/BTC, BNB/BTC ) and there are 100+ such pairs and store it in a local database. The database of your choice should be: Accurate, no data loss As fast as possible Take as least disk space as possible TIP: Able to handle time series data very well Bonus Points!! If you can display active order book for a selected pair (Ex:BNB/BTC) like below. The display should have pair selector, sell orders and buy orders. You can see an example from this link - https://www.binance.com/en/trade/pro/BNB_BTC

Primary LanguageJava

Java-Binance-WebApp

Overview

To get BIDs and ASKs order book GET http://localhost:8090/api/v1/order-book

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install the software and how to install them

  1. InfluxDB: Install Time series databse is required to store orderbook updates.
  2. Run influxdb on port 8086 (default one)
  3. Open CLI of influxdb by command influxd -config /usr/local/etc/influxdb.conf
  4. Run these commands one by one:
    • CREATE USER sanjay WITH PASSWORD 'timeseries4days' WITH ALL PRIVILEGES
    • CREATE DATABASE mstakx
    • CREATE RETENTION POLICY "two_hours_mstakx" ON "mstakx" DURATION 2h REPLICATION 1 DEFAULT
    • CREATE SUBSCRIPTION "sub0" ON "mstakx"."two_hours_mstakx" DESTINATIONS ALL 'http://localhost:8090/api/v1/order-book/add-event'
  5. JAVA 8: Install It is requrired as application uses spring boot.

Installing

Local Installation

  1. Clone the repository via ssh/http.
  2. Run this command 'mvn spring-boot:run' from root of the project

Hit http:localhost:8090/ with all the API routes and go to the homepage.

Design Flow of Supply

You can now proceed to test the APIs using Postman or implement new features.