S3BucketHelper
Helper for working with AWS S3 buckets via direct HTTP (without AWS SDK).
Methods
public static ValueTask<ValueTuple<DateTime, DateTime>?> GetDateRangeFromFilesAsync(HttpClient client, string bucketName, string region, string prefix, string dateFormat, CancellationToken cancellationToken, string baseUrl)
result = S3BucketHelper.GetDateRangeFromFilesAsync(client, bucketName, region, prefix, dateFormat, cancellationToken, baseUrl)
Gets the date range from S3 bucket by listing files. Uses file-based date extraction (e.g., "prefix/BTCUSDT-2024-01-01.zip" -> January 1, 2024).
- client
- HTTP client to use.
- bucketName
- S3 bucket name.
- region
- AWS region (e.g., "ap-northeast-1").
- prefix
- Prefix to search (e.g., "data/spot/daily/klines/BTCUSDT/1m/BTCUSDT-1m-").
- dateFormat
- Date format in filenames (e.g., "yyyy-MM-dd").
- cancellationToken
- Cancellation token.
- baseUrl
- Optional custom base URL for S3-compatible endpoints. If null, uses virtual-hosted style.
Returns: Min and max dates, or null if no data found or error occurred.
public static ValueTask<ValueTuple<DateTime, DateTime>?> GetDateRangeFromFilesAsync(HttpClient client, string bucketName, string region, string prefix, string dateFormat, CancellationToken cancellationToken, string baseUrl)
result = S3BucketHelper.GetDateRangeFromFilesAsync(client, bucketName, region, prefix, dateFormat, cancellationToken, baseUrl)
Gets the date range from S3 bucket by listing files. Uses file-based date extraction (e.g., "prefix/BTCUSDT-2024-01-01.zip" -> January 1, 2024).
- client
- HTTP client to use.
- bucketName
- S3 bucket name.
- region
- AWS region (e.g., "ap-northeast-1").
- prefix
- Prefix to search (e.g., "data/spot/daily/klines/BTCUSDT/1m/BTCUSDT-1m-").
- dateFormat
- Date format in filenames (e.g., "yyyy-MM-dd").
- cancellationToken
- Cancellation token.
- baseUrl
- Optional custom base URL for S3-compatible endpoints. If null, uses virtual-hosted style.
Returns: Min and max dates, or null if no data found or error occurred.
public static ValueTask<ValueTuple<DateTime, DateTime>?> GetDateRangeFromFilesAsync(HttpClient client, string bucketName, string region, string prefix, string dateFormat, CancellationToken cancellationToken, string baseUrl)
result = S3BucketHelper.GetDateRangeFromFilesAsync(client, bucketName, region, prefix, dateFormat, cancellationToken, baseUrl)
Gets the date range from S3 bucket by listing files. Uses file-based date extraction (e.g., "prefix/BTCUSDT-2024-01-01.zip" -> January 1, 2024).
- client
- HTTP client to use.
- bucketName
- S3 bucket name.
- region
- AWS region (e.g., "ap-northeast-1").
- prefix
- Prefix to search (e.g., "data/spot/daily/klines/BTCUSDT/1m/BTCUSDT-1m-").
- dateFormat
- Date format in filenames (e.g., "yyyy-MM-dd").
- cancellationToken
- Cancellation token.
- baseUrl
- Optional custom base URL for S3-compatible endpoints. If null, uses virtual-hosted style.
Returns: Min and max dates, or null if no data found or error occurred.
public static ValueTask<ValueTuple<DateTime, DateTime>?> GetDateRangeFromFoldersAsync(HttpClient client, string bucketName, string region, string prefix, string dateFormat, CancellationToken cancellationToken, string baseUrl)
result = S3BucketHelper.GetDateRangeFromFoldersAsync(client, bucketName, region, prefix, dateFormat, cancellationToken, baseUrl)
Gets the date range from S3 bucket by listing folder prefixes. Uses folder-based date extraction (e.g., "prefix/202401/" -> January 2024).
- client
- HTTP client to use.
- bucketName
- S3 bucket name.
- region
- AWS region (e.g., "ap-northeast-1").
- prefix
- Prefix to search (e.g., "spot/deals/").
- dateFormat
- Date format in folder names: "yyyyMM" for monthly, "yyyyMMdd" for daily.
- cancellationToken
- Cancellation token.
- baseUrl
- Optional custom base URL for S3-compatible endpoints. If null, uses virtual-hosted style.
Returns: Min and max dates, or null if no data found or error occurred.
public static ValueTask<ValueTuple<DateTime, DateTime>?> GetDateRangeFromFoldersAsync(HttpClient client, string bucketName, string region, string prefix, string dateFormat, CancellationToken cancellationToken, string baseUrl)
result = S3BucketHelper.GetDateRangeFromFoldersAsync(client, bucketName, region, prefix, dateFormat, cancellationToken, baseUrl)
Gets the date range from S3 bucket by listing folder prefixes. Uses folder-based date extraction (e.g., "prefix/202401/" -> January 2024).
- client
- HTTP client to use.
- bucketName
- S3 bucket name.
- region
- AWS region (e.g., "ap-northeast-1").
- prefix
- Prefix to search (e.g., "spot/deals/").
- dateFormat
- Date format in folder names: "yyyyMM" for monthly, "yyyyMMdd" for daily.
- cancellationToken
- Cancellation token.
- baseUrl
- Optional custom base URL for S3-compatible endpoints. If null, uses virtual-hosted style.
Returns: Min and max dates, or null if no data found or error occurred.
public static ValueTask<ValueTuple<DateTime, DateTime>?> GetDateRangeFromFoldersAsync(HttpClient client, string bucketName, string region, string prefix, string dateFormat, CancellationToken cancellationToken, string baseUrl)
result = S3BucketHelper.GetDateRangeFromFoldersAsync(client, bucketName, region, prefix, dateFormat, cancellationToken, baseUrl)
Gets the date range from S3 bucket by listing folder prefixes. Uses folder-based date extraction (e.g., "prefix/202401/" -> January 2024).
- client
- HTTP client to use.
- bucketName
- S3 bucket name.
- region
- AWS region (e.g., "ap-northeast-1").
- prefix
- Prefix to search (e.g., "spot/deals/").
- dateFormat
- Date format in folder names: "yyyyMM" for monthly, "yyyyMMdd" for daily.
- cancellationToken
- Cancellation token.
- baseUrl
- Optional custom base URL for S3-compatible endpoints. If null, uses virtual-hosted style.
Returns: Min and max dates, or null if no data found or error occurred.