Skip to content

sin6pi7/cloudfide-livecoding

Repository files navigation

Prerequisites

  • Node.js v22
  • npm

What does it do?

Fetch latest X trades of a specific symbol from Binance API and analyse how many drops and rises where there in prices. Exposes fetched trades and analysis over HTTP api.

Setup

  1. Install dependencies npm i
  2. Create and fill env file cp .env.template .env.dev
  3. Running:
  • dev mode npm run dev - fetches data and starts api to listen for queries. Restarts on file changes
  • tests npm t - runs tests (PriceService.test.ts)
  1. Configuration is controlled using environment variables - dev script uses .env.dev file, update there if necessary.

Notes

Given time restrictions and vague requirements I decided to:

  • follow simple APIs (fetching historical trades)
  • use in memory data storage for simpler code (in real world scenario persistent storage should be used)
  • calculate only drops and rises in prices
  • expose only two endpoint /trades and /analysis to showcase express usage, but keep things simple at the same time
  • test only prices calculation and data fetching (couldnt get mocking from node test framework to work, but would basically mock binanceService.fetchHistoricalTrades calls with premade data and assert that it issues more calls than just one etc.)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published