Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions packages/komodo_cex_market_data/index_generator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Used to generate Dart index file. Can be ran with `dart run index_generator`
# from this package's root directory.
# See https://pub.dev/packages/index_generator for more information.
index_generator:
page_width: 80
exclude:
- "**.g.dart"
- "**.freezed.dart"
Comment thread
takenagain marked this conversation as resolved.

libraries:
# Binance market data provider
- directory_path: lib/src/binance
file_name: _binance_index
name: _binance
exclude:
- "{_,**/_}*.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to Binance market data provider functionality.
disclaimer: false

# CoinGecko market data provider
- directory_path: lib/src/coingecko
file_name: _coingecko_index
name: _coingecko
exclude:
- "{_,**/_}*.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to CoinGecko market data provider functionality.
disclaimer: false

# CoinPaprika market data provider
- directory_path: lib/src/coinpaprika
file_name: _coinpaprika_index
name: _coinpaprika
exclude:
- "{_,**/_}*.dart"
- "models/models.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to CoinPaprika market data provider functionality.
disclaimer: false

# Komodo-specific functionality
- directory_path: lib/src/komodo
file_name: _komodo_index
name: _komodo
exclude:
- "{_,**/_}*.dart"
- "komodo.dart"
- "prices/prices.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to Komodo-specific market data functionality.
disclaimer: false

# Common models and types
- directory_path: lib/src/models
file_name: _models_index
name: _models
exclude:
- "{_,**/_}*.dart"
- "models.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to common models and types for market data.
disclaimer: false

# Common utilities
- directory_path: lib/src/common
file_name: _common_index
name: _common
exclude:
- "{_,**/_}*.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to common utilities for market data providers.
disclaimer: false

# Bootstrap functionality
- directory_path: lib/src/bootstrap
file_name: _bootstrap_index
name: _bootstrap
exclude:
- "{_,**/_}*.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to market data bootstrap functionality.
disclaimer: false

# Main src-level exports (individual files not in subdirectories)
- directory_path: lib/src/
file_name: _core_index
name: _core
include:
- "*.dart"
exclude:
- "**/*_index.dart"
- "{_,**/_}*.dart"
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private classes related to core market data functionality.
disclaimer: false

# Combined internal exports
- directory_path: lib/src/
file_name: _internal_exports
name: _internal_exports
include:
- "**/*_index.dart"
exclude: []
comments: |
(Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.
docs: |
Internal/private exports combining all market data provider functionality.
disclaimer: false
39 changes: 33 additions & 6 deletions packages/komodo_cex_market_data/lib/komodo_cex_market_data.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
/// Komodo CEX market data library for fetching and managing cryptocurrency market data.
/// Komodo CEX market data library for fetching and managing cryptocurrency
/// market data.
///
/// Provides support for multiple market data providers with fallback capabilities,
/// repository selection strategies, and robust error handling.
library;
/// This library provides comprehensive support for multiple cryptocurrency
/// market data providers
/// including Binance, CoinGecko, and CoinPaprika. It features:
///
/// * Multiple market data providers with fallback capabilities
/// * Repository selection strategies and priority management
/// * Robust error handling and retry mechanisms
/// * OHLC data, price information, and market statistics
/// * Sparkline data for charts and visualizations
/// * Bootstrap functionality for initial data setup
/// * Hive-based caching and persistence
///
/// ## Usage
///
/// The library is designed to work with the broader Komodo DeFi SDK ecosystem
/// and provides a unified interface for accessing market data across different
/// centralized exchanges and data providers.
///
/// ## Providers
///
/// * **Binance**: High-priority provider for real-time market data
/// * **CoinGecko**: Primary fallback provider with comprehensive coverage
/// * **CoinPaprika**: Secondary fallback provider
/// * **Komodo**: Internal price data and calculations
///
/// The library automatically handles provider selection, fallbacks, and
/// error recovery to ensure reliable market data access.
library komodo_cex_market_data;

export 'src/komodo_cex_market_data_base.dart';
export 'src/repository_fallback_mixin.dart';
// Export all generated indices for comprehensive API coverage
export 'src/_core_index.dart';
export 'src/_internal_exports.dart';
13 changes: 13 additions & 0 deletions packages/komodo_cex_market_data/lib/src/_core_index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// (Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.

/// Internal/private classes related to core market data functionality.
library _core;

export 'cex_repository.dart';
export 'hive_adapters.dart';
export 'id_resolution_strategy.dart';
export 'komodo_cex_market_data_base.dart';
export 'repository_fallback_mixin.dart';
export 'repository_priority_manager.dart';
export 'repository_selection_strategy.dart';
export 'sparkline_repository.dart';
12 changes: 12 additions & 0 deletions packages/komodo_cex_market_data/lib/src/_internal_exports.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// (Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.

/// Internal/private exports combining all market data provider functionality.
library _internal_exports;

export 'binance/_binance_index.dart';
export 'bootstrap/_bootstrap_index.dart';
export 'coingecko/_coingecko_index.dart';
export 'coinpaprika/_coinpaprika_index.dart';
export 'common/_common_index.dart';
export 'komodo/_komodo_index.dart';
export 'models/_models_index.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// (Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.

/// Internal/private classes related to Binance market data provider functionality.
library _binance;

export 'data/binance_provider.dart';
export 'data/binance_provider_interface.dart';
export 'data/binance_repository.dart';
export 'models/binance_24hr_ticker.dart';
export 'models/binance_exchange_info.dart';
export 'models/binance_exchange_info_reduced.dart';
export 'models/filter.dart';
export 'models/rate_limit.dart';
export 'models/symbol.dart';
export 'models/symbol_reduced.dart';
8 changes: 0 additions & 8 deletions packages/komodo_cex_market_data/lib/src/binance/binance.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ class BinanceRepository implements CexRepository {
baseUrl: baseUrl,
);
final coinsList = _convertSymbolsToCoins(exchangeInfo);
_cachedFiatCurrencies =
exchangeInfo.symbols
.map((s) => s.quoteAsset.toUpperCase())
.toSet();
_cachedFiatCurrencies = exchangeInfo.symbols
.map((s) => s.quoteAsset.toUpperCase())
.toSet();
return coinsList;
} catch (e) {
lastException = e is Exception ? e : Exception(e.toString());
Expand Down Expand Up @@ -191,8 +190,9 @@ class BinanceRepository implements CexRepository {

for (var i = 0; i <= daysDiff; i += 500) {
final batchStartDate = startDate.add(Duration(days: i));
final batchEndDate =
i + 500 > daysDiff ? endDate : startDate.add(Duration(days: i + 500));
final batchEndDate = i + 500 > daysDiff
? endDate
: startDate.add(Duration(days: i + 500));

final ohlcData = await getCoinOhlc(
assetId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// (Internal/private) Generated by the `index_generator` package with the `index_generator.yaml` configuration file.

/// Internal/private classes related to market data bootstrap functionality.
library _bootstrap;

export 'market_data_bootstrap.dart';
Loading
Loading