coinbase/coinbase-pro-trading-toolkit

Way to change GDAX API URL's with FeedFactory?

DannyHinshaw opened this issue · 0 comments

My issue is somewhat twofold. The first is that I am not seeing a way to configure the FeedFactory API URL's. I'm trying to set the API url's to the GDAX sandbox API's, but it doesn't look like I can do this with the FeedFactory .

The second part, is that in trying to accomplish the above I tried using getSubscribedFeeds and passing in an options configuration containing all auth credentials and sandbox URL's. This works in that the script connects to the correct URL, but stops after the initial feed subscription message, basically the same as #97 .

Is there a way to accomplish this with the FeedFactory method?

Is there something I'm doing wrong with the getSubscribedFeeds function? Here's how I'm using (unsuccessfully) the getSubscribedFeeds functions.

const product = 'ETH-USD';
const logger = GTT.utils.ConsoleLoggerFactory({level: 'debug'});

const config = CONFIG.sandbox;
const auth = {
	key: config.key,
	secret: config.secret,
	passphrase: config.passphrase
};

const options = {
	auth: auth,
	logger: logger,
	channels: ['level2'],
	apiUrl: config.apiURI,
	wsUrl: config.websocketURI
};

getSubscribedFeeds(options, [product]).then((feed: GDAXFeed) => {

	console.log('FEED::', feed); // This prints to console
	const config: LiveBookConfig = {
		product: product,
		logger: logger
	};

	const liveOrderbook: LiveOrderbook = new LiveOrderbook(config);

	liveOrderbook.on('LiveOrderbook.update', (msg: LevelMessage) => {

		console.log('MESSAGE::', msg); // This code is never reached
	});

	feed.pipe(liveOrderbook);
});

Edit: I went back to the official NodeJS lib for GDAX and did some testing. I may be wrong. but it appears the problem is the actual GDAX sandbox. Leaving open for now just in case someone knows of a fix.

Edit 2: Finally figured out that GDAX sandbox only works with BTC. For whatever reason this was difficult info to find, so I'll leave this here for others to stumble upon, but marking it closed.