gapless-crypto-data 1.0.2__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/.github/workflows/publish.yml +1 -1
  2. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/PKG-INFO +2 -2
  3. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/pyproject.toml +2 -2
  4. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/collectors/binance_public_data_collector.py +94 -10
  5. gapless_crypto_data-2.0.0/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-1h_20240101-20240101_0.0y.csv +35 -0
  6. gapless_crypto_data-2.0.0/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-1h_20240101-20240101_0.0y.metadata.json +84 -0
  7. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/uv.lock +1 -1
  8. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/.github/workflows/ci-cd.yml +0 -0
  9. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/.gitignore +0 -0
  10. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/.python-version +0 -0
  11. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/CHANGELOG.md +0 -0
  12. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/LICENSE +0 -0
  13. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/README.md +0 -0
  14. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/RELEASE_NOTES.md +0 -0
  15. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/docs/PUBLISHING.md +0 -0
  16. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/examples/README.md +0 -0
  17. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/examples/basic_data_collection.py +0 -0
  18. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/examples/cli_usage_examples.sh +0 -0
  19. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/examples/complete_workflow.py +0 -0
  20. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/examples/gap_filling_example.py +0 -0
  21. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/examples/safe_data_collection.py +0 -0
  22. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/__init__.py +0 -0
  23. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/cli.py +0 -0
  24. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/collectors/__init__.py +0 -0
  25. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/exchanges/__init__.py +0 -0
  26. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/gap_filling/__init__.py +0 -0
  27. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/gap_filling/safe_file_operations.py +0 -0
  28. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/gap_filling/universal_gap_filler.py +0 -0
  29. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-1h_20240101-20240102_0.0y.csv +0 -0
  30. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-1h_20240101-20240102_0.0y.metadata.json +0 -0
  31. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-1h_20250831-20250831_0.0y.csv +0 -0
  32. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-1h_20250831-20250831_0.0y.metadata.json +0 -0
  33. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-4h_20250831-20250831_0.0y.csv +0 -0
  34. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_BTCUSDT-4h_20250831-20250831_0.0y.metadata.json +0 -0
  35. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_ETHUSDT-1h_20250831-20250831_0.0y.csv +0 -0
  36. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_ETHUSDT-1h_20250831-20250831_0.0y.metadata.json +0 -0
  37. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_ETHUSDT-4h_20250831-20250831_0.0y.csv +0 -0
  38. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/sample_data/binance_spot_ETHUSDT-4h_20250831-20250831_0.0y.metadata.json +0 -0
  39. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/src/gapless_crypto_data/utils/__init__.py +0 -0
  40. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/tests/__init__.py +0 -0
  41. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/tests/test_binance_collector.py +0 -0
  42. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/tests/test_cli.py +0 -0
  43. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/tests/test_gap_filler.py +0 -0
  44. {gapless_crypto_data-1.0.2 → gapless_crypto_data-2.0.0}/tests/test_package.py +0 -0
@@ -111,7 +111,7 @@ jobs:
111
111
  path: dist/
112
112
 
113
113
  - name: Sign the dists with Sigstore
114
- uses: sigstore/gh-action-sigstore-python@v2.1.1
114
+ uses: sigstore/gh-action-sigstore-python@v3.0.1
115
115
  with:
116
116
  inputs: >-
