or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

coins.mdexchanges.mdglobal.mdindex.mdnfts.mdprice-market.mdsearch.mdsystem-utils.md

global.mddocs/

0

# Global Market Data

1

2

Cryptocurrency market overview, global statistics, market cap charts, and DeFi-specific metrics. This module provides macro-level insights into the overall cryptocurrency market performance and decentralized finance ecosystem.

3

4

## Capabilities

5

6

### Global Cryptocurrency Statistics

7

8

Get comprehensive overview of the entire cryptocurrency market including total market capitalization, trading volume, and market dominance metrics.

9

10

```python { .api }

11

def get_global(**kwargs):

12

"""

13

Get cryptocurrency global data including total market cap, volume, and market statistics.

14

15

Returns:

16

dict: Global cryptocurrency market data including total market cap, 24h volume, market cap percentage, and active cryptocurrencies count

17

"""

18

```

19

20

**Usage Example:**

21

22

```python

23

# Get global cryptocurrency market data

24

global_data = cg.get_global()

25

26

# Access key metrics

27

total_market_cap = global_data['total_market_cap']['usd']

28

total_volume = global_data['total_volume']['usd']

29

btc_dominance = global_data['market_cap_percentage']['btc']

30

active_cryptocurrencies = global_data['active_cryptocurrencies']

31

```

32

33

**Global Data Structure:**

34

35

```python

36

{

37

"active_cryptocurrencies": 12500,

38

"upcoming_icos": 0,

39

"ongoing_icos": 49,

40

"ended_icos": 3376,

41

"markets": 789,

42

"total_market_cap": {

43

"btc": 53123456.78,

44

"eth": 876543210.12,

45

"usd": 1678901234567.89,

46

"eur": 1456789012345.67,

47

# ... other currencies

48

},

49

"total_volume": {

50

"btc": 2341567.89,

51

"eth": 38765432.10,

52

"usd": 89012345678.90,

53

"eur": 76543210987.65,

54

# ... other currencies

55

},

56

"market_cap_percentage": {

57

"btc": 42.5,

58

"eth": 18.7,

59

"bnb": 4.2,

60

"xrp": 3.1,

61

"sol": 2.8,

62

# ... top 10 cryptocurrencies by market cap

63

},

64

"market_cap_change_percentage_24h_usd": 2.34,

65

"updated_at": 1701432000

66

}

67

```

68

69

### DeFi Market Statistics

70

71

Access decentralized finance (DeFi) specific market data and metrics.

72

73

```python { .api }

74

def get_global_decentralized_finance_defi(**kwargs):

75

"""

76

Get cryptocurrency global decentralized finance (DeFi) data including TVL and market metrics.

77

78

Returns:

79

dict: DeFi-specific global data including total value locked, DeFi market cap, and volume

80

"""

81

```

82

83

**Usage Example:**

84

85

```python

86

# Get DeFi market statistics

87

defi_data = cg.get_global_decentralized_finance_defi()

88

89

# Access DeFi metrics

90

defi_market_cap = defi_data['defi_market_cap']

91

defi_tvl = defi_data['eth_market_cap'] # Total Value Locked in ETH

92

defi_dominance = defi_data['defi_to_eth_ratio']

93

```

94

95

**DeFi Data Structure:**

96

97

```python

98

{

99

"defi_market_cap": 123456789012.34,

100

"eth_market_cap": 234567890123.45,

101

"defi_to_eth_ratio": 52.7,

102

"trading_volume_24h": 12345678901.23,

103

"defi_dominance": 8.2,

104

"top_coin_name": "Uniswap",

105

"top_coin_defi_dominance": 15.6

106

}

107

```

108

109

### Global Market Cap Charts

110

111

Get historical total cryptocurrency market capitalization data over time.

112

113

```python { .api }

114

def get_global_market_cap_chart(days, **kwargs):

115

"""

116

Get cryptocurrency global market cap chart data showing total market evolution.

117

118

Parameters:

119

- days (str or int): Data range ('1', '7', '14', '30', '90', '180', '365', 'max')

120

- vs_currency (str): Target currency for market cap data (default: 'usd')

121

122

Returns:

123

dict: Contains 'market_cap_chart' array with [timestamp, total_market_cap] pairs

124

"""

125

```

126

127

**Usage Example:**

128

129

```python

130

# Get global market cap chart for last 90 days

131

market_cap_chart = cg.get_global_market_cap_chart(days=90, vs_currency='usd')

132

133

# Access chart data

134

chart_data = market_cap_chart['market_cap_chart']

135

for timestamp, market_cap in chart_data:

136

# timestamp is Unix timestamp in milliseconds

137

# market_cap is total market cap in specified currency

138

pass

139

```

140

141

### Public Companies Treasury Data

142

143

Get data about public companies that hold cryptocurrency in their treasury reserves.

144

145

