ParallelDataCollection.export_to_json_files

coinmetrics._data_collection.ParallelDataCollection.export_to_json_files(
    data_directory=None,
    compress=False,
)

Export the parallelized request to a directory of JSON files, one file per combination of the parallelize_on attribute of the parent ParallelDataCollection.

Examples:

client.get_market_trades(
    "coinbase-eth-btc-spot,coinbase-eth-usdc-spot",
).parallel("markets").export_to_json_files()

produces:

./market-trades/coinbase-eth-btc-spot.json
./market-trades/coinbase-eth-usdc-spot.json

Layering a time_increment on top:

client.get_asset_metrics(
    "btc,eth", "ReferenceRateUSD",
    start_time="2024-01-01", limit_per_asset=1,
).parallel(
    "assets,metrics",
    time_increment=timedelta(days=1),
).export_to_json_files()

produces:

  • Parameters:

    • data_directory (Optional [strarrow-up-right ]) -- Path to the directory where files should be written. Defaults to the current working directory.

    • compress (boolarrow-up-right) -- Whether to gzip the resulting files.

Returns:

  • None

Last updated

Was this helpful?