117
117
  ./dist/*.tar.gz
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gapless-crypto-data
3
- Version: 1.0.2
4
- Summary: Ultra-fast cryptocurrency data collection with zero gaps guarantee - 22x faster than API calls via Binance public data repository
3
+ Version: 2.0.0
4
+ Summary: Cryptocurrency data collection with complete Binance microstructure format - 11-column output including quote volume, trade counts, and taker buy data
5
5
  Project-URL: Homepage, https://github.com/Eon-Labs/gapless-crypto-data
6
6
  Project-URL: Documentation, https://github.com/Eon-Labs/gapless-crypto-data#readme
7
7
  Project-URL: Repository, https://github.com/Eon-Labs/gapless-crypto-data.git
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "gapless-crypto-data"
3
- version = "1.0.2"
4
- description = "Ultra-fast cryptocurrency data collection with zero gaps guarantee - 22x faster than API calls via Binance public data repository"
3
+ version = "2.0.0"
4
+ description = "Cryptocurrency data collection with complete Binance microstructure format - 11-column output including quote volume, trade counts, and taker buy data"
5
5
  readme = "README.md"
6
6
  authors = [
7
7
  { name = "Eon Labs", email = "terry@eonlabs.ai" }
@@ -283,13 +283,22 @@ class BinancePublicDataCollector:
283
283
 
284
284
  # Filter by date range
285
285
  if self.start_date <= dt <= self.end_date:
286
+ # Enhanced processing: capture all 11 essential Binance columns for complete microstructure analysis
286
287
  processed_row = [
287
- dt.strftime("%Y-%m-%d %H:%M:%S"), # date
288
+ dt.strftime("%Y-%m-%d %H:%M:%S"), # date (from open_time)
288
289
  float(row[1]), # open
289
290
  float(row[2]), # high
290
291
  float(row[3]), # low
291
292
  float(row[4]), # close
292
- float(row[5]), # volume
293
+ float(row[5]), # volume (base asset volume)
294
+ # Additional microstructure columns for professional analysis
295
+ datetime.utcfromtimestamp(
296
+ int(row[6]) / (1000000 if len(str(int(row[6]))) >= 16 else 1000)
297
+ ).strftime("%Y-%m-%d %H:%M:%S"), # close_time
298
+ float(row[7]), # quote_asset_volume
299
+ int(row[8]), # number_of_trades
300
+ float(row[9]), # taker_buy_base_asset_volume
301
+ float(row[10]), # taker_buy_quote_asset_volume
293
302
  ]
294
303
  processed_data.append(processed_row)
295
304
 
@@ -472,7 +481,7 @@ class BinancePublicDataCollector:
472
481
  volumes.append(row[5])
473
482
 
474
483
  return {
475
- "version": "3.0.0",
484
+ "version": "4.0.0",
476
485
  "generator": "BinancePublicDataCollector",
477
486
  "generation_timestamp": datetime.utcnow().isoformat() + "Z",
478
487
  "data_source": "Binance Public Data Repository",
@@ -523,6 +532,26 @@ class BinancePublicDataCollector:
523
532
  "analysis_note": "Format analysis not available - may be legacy collection",
524
533
  },
525
534
  ),
535
+ "enhanced_microstructure_format": {
536
+ "format_version": "4.0.0",
537
+ "total_columns": len(data[0]) if data else 11,
538
+ "enhanced_features": [
539
+ "quote_asset_volume",
540
+ "number_of_trades",
541
+ "taker_buy_base_asset_volume",
542
+ "taker_buy_quote_asset_volume",
543
+ "close_time",
544
+ ],
545
+ "analysis_capabilities": [
546
+ "order_flow_analysis",
547
+ "liquidity_metrics",
548
+ "market_microstructure",
549
+ "trade_weighted_prices",
550
+ "institutional_data_patterns",
551
+ ],
552
+ "professional_features": True,
553
+ "api_format_compatibility": True,
554
+ },
526
555
  "compliance": {
527
556
  "zero_magic_numbers": True,
528
557
  "temporal_integrity": True,
@@ -530,6 +559,8 @@ class BinancePublicDataCollector:
530
559
  "official_binance_source": True,
531
560
  "binance_format_transition_aware": True,
532
561
  "supports_milliseconds_microseconds": True,
562
+ "full_binance_microstructure_format": True,
563
+ "professional_trading_ready": True,
533
564
  },
534
565
  }
535
566
 
@@ -581,9 +612,23 @@ class BinancePublicDataCollector:
581
612
  )
582
613
  f.write("#\n")
583
614
 
584
- # Write CSV header and data
615
+ # Write enhanced CSV header and data with all microstructure columns
585
616
  writer = csv.writer(f)
586
- writer.writerow(["date", "open", "high", "low", "close", "volume"])
617
+ writer.writerow(
618
+ [
619
+ "date",
620
+ "open",
621
+ "high",
622
+ "low",
623
+ "close",
624
+ "volume",
625
+ "close_time",
626
+ "quote_asset_volume",
627
+ "number_of_trades",
628
+ "taker_buy_base_asset_volume",
629
+ "taker_buy_quote_asset_volume",
630
+ ]
631
+ )
587
632
  writer.writerows(data)
588
633
 
589
634
  # Save metadata as JSON
@@ -781,14 +826,47 @@ class BinancePublicDataCollector:
781
826
 
782
827
  def _validate_csv_structure(self, df):
783
828
  """Validate CSV has correct structure and columns."""
784
- expected_columns = ["date", "open", "high", "low", "close", "volume"]
829
+ # Enhanced expected columns for complete microstructure data
830
+ expected_columns = [
831
+ "date",
832
+ "open",
833
+ "high",
834
+ "low",
835
+ "close",
836
+ "volume",
837
+ "close_time",
838
+ "quote_asset_volume",
839
+ "number_of_trades",
840
+ "taker_buy_base_asset_volume",
841
+ "taker_buy_quote_asset_volume",
842
+ ]
843
+
844
+ # Legacy format for backward compatibility
845
+ legacy_columns = ["date", "open", "high", "low", "close", "volume"]
846
+
785
847
  errors = []
786
848
  warnings = []
787
849
 
788
- # Check columns exist
789
- missing_columns = [col for col in expected_columns if col not in df.columns]
790
- if missing_columns:
791
- errors.append(f"Missing required columns: {missing_columns}")
850
+ # Check if it's enhanced or legacy format
851
+ has_enhanced_format = all(col in df.columns for col in expected_columns)
852
+ has_legacy_format = all(col in df.columns for col in legacy_columns)
853
+
854
+ if has_enhanced_format:
855
+ # Validate enhanced format
856
+ missing_columns = [col for col in expected_columns if col not in df.columns]
857
+ if missing_columns:
858
+ errors.append(f"Missing enhanced columns: {missing_columns}")
859
+ elif has_legacy_format:
860
+ # Legacy format detected
861
+ warnings.append(
862
+ "Legacy format detected - missing microstructure columns for advanced analysis"
863
+ )
864
+ missing_enhanced = [col for col in expected_columns if col not in df.columns]
865
+ warnings.append(f"Enhanced features unavailable: {missing_enhanced}")
866
+ else:
867
+ # Neither format complete
868
+ missing_basic = [col for col in legacy_columns if col not in df.columns]
869
+ errors.append(f"Missing basic required columns: {missing_basic}")
792
870
 
793
871
  extra_columns = [col for col in df.columns if col not in expected_columns]
794
872
  if extra_columns:
@@ -800,10 +878,16 @@ class BinancePublicDataCollector:
800
878
 
801
879
  return {
802
880
  "status": "VALID" if not errors else "INVALID",
881
+ "format_type": "enhanced"
882
+ if has_enhanced_format
883
+ else "legacy"
884
+ if has_legacy_format
885
+ else "incomplete",
803
886
  "errors": errors,
804
887
  "warnings": warnings,
805
888
  "columns_found": list(df.columns),
806
889
  "expected_columns": expected_columns,
890
+ "legacy_columns": legacy_columns,
807
891
  }
808
892
 
809
893
  def _validate_datetime_sequence(self, df, expected_timeframe):
@@ -0,0 +1,35 @@
1
+ # Binance Spot Market Data v4.0.0
2
+ # Generated: 2025-09-15T05:56:30.731811Z
3
+ # Source: Binance Public Data Repository
4
+ # Market: SPOT | Symbol: BTCUSDT | Timeframe: 1h
5
+ # Coverage: 24 bars
6
+ # Period: 2024-01-01 00:00:00 to 2024-01-01 23:00:00
7
+ # Collection: direct_download in 0.4s
8
+ # Data Hash: 8a57572144bae5e8...
9
+ # Compliance: Zero-Magic-Numbers, Temporal-Integrity, Official-Binance-Source
10
+ #
11
+ date,open,high,low,close,volume,close_time,quote_asset_volume,number_of_trades,taker_buy_base_asset_volume,taker_buy_quote_asset_volume
12
+ 2024-01-01 00:00:00,42283.58,42554.57,42261.02,42475.23,1271.68108,2024-01-01 00:59:59,53957248.973789,47134,682.57581,28957416.819645
13
+ 2024-01-01 01:00:00,42475.23,42775.0,42431.65,42613.56,1196.37856,2024-01-01 01:59:59,50984893.3481416,50396,712.32227,30355645.3482764
14
+ 2024-01-01 02:00:00,42613.57,42638.41,42500.0,42581.1,685.2198,2024-01-01 02:59:59,29167377.9732375,29863,288.98864,12301017.299762
15
+ 2024-01-01 03:00:00,42581.09,42586.64,42230.08,42330.49,794.80391,2024-01-01 03:59:59,33709050.2741136,38620,356.37209,15112996.3758499
16
+ 2024-01-01 04:00:00,42330.5,42399.99,42209.46,42399.99,715.4176,2024-01-01 04:59:59,30271621.000739,36038,371.12012,15703618.9319853
17
+ 2024-01-01 05:00:00,42399.98,42406.0,42180.77,42234.01,736.53152,2024-01-01 05:59:59,31159533.4764102,32200,340.69312,14414594.8709419
18
+ 2024-01-01 06:00:00,42234.01,42424.82,42208.68,42396.69,601.3725,2024-01-01 06:59:59,25454115.8447492,32653,348.7351,14759685.2542202
19
+ 2024-01-01 07:00:00,42396.69,42500.0,42396.68,42492.46,653.67718,2024-01-01 07:59:59,27757929.5826532,27661,325.24438,13809558.5581487
20
+ 2024-01-01 08:00:00,42492.46,42556.5,42452.58,42549.99,427.19365,2024-01-01 08:59:59,18158032.0713477,25046,202.6665,8614418.4233219
21
+ 2024-01-01 09:00:00,42550.0,42699.32,42537.18,42649.69,879.62491,2024-01-01 09:59:59,37495909.1519946,39685,460.83221,19643796.8180602
22
+ 2024-01-01 10:00:00,42649.69,42749.36,42628.0,42691.1,856.81851,2024-01-01 10:59:59,36575404.2277785,32952,458.26507,19562257.2900065
23
+ 2024-01-01 11:00:00,42691.1,42762.39,42605.21,42690.2,785.16567,2024-01-01 11:59:59,33516541.8167861,39801,401.49317,17138999.1008268
24
+ 2024-01-01 12:00:00,42690.21,42780.0,42611.45,42648.38,785.52851,2024-01-01 12:59:59,33542689.8029634,35778,363.27898,15513372.6294569
25
+ 2024-01-01 13:00:00,42648.37,42748.0,42612.76,42715.54,497.2024,2024-01-01 13:59:59,21230655.2580876,29662,252.80525,10794600.800384
26
+ 2024-01-01 14:00:00,42715.54,42715.55,42580.0,42612.24,711.01152,2024-01-01 14:59:59,30312550.0545163,35688,369.47765,15750630.3780059
27
+ 2024-01-01 15:00:00,42612.24,42847.07,42586.51,42783.05,942.70163,2024-01-01 15:59:59,40272827.0639329,47628,510.78905,21818909.6236608
28
+ 2024-01-01 16:00:00,42783.05,42856.0,42664.42,42725.15,918.71056,2024-01-01 16:59:59,39292588.8194273,39979,449.47603,19222594.9405082
29
+ 2024-01-01 17:00:00,42725.15,42824.9,42704.42,42812.7,677.33678,2024-01-01 17:59:59,28962179.5203376,29871,329.97146,14108987.8934044
30
+ 2024-01-01 18:00:00,42812.71,43208.86,42812.7,43111.1,2143.30897,2024-01-01 18:59:59,92299025.1971326,93970,1193.23559,51377573.0698471
31
+ 2024-01-01 19:00:00,43111.1,43550.0,43103.64,43517.99,1947.61533,2024-01-01 19:59:59,84416763.6540515,78415,1043.766,45242850.5273276
32
+ 2024-01-01 20:00:00,43517.98,43829.99,43510.71,43687.86,2905.07295,2024-01-01 20:59:59,126914170.3804287,88205,1586.93352,69332665.633418
33
+ 2024-01-01 21:00:00,43687.85,43792.59,43480.76,43619.21,1541.59126,2024-01-01 21:59:59,67281632.034903,48994,737.28182,32173665.2965155
34
+ 2024-01-01 22:00:00,43619.22,43661.1,43361.6,43529.93,1024.36372,2024-01-01 22:59:59,44554969.9325888,39588,482.2796,20973587.992568
35
+ 2024-01-01 23:00:00,43529.94,44184.1,43529.93,44179.55,3475.97051,2024-01-01 23:59:59,152707972.5678915,114796,2063.12837,90668650.6843782
@@ -0,0 +1,84 @@
1
+ {
2
+ "version": "4.0.0",
3
+ "generator": "BinancePublicDataCollector",
4
+ "generation_timestamp": "2025-09-15T05:56:30.731811Z",
5
+ "data_source": "Binance Public Data Repository",
6
+ "data_source_url": "https://data.binance.vision/data/spot/monthly/klines",
7
+ "market_type": "spot",
8
+ "symbol": "BTCUSDT",
9
+ "timeframe": "1h",
10
+ "collection_method": "direct_download",
11
+ "target_period": {
12
+ "start": "2024-01-01T00:00:00",
13
+ "end": "2024-01-01T23:59:59",
14
+ "total_days": 0
15
+ },
16
+ "actual_bars": 24,
17
+ "date_range": {
18
+ "start": "2024-01-01 00:00:00",
19
+ "end": "2024-01-01 23:00:00"
20
+ },
21
+ "statistics": {
22
+ "price_min": 42180.77,
23
+ "price_max": 44184.1,
24
+ "volume_total": 27174.299030000002,
25
+ "volume_mean": 1132.2624595833333
26
+ },
27
+ "collection_performance": {
28
+ "method": "direct_download",
29
+ "duration": 0.410103,
30
+ "bars_per_second": 58.52188352682131
31
+ },
32
+ "data_integrity": {
33
+ "chronological_order": true,
34
+ "data_hash": "8a57572144bae5e8efd23d39b9c87d285ef9ba4669cc78edfe446a458239adaa",
35
+ "corruption_detected": false,
36
+ "corrupted_rows_count": 0,
37
+ "corruption_details": [],
38
+ "header_detection": {
39
+ "header_found": false,
40
+ "header_content": null,
41
+ "data_start_row": 0
42
+ }
43
+ },
44
+ "timestamp_format_analysis": {
45
+ "total_rows_analyzed": 744,
46
+ "formats_detected": {
47
+ "milliseconds": 744
48
+ },
49
+ "transitions_detected": 0,
50
+ "transition_details": [],
51
+ "primary_format": "milliseconds",
52
+ "format_consistency": true
53
+ },
54
+ "enhanced_microstructure_format": {
55
+ "format_version": "4.0.0",
56
+ "total_columns": 11,
57
+ "enhanced_features": [
58
+ "quote_asset_volume",
59
+ "number_of_trades",
60
+ "taker_buy_base_asset_volume",
61
+ "taker_buy_quote_asset_volume",
62
+ "close_time"
63
+ ],
64
+ "analysis_capabilities": [
65
+ "order_flow_analysis",
66
+ "liquidity_metrics",
67
+ "market_microstructure",
68
+ "trade_weighted_prices",
69
+ "institutional_data_patterns"
70
+ ],
71
+ "professional_features": true,
72
+ "api_format_compatibility": true
73
+ },
74
+ "compliance": {
75
+ "zero_magic_numbers": true,
76
+ "temporal_integrity": true,
77
+ "authentic_spot_data_only": true,
78
+ "official_binance_source": true,
79
+ "binance_format_transition_aware": true,
80
+ "supports_milliseconds_microseconds": true,
81
+ "full_binance_microstructure_format": true,
82
+ "professional_trading_ready": true
83
+ }
84
+ }
@@ -286,7 +286,7 @@ wheels = [
286
286
 
287
287
  [[package]]
288
288
  name = "gapless-crypto-data"
289
- version = "1.0.2"
289
+ version = "2.0.0"
290
290
  source = { editable = "." }
291
291
  dependencies = [
292
292
  { name = "pandas" },