Stocks traded, turnover ratio of domestic shares (%)

Source: worldbank.org, 01.09.2025

Year: 2024

Flag Country Value Value change, % Rank
United Arab Emirates United Arab Emirates 11.4 +2.02% 31
Armenia Armenia 0.0437 -98.2% 67
Australia Australia 48.7 -3.04% 13
Austria Austria 25 +17.2% 25
Azerbaijan Azerbaijan 0.437 +150% 61
Bangladesh Bangladesh 14.5 +21.7% 28
Bulgaria Bulgaria 2.17 -23.8% 51
Bahrain Bahrain 3.93 +56.8% 44
Belarus Belarus 0.269 +107% 63
Bermuda Bermuda 0.584 -94.3% 60
Brazil Brazil 138 +14.1% 5
Canada Canada 63.7 -2.25% 11
Switzerland Switzerland 36.5 -3% 21
Chile Chile 11.2 +5.07% 32
China China 297 +8.81% 1
Colombia Colombia 6.79 +32.3% 38
Cyprus Cyprus 1.4 +68.4% 53
Czechia Czechia 10.4 -22.4% 34
Germany Germany 45.2 -5.46% 15
Egypt Egypt 47.7 +33.3% 14
Spain Spain 36.6 -10.4% 20
Ghana Ghana 1.04 +127% 55
Greece Greece 37.6 +5.22% 18
Hong Kong SAR China Hong Kong SAR China 65.9 +14.8% 9
Croatia Croatia 1.02 -12.8% 56
Hungary Hungary 17.8 -0.163% 26
India India 65.2 +45.6% 10
Iran Iran 11 -51.3% 33
Israel Israel 14 -60.9% 29
Jamaica Jamaica 3.88 +68.7% 45
Jordan Jordan 6.06 -29.4% 41
Japan Japan 117 +13% 6
Kazakhstan Kazakhstan 0.727 -43.8% 59
Kenya Kenya 2.73 -24% 49
South Korea South Korea 201 +16.5% 3
Kuwait Kuwait 32.8 +29.8% 22
Sri Lanka Sri Lanka 7.66 -1.71% 37
Luxembourg Luxembourg 0.0935 +19.7% 65
Morocco Morocco 8.08 +51.7% 36
Mexico Mexico 26.2 +30.2% 23
Malta Malta 1.25 -0.248% 54
Mauritius Mauritius 2.78 -8.7% 48
Malaysia Malaysia 36.9 +32.1% 19
Namibia Namibia 0.91 -23.7% 57
Nigeria Nigeria 2.84 -19.3% 47
New Zealand New Zealand 13.5 +7.9% 30
Pakistan Pakistan 38.1 +39.9% 17
Panama Panama 2.31 +10.2% 50
Peru Peru 4.65 +449% 42
Philippines Philippines 8.66 -2.92% 35
Poland Poland 41.1 +24.5% 16
Palestinian Territories Palestinian Territories 4.02 -43.5% 43
Qatar Qatar 172 +756% 4
Romania Romania 6.36 -3.14% 40
Rwanda Rwanda 1.59 +743% 52
Saudi Arabia Saudi Arabia 17.4 +52.8% 27
Slovenia Slovenia 3.72 +20.1% 46
Seychelles Seychelles 0.323 -83.8% 62
Thailand Thailand 58.1 -11.9% 12
Tunisia Tunisia 6.61 -11.1% 39
Turkey Turkey 253 -21.6% 2
Tanzania Tanzania 0.905 +47.3% 58
United States United States 68.5 -9.96% 8
Uzbekistan Uzbekistan 0.0543 -74.6% 66
Vietnam Vietnam 78.4 +8% 7
South Africa South Africa 25.8 -0.39% 24
Zambia Zambia 0.186 -69.5% 64

                    
# Install missing packages
import sys
import subprocess

def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])

# Required packages
for package in ['wbdata', 'country_converter']:
try:
__import__(package)
except ImportError:
install(package)

# Import libraries
import wbdata
import country_converter as coco
from datetime import datetime

# Define World Bank indicator code
dataset_code = 'CM.MKT.TRNR'

# Download data from World Bank API
data = wbdata.get_dataframe({dataset_code: 'value'},
date=(datetime(1960, 1, 1), datetime.today()),
parse_dates=True,
keep_levels=True).reset_index()

# Extract year
data['year'] = data['date'].dt.year

