DataCollection.parallel

coinmetrics._data_collection.DataCollection.parallel(
    parallelize_on=None,
    executor=None,
    max_workers=None,
    progress_bar=None,
    time_increment=None,
    height_increment=None,
)

Convert this DataCollection into a ParallelDataCollection, splitting a single HTTP request into many parallel requests for faster data export.

By default the request is split on the primary query parameter (for example, get_asset_metrics(assets=...) is split into one request per asset).

  • Parameters:

    • parallelize_on (Optional *[*Union [strarrow-up-right , List [strarrow-up-right ] ] ]) -- Parameter(s) to parallelize on. Must be one of the list-type parameters of the underlying endpoint (assets, markets, metrics, ...).

    • executor (Optional *[*Callable [ *[*Any ] , concurrent.futures.Executorarrow-up-right ] ]) -- Executor class used for concurrency. Defaults to concurrent.futures.ThreadPoolExecutorarrow-up-right; pass a ProcessPoolExecutorarrow-up-right (or any other Executor subclass) to swap it out.

    • max_workers (Optional [intarrow-up-right ]) -- Number of parallel workers. Defaults to 10 and is capped at 10 to respect API rate limits.

    • progress_bar (Optional [boolarrow-up-right ]) -- Whether to display a tqdm progress bar while the workers run. Defaults to True.

    • time_increment (Optional *[*Union *[*relativedelta , timedelta , DateOffset ] ]) -- Optionally split the request along the time axis as well. Use datetime.timedeltaarrow-up-right for sub-month windows and dateutil.relativedelta.relativedelta for month / year windows. Requires start_time to be set on the original request.

    • height_increment (Optional [intarrow-up-right ]) -- Optionally split the request along the block-height axis. Requires start_height to be set on the original request.

  • Returns: A ParallelDataCollection that mirrors the original request but executes its workload across multiple workers.

Returns:

Last updated

Was this helpful?