The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
Project_CandleFetcher
Project_CandleFetcher is a Python 3.12+ project for acquiring, validating, and storing historical candlestick data from multiple venues.
This Hugging Face Dataset repository contains both:
- the
candlefetcherPython package and its tests/documentation; and - the canonical large candlestick CSV dataset under
candleset/.
Repository: https://huggingface.co/datasets/MostafaRoohy/Project_CandleFetcher
Repository layout
Project_CandleFetcher/
├── candlefetcher/ # Python package
│ ├── core/ # Candle, symbol, timeframe, and validation domain types
│ ├── fetcher/ # API and bulk-download acquisition families
│ └── util/ # Shared datetime, HTTP, file, logging, and rate-limit utilities
├── candleset/ # Canonical large CSV dataset
├── test/ # Test suite
│ └── conftest.py # Shared pytest configuration/fixtures
├── doc/ # Project documentation
├── playground/ # Experiments and notebooks
├── plan/ # Project plans
├── env/ # Environment configuration
├── AGENTS.md # Repository-specific engineering rules
└── pyproject.toml
Candle dataset layout
Candle files are stored by exchange, market, symbol, and timeframe:
candleset/
└── <exchange>/
└── <market>/
└── <symbol>/
└── <symbol>_<timeframe>.csv
Example:
candleset/binance/futures/JASMYUSDT/JASMYUSDT_M01.csv
The repository is intended to grow with additional exchanges, markets, symbols, and timeframes while keeping that hierarchy stable unless an exchange requires a documented exception.
Live refresh of 15m/1h (spot symbols + futures HYPEUSDT)
On 11 Oct 2026 the M15 and H01 files of the six spot symbols (BNB, BTC, DOGE, ETH, SOL, XRP) and of futures HYPEUSDT — 14 files — were extended from their old 2026-08-31 23:59 UTC edge to the latest closed candle:
| rows appended | 33,957 (3,881 per M15 file, 970 per H01 file) |
M15 now ends |
2026-10-11 10:00 UTC (= 2026-10-11 13:30 Tehran) |
H01 now ends |
2026-10-11 09:00 UTC (= 2026-10-11 12:30 Tehran) |
| complete days (01 Sep → 10 Oct) | Binance Vision daily archives (BinanceVisionArchiveStrategy.DAILY), SHA-256 checksum-verified, 560/560 archives |
| partial day (11 Oct) | REST kline API |
Live candles are never written. The API fetcher clips every request at the completed-candle boundary (BaseAPICandleFetcher._completed_boundary()), and the append path independently refuses any row at or beyond the local closed-candle boundary — the bar that is forming right now cannot enter a file.
Historical hole repair (11 Oct 2026). The original 2016→2026 build (monthly Vision archives, warn-on-missing) carried 996 holes. Probing every one against the exchange's live kline API showed that most were our omissions, not Binance data loss: 363 windows were fully recoverable and 244 partially recoverable, while 389 windows Binance itself no longer serves. The repair fetched 206,534 candles from the REST API (routed through the local VPN system proxy) and spliced them into 149 series across 18 symbols (the 6 spot symbols plus 12 futures symbols) — interior, order-preserving, byte-exact canonical rows, atomic per-file writes. Afterwards:
- the Feb–Apr 2022 futures holes (12 symbols × 9 timeframes) are fully repaired;
- 651 holes remain (107,647 candles), every one verified to sit inside a window where Binance's own API returns nothing:
ICPUSDTfutures 2022-09-01→09-27 (61,082 candles — a full month the exchange does not have),PUMPUSDTfutures pre-trading hours (728), and the cores of the famous spot outage days (~45k acrossBNB,BTC,DOGE,ETH,SOL,XRP); - the tests distinguish precisely this: a hole inside a documented Binance-original window is tolerated, any other hole is a failure.
DST-era timehuman_iran labels (+04:30 while Iran observed daylight time, until 2022) are a second historical property the tests accept. The refreshed span itself is gap-free: the slot-by-slot walk reports zero holes after 2026-09-01.
Deep value & cross-grid audit (11 Oct 2026). Every row of all 447 Binance files (218.2M rows) was then audited: OHLC sanity, non-negative volumes, integral trade counts, taker_buy_volume <= volume, quote-vs-notional bands, and every timehuman_iran label checked against its own timestamp (+03:30/+04:30). In addition, D01 was reconciled against aggregated H01 and H01 against aggregated M15 on every full-coverage day/hour (2.4M slots), and every suspicious row was adjudicated against the live kline API:
- 11 rows where Binance had restated volume after our original build (incident days around 21 Sep, 14 Nov and 30 Nov 2023) were updated to the exchange's current values;
- ~100 cross-grid rows (mostly volumes, a few closes on 22 Jan 2021 and 10 Nov 2023) where our copy lagged the API were corrected — verified as a fixed point: a final re-adjudication replaces zero rows;
- 6 rows (
APTUSDTH08,DOTUSDTM01,INJUSDTM01,RENDERUSDTM05,SUIUSDTM01,XRPUSDTM01 futures) where the API itself serves internally inconsistent klines (taker buys above total volume, quote far from notional) are byte-identical to the exchange and deliberately kept — bad data that exists at Binance itself; - 264 cross-grid slots where Binance's own grids disagree with each other (tiny volume deltas on identical days, e.g. day 19189 of 2022) were reproduced by the API and therefore kept.
Focused 100% full-diff (12 Oct 2026): spot BTC/ETH/SOL/XRP/BNB/DOGE at 5m/15m/1h/4h. Instead of sampling, the complete history of those 24 series was paged straight from the klines API and every one of the 7,343,737 rows was compared field-by-field with exact equality. Round one found 367 restatement-stale rows spread over 36 days (2017-12-04 → 2022-04-29) and 48 rows our archive holds that the API does not serve (the Dec-2017 06:05–06:40 and 2020-12-21 13:50–14:00 outage candles, kept — Vision-published). After replacing the 367 rows with the exchange's current values, a full re-diff reports 0 material mismatches; the only remaining differences are ≤64-ULP last digits in the two quote fields (~1.7% of rows, the 15-significant-digit storage convention) and the 48 provider-absent rows.
Large CSV storage
CSV files are tracked through the Git LFS-compatible filter used by Git-Xet:
*.csv filter=lfs diff=lfs merge=lfs -text
That means Git commits contain small pointer objects for CSV files while Hugging Face stores the actual large-file content through Xet storage.
Git-Xet must be installed and integrated with Git on machines that create or update files under candleset/.
Verify the setup with:
git xet --version
git xet install
After the one-time setup, dataset updates use ordinary Git commands:
git pull
git add .
git commit -m "Update candlestick dataset"
git push
New CSV files and modified CSV files are handled by the same *.csv rule automatically. Do not remove the CSV rule from .gitattributes or intentionally commit large CSV contents as ordinary Git blobs.
Clone size and history policy
A clone stores the candle data twice — once in the working tree and once in .git/lfs/objects/ — plus every historical CSV version that git lfs fetch --all can still reach from any branch:
clone cost = 2 x (current CSV payload) + (historical CSV versions reachable from any branch)
Since 15 Oct 2026 the repository is kept as a flat snapshot history: main starts at a single root commit (b627480, whose tree is byte-identical to the previous tip 4d4ee6d) and the sibling branches 2026less / 2026only no longer exist on origin. git lfs fetch --all therefore only ever sees the current payload — 461 CSVs, 22.46 GB — so a full clone plus git lfs fetch --all costs 44.9 GB, inside the 50 GB budget.
Every dataset commit adds a fresh LFS version of each CSV it rewrites, which grows the reachable history again and eats into that budget. When the total approaches 50 GB, re-squash main to a single root commit, force-push, then drop the stale local objects with git reflog expire --expire=now --all, git gc --prune=now and git lfs prune --verify-remote. That is destructive to commit history, so it is a user-approved operation only.
For that reason, do not run git lfs fetch --all on a machine that only needs the current dataset: it costs a full extra copy of every historical version.
Canonical candleset/ CSV schema
The Binance Vision playground publishes the repository's canonical per-symbol/timeframe CSV files with these columns:
timestamp
timehuman_iran
open
high
low
close
volume
quote_volume
trade_count
taker_buy_volume
taker_buy_quote_volume
timestamp is the authoritative Unix timestamp. timehuman_iran is an additional human-readable Asia/Tehran representation and is not the partitioning or ordering authority.
The lower-level Binance Vision downloader temporarily works with a richer internal long-form schema before the playground validates and transforms the data into the canonical candleset/ schema above.
Dataset fidelity contract
Published candleset/ files reproduce what Binance Vision serves, value for value:
- Every published row is kept. That includes the candles Binance itself stamps off the grid: BTCUSDT 1m steps 21 s forward on 2017-12-04 and then runs at that phase for two weeks, and BTCUSDT 1h opens at
:28:15for a few hours on 2018-02-11. Those rows are never dropped, reordered, or snapped to the minute. timestampstores the nearest integer second of the published open, andtimehuman_iranis rendered from that same rounded value, so the two columns always describe one instant.- Numeric fields use round-trip precision end to end. Binance quote volumes carry 16-17 significant digits (
1198158182.23741980), so the parser renders with Python'sreprand the transform reads withfloat_precision='round_trip'. A fixed'.15g'or pandas' default fast float parser silently rewrites those digits and makes the dataset disagree with the venue onquote_volumeandtaker_buy_quote_volume. - Nothing is filled, interpolated, deduplicated, or grid-corrected. Remaining holes and flat zero-volume candles are the venue's own history.
BinanceVisionRequest exposes this as timestamp_grid_policy. 'keep' (used by the playground) retains off-grid candles as bounded evidence; the default 'strict' drops them and is only appropriate when the feed is unverified.
Because Binance re-phased its clock, Candles and timeframe detection tolerate a bounded number of forward sub-cadence steps per series and warn about each one, while still rejecting a series that is predominantly sub-cadence — which is the signature of a wrong explicit timeframe.
Python package
The package metadata currently defines:
- package name:
candlefetcher - Python:
>=3.12 - runtime dependencies:
numpy,pandas,aiofiles,curl_cffi
Install the repository in editable mode:
python -m pip install -e .
For the test dependencies:
python -m pip install -e '.[test]'
Run the test suite with:
pytest
Binance Vision example
The project exposes synchronous and asynchronous Binance Vision acquisition helpers. A small synchronous example:
from candlefetcher.fetcher.download.binance_vision import download_binance_vision_candles
result = download_binance_vision_candles(
symbols = 'BTCUSDT',
timeframes = 'M01',
start = '2024-01',
end = '2024-02',
market = 'spot',
output = 'file/binance_vision_raw.csv',
)
print(result)
start is inclusive and end is exclusive after request normalization. Friendly YYYY, YYYY-MM, and YYYY-MM-DD bounds are supported by the Binance Vision request model.
Set timestamp_grid_policy='keep' to retain candles the venue published off its own timeframe grid (see the dataset fidelity contract); the default 'strict' deletes them. When you read a published candleset/ CSV back with pandas, pass float_precision='round_trip' so quote-volume columns are not shifted by one ULP.
Use playground/binance_vision_downloader.ipynb when publishing canonical files into candleset/; the playground performs the additional transformation and structural audit before atomic publication.
Polymarket Chainlink candles
PolyMarketScrapeCandleFetcher reads Polymarket's website candle endpoint. It uses the same constructor arguments as the other API fetchers, supports the observed M05 and M15 intervals, and requests thirty sixty-second TWAP candles per page. For example:
from candlefetcher.core.symbol import Symbol
from candlefetcher.core.timeframe import TimeFrame
from candlefetcher.fetcher.api.polymarket import PolyMarketScrapeCandleFetcher
fetcher = PolyMarketScrapeCandleFetcher(
Symbol.BTC,
last_n = 30,
timeframe = TimeFrame.M15,
)
frame = fetcher.sync_update()
Use playground/polymarket_get_candles.ipynb for both operations. Set UPDATE_EXISTING = False to rebuild START..END, or True to extend an existing CSV and download it when missing. The notebook writes sixty-second TWAP BTC candles, for example, to candleset/polymarket/chainlink_twap_60s/BTC/BTC_M15.csv. See the Polymarket endpoint notes for the observed request, current verification limits, and history assumptions.
- Downloads last month
- 498