```python { .api }

146

def get_companies_public_treasury_by_coin_id(coin_id, **kwargs):

147

"""

148

Get public companies treasury data for a specific cryptocurrency.

149

150

Parameters:

151

- coin_id (str): Cryptocurrency ID (e.g., 'bitcoin', 'ethereum')

152

153

Returns:

154

dict: Contains 'companies' array with company holdings, market values, and metadata

155

"""

156

```

157

158

**Usage Example:**

159

160

```python

161

# Get companies holding Bitcoin in treasury

162

btc_treasuries = cg.get_companies_public_treasury_by_coin_id(coin_id='bitcoin')

163

164

# Access company data

165

companies = btc_treasuries['companies']

166

for company in companies:

167

name = company['name']

168

symbol = company['symbol']

169

holdings = company['total_holdings']

170

value_usd = company['total_current_value_usd']

171

print(f"{name} ({symbol}): {holdings} BTC worth ${value_usd:,.2f}")

172

173

# Get summary statistics

174

total_holdings = btc_treasuries['total_holdings']

175

total_value = btc_treasuries['total_value_usd']

176

market_cap_percentage = btc_treasuries['market_cap_dominance']

177

```

178

179

**Companies Treasury Data Structure:**

180

181

```python

182

{

183

"total_holdings": 193456.789,

184

"total_value_usd": 8345672901.23,

185

"market_cap_dominance": 0.92,

186

"companies": [

187

{

188

"name": "MicroStrategy Inc.",

189

"symbol": "MSTR",

190

"country": "US",

191

"total_holdings": 152800,

192

"total_entry_value_usd": 4680000000.00,

193

"total_current_value_usd": 6587200000.00,

194

"percentage_of_total_supply": 0.728

195

},

196

{

197

"name": "Tesla, Inc.",

198

"symbol": "TSLA",

199

"country": "US",

200

"total_holdings": 9720,

201

"total_entry_value_usd": 1500000000.00,

202

"total_current_value_usd": 418644000.00,

203

"percentage_of_total_supply": 0.046

204

}

205

# ... more companies

206

]

207

}

208

```

209

210

## Exchange Rates

211

212

Get Bitcoin-to-fiat and Bitcoin-to-cryptocurrency exchange rates.

213

214

```python { .api }

215

def get_exchange_rates(**kwargs):

216

"""

217

Get BTC-to-Currency exchange rates for all supported currencies.

218

219

Returns:

220

dict: Contains 'rates' object with currency codes as keys and rate information as values

221

"""

222

```

223

224

**Usage Example:**

225

226

```python

227

# Get all BTC exchange rates

228

rates = cg.get_exchange_rates()

229

230

# Access specific rates

231

btc_to_usd = rates['rates']['usd']['value']

232

btc_to_eur = rates['rates']['eur']['value']

233

btc_to_eth = rates['rates']['eth']['value']

234

235

# Access rate metadata

236

usd_info = rates['rates']['usd']

237

rate_name = usd_info['name'] # "US Dollar"

238

rate_unit = usd_info['unit'] # "usd"

239

rate_value = usd_info['value'] # 43250.50

240

rate_type = usd_info['type'] # "fiat" or "crypto"

241

```

242

243

**Exchange Rates Data Structure:**

244

245

```python

246

{

247

"rates": {

248

"usd": {

249

"name": "US Dollar",

250

"unit": "usd",

251

"value": 43250.50,

252

"type": "fiat"

253

},

254

"eur": {

255

"name": "Euro",

256

"unit": "eur",

257

"value": 39876.25,

258

"type": "fiat"

259

},

260

"eth": {

261

"name": "Ether",

262

"unit": "eth",

263

"value": 17.234,

264

"type": "crypto"

265

}

266

# ... all supported currencies

267

}

268

}

269

```

270

271

## Key Metrics Explained

272

273

### Market Cap Percentage

274

Shows the dominance of top cryptocurrencies as a percentage of total market capitalization. Bitcoin typically represents 40-50% of total crypto market cap.

275

276

### Market Cap Change 24h

277

The percentage change in total cryptocurrency market capitalization over the past 24 hours, indicating overall market trend.

278

279

### DeFi Dominance

280

The percentage of DeFi tokens' market cap compared to the total cryptocurrency market cap, showing the relative size of the DeFi ecosystem.

281

282

### DeFi to ETH Ratio

283

The ratio of DeFi market cap to Ethereum's market cap, indicating how much value is locked in DeFi protocols relative to Ethereum's base value.

284

285

## Data Refresh Frequency

286

287

Global market data is typically updated every few minutes. The `updated_at` timestamp in responses indicates when the data was last refreshed (Unix timestamp in seconds).

288

289

## Currency Support

290

291

Global market data supports all major fiat currencies and cryptocurrencies for market cap and volume calculations:

292

- **Fiat**: USD, EUR, GBP, JPY, KRW, CNY, etc.

293

- **Crypto**: BTC, ETH, LTC, BCH, BNB, etc.

294

295

Use the `get_supported_vs_currencies()` function to get the complete list of supported currencies.