Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

setting candlePeriod #263

Answered by bmancini55
CarlosASilveira asked this question in Q&A
Discussion options

You must be logged in to vote

This is a bit clunky at the current moment. You need to set the candle period on the client prior to calling subscribe. The candle period then applies to all subscriptions. Unfortunately you can only set one candle period per client. This is something that will be improved in future versions of the library.

const binance = new ccxws.Binance();
binance.candlePeriod = CandlePeriod._1d;
binance.subscribeCandles({ id: "BTC_USDT", base: "BTC", quote: "USDT", type: "spot" });
binance.on("candle", (candle, market) => {
  // do something with market
});

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@CarlosASilveira
Comment options

@nileio
Comment options

@CarlosASilveira
Comment options

@nileio
Comment options

Answer selected by CarlosASilveira
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants