{"id":13778671,"url":"https://github.com/valamidev/candlestick-convert","last_synced_at":"2026-06-22T09:03:48.775Z","repository":{"id":54076306,"uuid":"197829297","full_name":"valamidev/candlestick-convert","owner":"valamidev","description":"[NPM] OHLCV Candlestick Batcher/Converter","archived":false,"fork":false,"pushed_at":"2024-10-14T07:46:56.000Z","size":270,"stargazers_count":55,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-14T17:38:27.266Z","etag":null,"topics":["batcher","candlestick","ccxt","chart-library","cryptocurrency","interval","ohlc","ohlcv","tick","tick-chart","timeframe"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/candlestick-convert","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valamidev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-19T19:13:49.000Z","updated_at":"2025-08-07T16:58:10.000Z","dependencies_parsed_at":"2025-05-11T12:41:33.352Z","dependency_job_id":null,"html_url":"https://github.com/valamidev/candlestick-convert","commit_stats":{"total_commits":50,"total_committers":5,"mean_commits":10.0,"dds":0.54,"last_synced_commit":"23a004b0db8f27ee6eebe5c328754324686767c7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/valamidev/candlestick-convert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valamidev%2Fcandlestick-convert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valamidev%2Fcandlestick-convert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valamidev%2Fcandlestick-convert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valamidev%2Fcandlestick-convert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valamidev","download_url":"https://codeload.github.com/valamidev/candlestick-convert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valamidev%2Fcandlestick-convert/sbom","scorecard":{"id":914870,"data":{"date":"2025-08-11","repo":{"name":"github.com/valamidev/candlestick-convert","commit":"1e9ef82dc9561dd8797eb40dd6f86f00535a1839"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":1,"reason":"Found 3/19 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/valamidev/candlestick-convert/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/valamidev/candlestick-convert/nodejs.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"14 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T20:36:10.649Z","repository_id":54076306,"created_at":"2025-08-24T20:36:10.650Z","updated_at":"2025-08-24T20:36:10.650Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34641636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batcher","candlestick","ccxt","chart-library","cryptocurrency","interval","ohlc","ohlcv","tick","tick-chart","timeframe"],"created_at":"2024-08-03T18:00:55.991Z","updated_at":"2026-06-22T09:03:48.759Z","avatar_url":"https://github.com/valamidev.png","language":"TypeScript","funding_links":[],"categories":["Utils"],"sub_categories":[],"readme":"# candlestick-convert\n\n[![Coverage Status](https://coveralls.io/repos/github/valamidev/candlestick-convert/badge.svg?branch=master)](https://coveralls.io/github/valamidev/candlestick-convert?branch=master)\n[![DeepScan grade](https://deepscan.io/api/teams/6761/projects/8875/branches/113561/badge/grade.svg)](https://deepscan.io/dashboard#view=project\u0026tid=6761\u0026pid=8875\u0026bid=113561)\n![npm](https://img.shields.io/npm/dy/candlestick-convert)\n\nThis package allows you to batch OHLCV candlesticks or create them from trade (tick) datasets.\n\n#### Breaking Changes\n\nVersion 7.x introduces many breaking changes compared to version 6.x.x.\n\n#### Supported formats:\n\n- OHLCV (CCXT format) `[[time,open,high,low,close,volume]]`\n- OHLCV JSON `[{time: number,open: number, high: number, low: number close: number, volume: number}]`\n- Tick JSON `[{price: number, quantity: number, time:number}]`\n- Trade JSON `[{price: number, quantity: number, time:number, side: number}]`\n\n#### Features:\n\n- Typescript\n- CCXT support\n- No Dependencies\n- Performance single loop used\n- Skip missing candles\n\n#### Important!:\n\n- Intervals are only supported as integers in seconds (1 minute = 60, 2 minutes = 120...).\n- Only positive integer multiples are allowed between the base interval and the new interval, e.g., 60-\u003e120, 60-\u003e180.\n\n#### Install:\n\n```\nnpm install candlestick-convert\n```\n\n#### Available functions:\n\n```javascript\nimport {batchCandles, batchCandlesWithCustomInterval, batchCandlesJSON, batchTicksToCandle, ticksToTickChart} from \"candlestick-convert\";\n\nbatchCandles(candledata: OHLCV[], baseInterval = 60, targetInterval = 300, includeOpenCandle = false)\n//return OHLCV[]\n\nbatchCandlesWithCustomInterval(candleData: OHLCV[], intervalFunction: IntervalFunction, includeOpenCandle = false)\n//return OHLCV[]\n\nbatchCandlesJSON(candledata: IOHLCV [], baseInterval = 60, argetInterval = 300)\n// return IOHLCV[]\n\nbatchTicksToCandle(tradedata: TradeTick[], interval = 60,  includeOpenCandle = false)\n// return IOHLCV[]\n\nticksToTickChart(tradedata: TradeTick[], numberOfTicks = 5)\n// return IOHLCV[]\n\nbatchTradeToExtCandle(tradedata: Trade[], interval = 60,  includeOpenCandle = false)\n// return ExtIOHLCV[]\n```\n\n\\*\\* includeOpenCandle allow non-complete candles in the result, useful for not normalized input data\n\n#### Types\n\n```javascript\nexport type IOHLCV = {\n  time: number,\n  open: number,\n  high: number,\n  low: number,\n  close: number,\n  volume: number,\n};\n\nexport type ExtIOHLCV = {\n  time: number,\n  open: number,\n  high: number,\n  low: number,\n  close: number,\n  volume: number,\n  buyVolume: number,\n  tx: number,\n  buyTx: number,\n};\n\nexport const TradeSide = {\n  BUY: 0,\n  SELL: 1,\n};\n\nexport type TradeTick = {\n  price: number;\n  quantity: number;\n  time: number;\n};\n\nexport type Trade = {\n  price: number;\n  quantity: number;\n  time: number;\n  side: number;\n};\n\nexport enum OHLCVField {\n  TIME = 0,\n  OPEN = 1,\n  HIGH = 2,\n  LOW = 3,\n  CLOSE = 4,\n  VOLUME = 5,\n}\n```\n\n## Examples\n\n**CCXT OHLCV:**\n\n```javascript\nimport { batchCandleJSON } from \"candlestick-convert\";\n\nconst link_btc_1m = [\n  {\n    time: 1563625680000,\n    open: 0.00024824,\n    high: 0.00024851,\n    low: 0.00024798,\n    close: 0.00024831,\n    volume: 2264,\n  },\n  {\n    time: 1563625740000,\n    open: 0.00024817,\n    high: 0.00024832,\n    low: 0.00024795,\n    close: 0.00024828,\n    volume: 3145,\n  },\n];\n\nconst baseFrame = 60; // 60 seconds\nconst newFrame = 120; // 120 seconds\n\n// Convert to 2m Candles\n\nconst link_btc_2m = batchCandleJSON(link_btc_1m, baseFrame, newFrame);\n```\n\n**Extended Candles from Trades:**\n\n```javascript\nimport { batchTradeToExtCandle, Trade } from \"candlestick-convert\";\n\nconst adabnb_trades = [\n  {\n    time: \"1564502620356\",\n    side: \"sell\",\n    quantity: \"4458\",\n    price: \"0.00224\",\n    tradeId: \"1221272\",\n  },\n  {\n    time: \"1564503133949\",\n    side: \"sell\",\n    quantity: \"3480\",\n    price: \"0.002242\",\n    tradeId: \"1221273\",\n  },\n  {\n    time: \"1564503134553\",\n    side: \"buy\",\n    quantity: \"51\",\n    price: \"0.002248\",\n    tradeId: \"1221274\",\n  },\n  // ... more data\n];\n\nconst filtered_adabnb_trades: Trade[] = adabnb_trades.map((trade: any) =\u003e ({\n  time: trade.time,\n  quantity: trade.quantity,\n  price: trade.price,\n  side: trade.side === \"buy\" ? 0 : 1,\n}));\n\n// 1 minute (60 second) Candles\nconst candles1m = batchTradeToExtCandle(filtered_adabnb_trades, 60);\n\n/* Result:\n[\n  {\n    time: 1564502580000, // 2019-07-30T16:03:00.000Z\n    open: 0.00224,\n    high: 0.00224,\n    low: 0.00224,\n    close: 0.00224,\n    volume: 4458,\n    buyVolume: 0,\n    tx: 1,\n    buyTx: 0,\n  },\n  {\n    time: 1564503120000,\n    open: 0.00224,\n    high: 0.002248,\n    low: 0.002242,\n    close: 0.002248,\n    volume: 4949,\n    buyVolume: 103,\n    tx: 3,\n    buyTx: 2,\n  }\n]\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalamidev%2Fcandlestick-convert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalamidev%2Fcandlestick-convert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalamidev%2Fcandlestick-convert/lists"}