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
-
I have a silly question, how to use the "candlePeriod" in the subscribeCandles module? (1m,2m,3m,5m,1h ....) |
Beta Was this translation helpful? Give feedback.
Answered by
bmancini55
Feb 16, 2021
Replies: 1 comment 4 replies
-
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
}); |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
CarlosASilveira
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.