# Convert country names to ISO codes using country_converter
cc = coco.CountryConverter()
data['iso2c'] = cc.convert(names=data['country'], to='ISO2', not_found=None)
data['iso3c'] = cc.convert(names=data['country'], to='ISO3', not_found=None)

# Filter out rows where ISO codes could not be matched — likely not real countries
data = data[data['iso2c'].notna() & data['iso3c'].notna()]

# Sort for calculation
data = data.sort_values(['iso3c', 'year'])

# Calculate YoY absolute and percent change
data['value_change'] = data.groupby('iso3c')['value'].diff()
data['value_change_percent'] = data.groupby('iso3c')['value'].pct_change() * 100

# Calculate ranks (higher GDP per capita = better rank)
data['rank'] = data.groupby('year')['value'].rank(ascending=False, method='dense')

# Calculate rank change from previous year
data['rank_change'] = data.groupby('iso3c')['rank'].diff()

# Select desired columns
final_df = data[['country', 'iso2c', 'iso3c', 'year', 'value',
'value_change', 'value_change_percent', 'rank', 'rank_change']].copy()

# Optional: Add labels as metadata (could be useful for export or UI)
column_labels = {
'country': 'Country name',
'iso2c': 'ISO 2-letter country code',
'iso3c': 'ISO 3-letter country code',
'year': 'Year',
'value': 'GDP per capita (current US$)',
'value_change': 'Year-over-Year change in value',
'value_change_percent': 'Year-over-Year percent change in value',
'rank': 'Country rank by GDP per capita (higher = richer)',
'rank_change': 'Change in rank from previous year'
}

# Display first few rows
print(final_df.head(10))

# Optional: Save to CSV
#final_df.to_csv("gdp_per_capita_cleaned.csv", index=False)
                    
                
                    
# Check and install required packages
required_packages <- c("WDI", "countrycode", "dplyr")

for (pkg in required_packages) {
  if (!requireNamespace(pkg, quietly = TRUE)) {
    install.packages(pkg)
  }
}

# Load the necessary libraries
library(WDI)
library(dplyr)
library(countrycode)

# Define the dataset code (World Bank indicator code)
dataset_code <- 'CM.MKT.TRNR'

# Download data using WDI package
dat <- WDI(indicator = dataset_code)

# Filter only countries using 'is_country' from countrycode
# This uses iso2c to identify whether the entry is a recognized country
dat <- dat %>%
  filter(countrycode(iso2c, origin = 'iso2c', destination = 'country.name', warn = FALSE) %in%
           countrycode::codelist$country.name.en)

# Ensure dataset is ordered by country and year
dat <- dat %>%
  arrange(iso3c, year)

# Rename the dataset_code column to "value" for easier manipulation
dat <- dat %>%
  rename(value = !!dataset_code)

# Calculate year-over-year (YoY) change and percentage change
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(
    value_change = value - lag(value),                              # Absolute change from previous year
    value_change_percent = 100 * (value - lag(value)) / lag(value) # Percent change from previous year
  ) %>%
  ungroup()

# Calculate rank by year (higher value => higher rank)
dat <- dat %>%
  group_by(year) %>%
  mutate(rank = dense_rank(desc(value))) %>% # Rank countries by descending value
  ungroup()

# Calculate rank change (positive = moved up, negative = moved down)
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(rank_change = rank - lag(rank)) %>% # Change in rank compared to previous year
  ungroup()

# Select and reorder final columns
final_data <- dat %>%
  select(
    country,
    iso2c,
    iso3c,
    year,
    value,
    value_change,
    value_change_percent,
    rank,
    rank_change
  )

# Add labels (variable descriptions)
attr(final_data$country, "label") <- "Country name"
attr(final_data$iso2c, "label") <- "ISO 2-letter country code"
attr(final_data$iso3c, "label") <- "ISO 3-letter country code"
attr(final_data$year, "label") <- "Year"
attr(final_data$value, "label") <- "GDP per capita (current US$)"
attr(final_data$value_change, "label") <- "Year-over-Year change in value"
attr(final_data$value_change_percent, "label") <- "Year-over-Year percent change in value"
attr(final_data$rank, "label") <- "Country rank by GDP per capita (higher = richer)"
attr(final_data$rank_change, "label") <- "Change in rank from previous year"

# Print the first few rows of the final dataset
print(head(final_data, 10))