pandas.DataFrame, and download the data back. By the end you will have a working dataset on Alphacast and a script you can adapt to your own data.
All examples use HTTP Basic Auth via the
Alphacast client. See the authentication page for details on how the SDK passes your API key to every request.Initialize the client
Get your API key from your account settings and pass it to the
Alphacast constructor:Create a repository
Repositories are top-level containers that hold datasets. Create one with Setting
repository.create:returnIdIfExists=True makes the call idempotent — if a repository with that name already exists, the existing one is returned instead of raising.Create a dataset
Datasets live inside a repository. Provide a name, the parent The dataset is empty until you upload data. The next two steps configure its columns and push your first batch of rows.
repo_id, and an optional description:Initialize columns
Before uploading you must declare which column carries the date and which columns identify a row (the entity columns). Together, the date and the entity columns form a unique key — every
(Date, Entity) pair must be unique in the file.Alphacast’s chart engine currently expects a single entity column. Multiple entity columns are supported for storage and download, but not for in-platform charting.
Upload a DataFrame
Build a Uploads are processed asynchronously. The call returns the response body as bytes; decode it with
DataFrame with at least your date column, your entity column, and one or more value columns. Then call upload_data_from_df:json.loads to get the process record. Use dataset(id).processes() or dataset(id).process(process_id) to poll status — see Process status.Download the data back
Once the process finishes, download the data. Pass Other supported formats:
format="pandas" to get a ready-to-use DataFrame:"csv", "json", "xlsx", "tsv". See Downloading data for filtering by date, country, or column.End-to-end script
Here is the full quickstart in a single file you can run aspython quickstart.py:
Next steps
- Learn the full surface of the Datasets class — finding by name, listing, inspecting columns and date stats.
- Combine multiple flags when uploading — see Uploading data.
- Use Search to find existing datasets you can pull instead of building your own.