Exploring Alphacast

By alphacast

Learn how to use alphacast

Exploring Alphacast's insights

  • Charts and Maps

    chart

    Intro to charts and maps (You are here) Creating charts & maps Intro to Charts and Maps With the Alphacast's tool, you will be able to transform your data into useful and visually attractive information in an easy and fast way. You can create and customize different types of graphs or dynamic maps in just a few minutes. Next, you will see the different options available to create and share. Map chart State Level Maps We added Sub National level maps. You can easily map the data by having the state/province as your entity. The editor will recognize the state/province and map it accordingly and if it doesn't you can match your data with the map geographies. World Map, US, Brazil & Argentina are already on board and we are adding new maps on a daily basis. If you need a specific map just let us know! Line chart Scatter plot Time Scatter Stacked area Discrete bar Slope chart New charts and editing options Many many many new options for charting. From the chart editor now you can: mix graphs with bars and lines, add a secondary axis on any series, select the position of the legend, font family, color, axis width, hide markers and gridlines, smooth lines, stacked and unstacked bars, and more. Now, you can make multiple chart from one chart! [Previous] [Next]

  • Datasets and Pipelines

    Datasets and Pipelines Datasets (you are here) Pipelines What is a dataset? To begin with, a dataset is where the information is stored. Each dataset has one or multiple time series from one or many unique entities. Entities can be, for example, countries. Think about the datasets as an Excel spreadsheet, a Python Pandas DataFrame, or simply as a table with rows and columns. Now you will find datasets created by Alphacast and some featured publishers, but soon there will be many more. Searching and downloading data To explore and search for a dataset follow the "Explore" tab, located at the upper left bar and then click on the "Datasets" tab. This tab has multiple features (and many more are coming soon). For instance, filter by region and country, categories, frequency, sources, sector, and more, where we are permanently tagging the data to categorize it. You can also toggle "Show details" button to hide or expose datasets metadata, sort your results by name, popularity or last update time and favourite your frequently used datasets too. When searching for a dataset utilize the bar on the upper right corner. Use keywords in order to find the data you are looking for. Then, navigate to see the dataset details and find the repository that stores it. In the dataset view you can explore and download data. There's a brief description of the dataset, including the source. Next, you will see: A list of the variables that make up the dataset. Usually, as columns. The transformations that have been made to the data to make it useful and practical, as well as an excerpt of the dataset as an excel sheet. Charts using that dataset, from that repository and others. You will also see three gray buttons. Sync Now allows you to update the data, when you click it, the activity of the dataset will change. We will explain what you can do with Create pipe in the following insight. The last button will filter variables so you don't have to download unnecessary information, you can also create charts with this feature. Last but not least, once you decide what data you need, download your dataset. When downloading the dataset, you can choose between different formats, such as CSV or XLSX, for example. You can also decide whether you want the variables as columns or rows. If you regularly check this dataset, please follow it! Another way of finding the datasets you want is by clicking on a repository. There is a tab that includes all the datasets related to that specific topic. Select any repository of your interest and click on the tab called "Datasets". Choose the dataset you want from the list. When clicking on its name, it will redirect you to dataset view. Creating a dataset To create a dataset you need to upload a CSV or XLS following certain rules. First, you need to access one of your repositories and click Upload dataset. Import your data: upload the CSV or XLS that you want. First column should be country. You can put anything there, but if you put countries they can be used in the maps engine. Second column should be date, on the format YYYY-MM-DD. Both country and date are mandatory. Then one column for each variable. Configure your data: click on each column and select the data and column type. Date should be treated as entity, respecting the date format. Country should be treated as entity as well, its data type is text. You can ignore the other columns. Name your dataset: give your data a name that will be easy to identify. You can also add the country or source in the name. Also, choose the repository you want to store tha dataset. Click on Save and you will create the dataset. Wait a minute a refresh the page, you will be able to see your new dataset. To update the data, the process is the same. You will only have to rewrite the dataset you want to update. Transformations When exploring a dataset, you can see the list of transformations made to it. We call transformations to data that has been modified in order to make comparisons, make it more useful and more. The most common ones in economics and finances are: Seasonally adjusted: a statistical technique that attempts to measure and remove the influences of predictable seasonal patterns. When it says sa_orig, it means we did not make to transformation, we took it from the source. Constant prices: a way of measuring the real change in output. A year is chosen as the base year. Cumulative sum: used to display the total sum of data as it grows with time. It could be 3 months or 12 months, for example. Year over Year/Month over Month: comparisons between figures according to chosen frecuency. % GDP: enabling a ratio in order to make comparisons.

  • Alphacast's Integrations: Interacting with the API on R

    Integrating Alphacast with R (YOU ARE HERE) Integrating Alphacast with Python How to install the Excel add-in Download data with the Excel add-in Introduction and prerequisites Getting data from Alphacast with R is really easy. You need the Alphacast API Key and some common R packages. With a few simple steps, you can get entire dataframes, dataset indexes, repository names and repository content in any format, ready for processing and analysis. To work correctly with the Alphacast API from R we recommend installing and loading the following libraries: install.packages(c("dplyr", "httr", "reshape2")) library(dplyr) library(httr) library(reshape2) To make your API workflow easier, we recommend creating an object named "alphacastapikey" with your own key. This will make working with your Alphacast credentials faster. Remember that you can get the API credentials from the Alphacast Settings menu. For example: alphacastapikey <- "ak_QDPD89fxwASlhWwdfeIO" Getting all available datasets in Alphacast Before starting to work with the API, you may find it useful to have an index with all the datasets available on the platform with your user level. With a few lines of code to achieve this is possible in a very simple way by using the mentioned libraries. First, we indicate to R the link to the Alphacast website that will bring the index in JSON format. Authentication will be completed with the authenticate() function. It should be remembered that the Alphacast API does not need a user and password but works with a single API Key. datasets <- GET("https://charts.alphacast.io/api/datasets", authenticate(user = alphacastapikey, password = "")) To clean up the dataset and make it useful, use the bind_rows() command from the dplyr package in conjunction with the content() function from the httr package to get the response in dataframe format. datasets <- bind_rows(content(datasets))[ ,-5] head(datasets) | id|name |database | |----:|:--------------------------------------------------------|:----------------------------------------------| | 5208|High Frequency CPI - Argentina - Wide - Weekly |Alphacast Basics: Argentina High Frequency CPI | | 5225|High Frequency CPI - Argentina - Weekly |Alphacast Basics: Argentina High Frequency CPI | | 5226|High Frequency CPI - Argentina - SEIDO vs INDEC - Weekly |Alphacast Basics: Argentina High Frequency CPI | | 5231|Public Opinion - Latin America |SEIDO: Latin American Public Opinion | | 5236|Public Opinion - Argentina |SEIDO: Latin American Public Opinion | | 5241|Public Opinion - Argentina - COVID-19 |SEIDO: Latin American Public Opinion | Getting dataframes from Alphacast To obtain a dataframe it is necessary to call the GET function (from the HTTR library) with the number of dataset you want and your API key. For example, if you want to get the data from dataset 6659 (Apple Mobility Report): dataset_id <- 6659 apple_mob <- GET(paste("https://charts.alphacast.io/api/datasets/", datasetid,".csv", sep=""), authenticate(user = alphacastapi_key, password = "")) applemob <- readr::readcsv(content(applemob, as ="text"), guessmax = 100000) head(apple_mob) |Entity |Year | driving| walking| driving - 7drunningav| walking - 7drunningav|transit |transit - 7drunningav | |:-------|:----------|-------:|-------:|-----------------------:|-----------------------:|:-------|:-----------------------| |Albania |2020-01-13 | 100.00| 100.00| NA| NA|NA |NA | |Albania |2020-01-14 | 95.30| 100.68| NA| NA|NA |NA | |Albania |2020-01-15 | 101.43| 98.93| NA| NA|NA |NA | |Albania |2020-01-16 | 97.20| 98.46| NA| NA|NA |NA | |Albania |2020-01-17 | 103.55| 100.85| NA| NA|NA |NA | |Albania |2020-01-18 | 112.67| 100.13| NA| NA|NA |NA | The previous code allows to save the dataframe of the "Apple Mobility Report" in the object "apple_mob". From here, you can do whatever you want with it: graph, analyze, export as csv or JSON, among other things. It is also easy to transform the dataframe to LONG format using the reshape2 package, since all Alphacast datasets contain the "Year" and "Entity" columns. applemoblong <- melt(apple_mob, id.vars = c("Entity", "Year")) Getting repositories and its datasets You can get all available repositories from Alphacast with your level of access. repos <- GET("https://api.alphacast.io/repositories", authenticate(user = alphacastapikey, password = "")) repos <- bind_rows(content(repos)) You can also access the index of the datasets of a given repo. In this case, you can get all the datasets from the repo "Argentina's daily financial data" through the following functions: repo_id <- 21 reposdatasets <- GET("https://api.alphacast.io/datasets", query = list(repoid = repo_id), authenticate(user = alphacastapikey, password = "")) reposdatasets <- bindrows(content(repos_datasets)) head(repos_datasets) | id|name |createdAt |updatedAt | repositoryId| |----:|:------------------------------------------------------------|:-------------------|:-------------------|------------:| | 5266|Base FCI - Renta Variable |2020-10-22T22:38:21 |2020-10-22T22:38:21 | 21| | 5273|Base FCI - Renta Fija |2020-10-27T16:43:04 |2020-10-27T16:43:04 | 21| | 5288|Financial - Argentina - FX premiums - Daily |2020-11-01T17:32:02 |2020-11-01T17:32:02 | 21| | 5289|Financial - Argentina - FX premiums - Daily_Long |2020-11-01T17:33:03 |2020-11-01T17:33:03 | 21| | 5341|Financial - Argentina - Sovereign Bonds |2020-11-12T12:30:03 |2020-11-12T12:30:03 | 21| | 5357|Financial - Argentina - Sovereign Bonds - Last Price - Daily |2020-11-19T16:30:03 |2020-11-19T16:30:03 | 21| Creating repositories in Alphacast You can create your own repository to later upload the dataset. First, you have to set some variables in your R Environment. url <- "https://api.alphacast.io/repositories"` form <- list( "name" = "Repo's Name", "description" = "Test Repo - description", "privacy" = "Private", "slug" = "test-rrr-repo") And then, you post in the Alphacast server through the function POST. r <- POST(url = url, body = form, config = authenticate(user = alphacastapikey, password = "")) content(r) | id|name |description |privacy |slug | |---:|:-----------|:-----------------------|:-------|:-------------| | 610|Repo's Name |Test Repo - description |Private |test-rrr-repo | In this way, the "610" repo is created and can be checked from your admin on the Alphacast web. Uploading data to your repo Once the repo is created, it is necessary to create the slot for the dataset that you want to upload. The system will automatically generate the id of the dataset. url <- "https://api.alphacast.io/datasets" form <- list( "name" = "test_datasets", "repositoryId" = 610)` r <- POST(url = url, body = form, config = authenticate(user = alphacastapikey, password = "")) content(r) $id 6822 In this example, id number 6822 was assigned for the dataset. The next thing is to create the PUT function to upload the CSV to Alphacast and make it appear in the repo. dataset_id <- 6822 url <- paste("https://api.alphacast.io/datasets/", dataset_id, "/data?deleteMissingFromDB=True&onConflictUpdateDB=True", sep = "") Finally, you can upload the dataset in CSV format, with columns named Entity (for countries) and Year (for dates, in YYYY-MM-DD format). In this case, the "tcn.csv" file is uploaded from the indicated path (located in the root folder of the R project). r <- PUT(url, body = list(data= upload_file("tcn.csv")), config = authenticate(user = alphacastapikey, password = "")) content(r) | id|status |createdAt | datasetId| |---:|:---------|:--------------------------|---------:| | 614|Requested |2021-07-26T20:59:21.494134 | 6822| And in this way the file is uploaded to its own repository, generating the possibility of sharing it, transforming it or graphing it. Previous Next