Skip to content

Commit

Permalink
Fix a small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
valamidev committed Oct 14, 2024
1 parent 23a004b commit 6ae6b57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions __tests__/Tickdata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ test("Trades convert to Candlestick", () => {
high: 0.00224,
low: 0.00224,
close: 0.00224,
volume: 8916,
volume: 4458,
});

// 27 candles, without open (unfinished) candle
Expand All @@ -415,7 +415,7 @@ test("Trades convert to Candlestick, with filter", () => {
high: 0.00224,
low: 0.00224,
close: 0.00224,
volume: 8916,
volume: 4458,
});

// 24 candles, without open (unfinished) candle
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "candlestick-convert",
"version": "6.0.0",
"version": "6.0.1",
"description": "OHLCV Candlestick converter and batcher with Typescript support",
"main": "build/index.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ export const batchTicksToCandle = (
if (timeOpen == trade.time) {
low = Math.min(trade.price, low);
high = Math.max(trade.price, high);
volume += trade.quantity;
if (i > 0) {
volume += trade.quantity;
}
close = trade.price;
} else {
result.push({ time: timeOpen, open, high, low, close, volume });
Expand Down

0 comments on commit 6ae6b57

Please sign in to comment.