tiagosiebler / orderbooks

Simple utility classes to handle orderbook snapshot & delta events in node.js, with examples for Bybit & Binance.
131 stars 34 forks source link

could you clarify the steps to run your sample code? #6

Closed dkuo123 closed 2 years ago

dkuo123 commented 2 years ago

Hi, I'm new to node js & follow your steps:

  1. git clone your orderbooks proj
  2. cd OrderBooks
  3. npm install -save orderbooks
  4. node samples/bybit.js then I got: node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module '@pxtrn/bybit-api' Require stack:

tiagosiebler commented 2 years ago

Hi @dkuo123 welcome to the wonderful world of node.js!

npm install -save orderbooks this is only needed if you want to import my orderbooks npm package into your own project. This cmd adds the module as a dependency to your package.json and it installs it (in your node_modules folder) so it's ready for use.

In the case of the samples, you'll see there's a package.json inside that folder. That means you can cd into that samples folder and run npm install. Running npm install like that will look for a package.json in the current folder and install any dependencies listed in the json file.

Full steps:

Notes:

tiagosiebler commented 2 years ago

New example here that's ready to run: https://github.com/tiagosiebler/awesome-crypto-examples/tree/master/src/exchanges/bybit/orderbooks

Closing this old thread