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", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
market_pricenew_land_valuevaluecountryCodecountryNamecountryFlagpercentIncreasetotalTilesSold
980.4570.4570.457NUNiuehttps://app-static.earth2.io/assets/flags/nu.png357.00152254
2010.4590.4590.459NFNorfolk Islandhttps://app-static.earth2.io/assets/flags/nf.png359.00152951
1770.6000.4620.600MSMontserrathttps://app-static.earth2.io/assets/flags/ms.png500.00153598
420.5770.4640.577IOBritish Indian Ocean Territoryhttps://app-static.earth2.io/assets/flags/io.png476.92153713
960.4660.4660.466AIAnguillahttps://app-static.earth2.io/assets/flags/ai.png366.00154366
...........................
51130.00011.570130.000VAHoly Seehttps://app-static.earth2.io/assets/flags/va.png129900.00146
3813.55913.55913.559GBUnited Kingdomhttps://app-static.earth2.io/assets/flags/gb.png13459.00471420
12016.22916.22916.229ITItalyhttps://app-static.earth2.io/assets/flags/it.png16129.00509935
8016.57316.57316.573KRSouth Koreahttps://app-static.earth2.io/assets/flags/kr.png16473.00511812
24354.92454.92454.924USUnited States of Americahttps://app-static.earth2.io/assets/flags/us.png54824.00600177
\n", + "

223 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + " market_price new_land_value value countryCode \\\n", + "98 0.457 0.457 0.457 NU \n", + "201 0.459 0.459 0.459 NF \n", + "177 0.600 0.462 0.600 MS \n", + "42 0.577 0.464 0.577 IO \n", + "96 0.466 0.466 0.466 AI \n", + ".. ... ... ... ... \n", + "51 130.000 11.570 130.000 VA \n", + "38 13.559 13.559 13.559 GB \n", + "120 16.229 16.229 16.229 IT \n", + "80 16.573 16.573 16.573 KR \n", + "243 54.924 54.924 54.924 US \n", + "\n", + " countryName \\\n", + "98 Niue \n", + "201 Norfolk Island \n", + "177 Montserrat \n", + "42 British Indian Ocean Territory \n", + "96 Anguilla \n", + ".. ... \n", + "51 Holy See \n", + "38 United Kingdom \n", + "120 Italy \n", + "80 South Korea \n", + "243 United States of America \n", + "\n", + " countryFlag percentIncrease \\\n", + "98 https://app-static.earth2.io/assets/flags/nu.png 357.00 \n", + "201 https://app-static.earth2.io/assets/flags/nf.png 359.00 \n", + "177 https://app-static.earth2.io/assets/flags/ms.png 500.00 \n", + "42 https://app-static.earth2.io/assets/flags/io.png 476.92 \n", + "96 https://app-static.earth2.io/assets/flags/ai.png 366.00 \n", + ".. ... ... \n", + "51 https://app-static.earth2.io/assets/flags/va.png 129900.00 \n", + "38 https://app-static.earth2.io/assets/flags/gb.png 13459.00 \n", + "120 https://app-static.earth2.io/assets/flags/it.png 16129.00 \n", + "80 https://app-static.earth2.io/assets/flags/kr.png 16473.00 \n", + "243 https://app-static.earth2.io/assets/flags/us.png 54824.00 \n", + "\n", + " totalTilesSold \n", + "98 152254 \n", + "201 152951 \n", + "177 153598 \n", + "42 153713 \n", + "96 154366 \n", + ".. ... \n", + "51 146 \n", + "38 471420 \n", + "120 509935 \n", + "80 511812 \n", + "243 600177 \n", + "\n", + "[223 rows x 8 columns]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.sort_values(by=\"new_land_value\")" + ] + }, + { + "cell_type": "markdown", + "id": "brave-bruce", + "metadata": {}, + "source": [ + "See the result of this calculation on the [Earth2 Country prices overview](https://earth2.guide/country_statistics/). " + ] + }, + { + "cell_type": "markdown", + "id": "coordinated-gibson", + "metadata": {}, + "source": [ + "**Beware** that you spend real money in this game. I cannot provide any financial advice, because I'm not a financial advisor. The game is **not** controlled by any agency. Don't spend the money you cannot lose. " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "seo", + "language": "python", + "name": "seo" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}