diff --git a/Earth2/Get_Earth2_Country_Statistics.ipynb b/Earth2/Get_Earth2_Country_Statistics.ipynb new file mode 100644 index 0000000..dbbe0b6 --- /dev/null +++ b/Earth2/Get_Earth2_Country_Statistics.ipynb @@ -0,0 +1,379 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "chief-salon", + "metadata": {}, + "source": [ + "# Country prices and tiles sold\n", + "[Earth2.io](https://Earth2.io) is an emerging game that aims to create a virtual copy of the Earth's landscape (buildings will be wiped out) where players can build, interact and play. It's accessible as an in-browser experience and it plans to have augmented reality and virtual reality versions. Learn more about E2 in the [Earth2 Guide](https://earth2.guide). \n", + "\n", + "This notebook describes the unofficial API which allows downloading current prices and the number of tiles sold in each country in Earth 2.\n", + "\n", + "In the game, you can purchase a tile of approx. 10x. In the later stages, you will be able to build your desired things for fun or business. Every tile in the country costs the same. US West Coast price is equal to US East Coast price when you buy a new tile that is not yet claimed by other players. There is also a [marketplace](https://earth2.guide/marketplace) where you can offer your land for sale or buy from others. \n", + "\n", + "Some dependant territories falls under the international territory with the same price around the world. The United Arab Emirates were the latest country release in March-2021 and price differ in each of the 7 Emirates." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "gentle-prisoner", + "metadata": {}, + "outputs": [], + "source": [ + "import requests\n", + "import pandas as pd\n", + "import json" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "controversial-focus", + "metadata": {}, + "outputs": [], + "source": [ + "url = \"https://app.earth2.io/graphql\"\n", + "data = {\"query\":\"{\\ngetAllTilePrices{\\ncurrent,\\nfinal,\\nvalue,\\ncountryCode,\\ncountryName,\\ncountryFlag,\\npercentIncrease,\\ntotalTilesSold\\n}\\n}\"}" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "thick-offense", + "metadata": {}, + "outputs": [], + "source": [ + "r = requests.post(url, data=data)\n", + "data = json.loads(r.content)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "received-anderson", + "metadata": {}, + "outputs": [], + "source": [ + "df = pd.DataFrame(data[\"data\"][\"getAllTilePrices\"])\n", + "df = df.rename(columns={\"current\":\"market_price\",\"final\":\"new_land_value\"})" + ] + }, + { + "cell_type": "markdown", + "id": "according-penalty", + "metadata": {}, + "source": [ + "Some dependant territories fall under the international territory." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "descending-bulgarian", + "metadata": {}, + "outputs": [], + "source": [ + "# Change dependant territories to the international space\n", + "international_territory = [\"MP\", \"MO\", \"PM\", \"PR\", \"MF\", \"PF\", \"AE\", \"CW\", \"AW\", \"TF\", \"VI\", \"SX\", \"NC\", \"BL\", \"GF\",\n", + " \"BV\", \"UM\", \"CC\", \"CX\", \"GU\", \"TK\", \"AS\", \"WF\"]\n", + "df = df[~df[\"countryCode\"].isin(international_territory)]" + ] + }, + { + "cell_type": "markdown", + "id": "equipped-failing", + "metadata": {}, + "source": [ + "Some countries were not released yet and you cannot buy the land there. It has the initial price tag on 10 cents." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "bound-bachelor", + "metadata": {}, + "outputs": [], + "source": [ + "# Remove the E$0.1 countries that were not released yet\n", + "not_active = [\"AE\",\"BQ\",\"IR\",\"YT\",\"GP\",\"AX\",\"RE\",\"MQ\",\"IQ\",\"IL\",\"SA\",\"SJ\"]\n", + "df = df[~df[\"countryCode\"].isin(not_active)]" + ] + }, + { + "cell_type": "markdown", + "id": "sustained-detail", + "metadata": {}, + "source": [ + "Let's sort the values by new_land_value. Some tiny countries like Vatican or Monaco were already sold out and you can buy them only on the [marketplace](https://earth2.guide/marketplace). The most expensive country is USA. " + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "interracial-sheep", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " | market_price | \n", + "new_land_value | \n", + "value | \n", + "countryCode | \n", + "countryName | \n", + "countryFlag | \n", + "percentIncrease | \n", + "totalTilesSold | \n", + "
---|---|---|---|---|---|---|---|---|
98 | \n", + "0.457 | \n", + "0.457 | \n", + "0.457 | \n", + "NU | \n", + "Niue | \n", + "https://app-static.earth2.io/assets/flags/nu.png | \n", + "357.00 | \n", + "152254 | \n", + "
201 | \n", + "0.459 | \n", + "0.459 | \n", + "0.459 | \n", + "NF | \n", + "Norfolk Island | \n", + "https://app-static.earth2.io/assets/flags/nf.png | \n", + "359.00 | \n", + "152951 | \n", + "
177 | \n", + "0.600 | \n", + "0.462 | \n", + "0.600 | \n", + "MS | \n", + "Montserrat | \n", + "https://app-static.earth2.io/assets/flags/ms.png | \n", + "500.00 | \n", + "153598 | \n", + "
42 | \n", + "0.577 | \n", + "0.464 | \n", + "0.577 | \n", + "IO | \n", + "British Indian Ocean Territory | \n", + "https://app-static.earth2.io/assets/flags/io.png | \n", + "476.92 | \n", + "153713 | \n", + "
96 | \n", + "0.466 | \n", + "0.466 | \n", + "0.466 | \n", + "AI | \n", + "Anguilla | \n", + "https://app-static.earth2.io/assets/flags/ai.png | \n", + "366.00 | \n", + "154366 | \n", + "
... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "
51 | \n", + "130.000 | \n", + "11.570 | \n", + "130.000 | \n", + "VA | \n", + "Holy See | \n", + "https://app-static.earth2.io/assets/flags/va.png | \n", + "129900.00 | \n", + "146 | \n", + "
38 | \n", + "13.559 | \n", + "13.559 | \n", + "13.559 | \n", + "GB | \n", + "United Kingdom | \n", + "https://app-static.earth2.io/assets/flags/gb.png | \n", + "13459.00 | \n", + "471420 | \n", + "
120 | \n", + "16.229 | \n", + "16.229 | \n", + "16.229 | \n", + "IT | \n", + "Italy | \n", + "https://app-static.earth2.io/assets/flags/it.png | \n", + "16129.00 | \n", + "509935 | \n", + "
80 | \n", + "16.573 | \n", + "16.573 | \n", + "16.573 | \n", + "KR | \n", + "South Korea | \n", + "https://app-static.earth2.io/assets/flags/kr.png | \n", + "16473.00 | \n", + "511812 | \n", + "
243 | \n", + "54.924 | \n", + "54.924 | \n", + "54.924 | \n", + "US | \n", + "United States of America | \n", + "https://app-static.earth2.io/assets/flags/us.png | \n", + "54824.00 | \n", + "600177 | \n", + "
223 rows × 8 columns
\n", + "