coinbase / coinbase-pro-trading-toolkit

DEPRECATED — The Coinbase Pro trading toolkit
Apache License 2.0
866 stars 239 forks source link

Array vomit in console #248

Closed lukepighetti closed 4 years ago

lukepighetti commented 5 years ago

If I use book.ticker.price.toNumber() or ordersForValue("buy", 100, false) anywhere in my project I get an array explosion in the console for no discernible reason. Any ideas as to what's going on?

import * as GTT from "gdax-trading-toolkit";
import { LiveOrderbook } from "gdax-trading-toolkit/build/src/core";

const logger = GTT.utils.ConsoleLoggerFactory({ level: "debug" });

const product = "LTC-USD";

GTT.Factories.GDAX.FeedFactory(logger, [product]).then(feed => {
  const book = new LiveOrderbook({
    product,
    logger
  });

  feed.pipe(book);

  book.on("data", data => {
    book.ticker.price.toFixed(0);
  });
});

2018-11-25 20-10-18 2018-11-25 20_12_20

davidmarcoes commented 5 years ago

As far as I know data vomiting all that information is expected behaviour, and most importantly is data that you probably don't need.

Try something like this:

book.on('data', () => null);
book.on('LiveOrderbook.snapshot', msg => { // logic for orderbook-in-ready-state, if needed });
book.on('LiveOrderbook.update', msg => {  // logic for checking the orderbook on every update })
lukepighetti commented 5 years ago

Sorry it's been a while since I made this issue. From what I remember this was getting printed to the console. I wasn't printing it to the console.

drewrothstein commented 4 years ago

Hi, we are closing out PRs + Issues as this project is being archived.