Live Demo: https://leonardo-20210523.netlify.app/
- Open the terminal
- Run
git clone git@github.com:leocristofani/leonardo-20210523.gitto clone the repo - Run
cd leonardo-20210523to go inside the project - Run
yarn installto install dependencies - Run
cp .env.example .envto copy sample environment variables - Start the local dev. server:
yarn start
Run yarn build to create a production version of the project in the build folder. If you're going to build the project in a CI env. like CircleCI or hosting provider like Netlify, Amazon, don't forget to supply the necessary environment variables. Refer to .env.sample.
As you can see from the env. variables file, you can build the orderbook to show information about any product, as long as you sypply the correct product id and product name.
yarn test- run tests onceyarn test:watch- run tests during development to watch for changes
yarn startin one terminal window- in another terminal window, run
cypress:runto run Cypress in the terminal orcypress:opento run Cypress on the browser
PS. Environment variables have to be prefixed with REACT_APP_ because it's required by Create React App.
-
REACT_APP_ORDERBOOK_MIN_UPDATE_INTERVAL=150: is how often (in milliseconds) we update the UI based on price level deltas that come from the server. The realtime API that we use is very fast, so in order not to cause issues on the user machine due to too many UI updates, we use this interval to throttle the UI updates. I made this configurable to make it easy to change based on product/design feedback. -
REACT_APP_ORDERBOOK_INITIAL_PRICE_GROUP=1: How the orderbook groups order pricing. -
REACT_APP_ORDERBOOK_PRODUCT_ID=PI_XBTUSD: The id of the product which you want to display information. -
REACT_APP_ORDERBOOK_PRODUCT_NAME=XBT/USDThe name of the product which you want to display information. -
REACT_APP_ORDERBOOK_API_URL=wss://www.cryptofacilities.com/ws/v1: URL to the realtime (web socket) API service.
-
React
-
Material UI
-
Web Socket (native browser API)
-
Cypress
-
React Testing Library
-
React Hooks Testing Library
-
Create React App