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

exchanges.mddocs/

0

# Exchanges

1

2

Exchange data including listings, volume information, tickers, historical volume charts, and trading pair details. This module provides comprehensive information about cryptocurrency exchanges and their trading activity.

3

4

## Capabilities

5

6

### Exchange Listings

7

8

Get comprehensive lists of cryptocurrency exchanges with market data and metadata.

9

10

```python { .api }

11

def get_exchanges_list(**kwargs):

12

"""

13

List all exchanges with volume, tickers count, and market data.

14

15

Parameters:

16

- per_page (int): Number of results per page (1-250, default: 100)

17

- page (int): Page number (default: 1)

18

19

Returns:

20

list: List of exchanges with comprehensive data including volume, trust score, and metadata

21

"""

22

23

def get_exchanges_id_name_list(**kwargs):

24

"""

25

List all supported exchange IDs and names (no pagination required).

26

27

Returns:

28

list: List of basic exchange information (id, name)

29

"""

30

```

31

32

**Usage Examples:**

33

34

```python

35

# Get all exchanges with market data

36

exchanges = cg.get_exchanges_list()

37

38

# Get simple list of exchange IDs and names

39

exchange_names = cg.get_exchanges_id_name_list()

40

```

41

42

### Individual Exchange Data

43

44

Get detailed information about specific exchanges including volume data and trading pairs.

45

46

```python { .api }

47

def get_exchanges_by_id(id, **kwargs):

48

"""

49

Get exchange volume in BTC and comprehensive exchange information.

50

51

Parameters:

52

- id (str): Exchange ID (e.g., 'binance', 'coinbase-exchange')

53

54

Returns:

55

dict: Comprehensive exchange data including volume, trust score, description, and social links

56

"""

57

58

def get_exchanges_tickers_by_id(id, **kwargs):

59

"""

60

Get exchange tickers with trading pairs and volume data (paginated, 100 tickers per page).

61

62

Parameters:

63

- id (str): Exchange ID (e.g., 'binance')

64

- coin_ids (str or list): Filter by specific coin IDs

65

- include_exchange_logo (bool): Include exchange logos (default: False)

66

- page (int): Page number (default: 1)

67

- depth (bool): Include 2% order book depth data (default: False)

68

- order (str): Sort order ('trust_score_desc', 'trust_score_asc', 'volume_desc')

69

70

Returns:

71

dict: Contains 'tickers' array with trading pair data, volumes, and market information

72

"""

73

```

74

75

**Usage Examples:**

76

77

```python

78

# Get Binance exchange information

79

binance = cg.get_exchanges_by_id(id='binance')

80

81

# Get Binance trading pairs and tickers

82

binance_tickers = cg.get_exchanges_tickers_by_id(

83

id='binance',

84

order='volume_desc',

85

include_exchange_logo=True

86

)

87

88

# Get tickers for specific coins on Coinbase

89

coinbase_btc = cg.get_exchanges_tickers_by_id(

90

id='coinbase-exchange',

91

coin_ids=['bitcoin', 'ethereum']

92

)

93

```

94

95

### Exchange Volume Charts

96

97

Access historical trading volume data for exchanges.

98

99

```python { .api }

100

def get_exchanges_volume_chart_by_id(id, days, **kwargs):

101

"""

102

Get volume chart data for a specific exchange.

103

104

Parameters:

105

- id (str): Exchange ID (e.g., 'binance')

106

- days (int): Number of days (1-365)

107

108

Returns:

109

list: Array of [timestamp, volume] pairs showing historical trading volume

110

"""

111

112

def get_exchanges_volume_chart_by_id_within_time_range(id, from_timestamp, to_timestamp, **kwargs):

113

"""

114

Get exchange volume chart data within a specific time range.

115

116

Parameters:

117

- id (str): Exchange ID (e.g., 'binance')

118

- from_timestamp (int): Start timestamp (Unix seconds)

119

- to_timestamp (int): End timestamp (Unix seconds)

120

121

Returns:

122

list: Volume data arrays for the specified time range

123

"""

124

```

125

126

**Usage Examples:**

127

128

```python

129

# Get Binance volume chart for last 30 days

130

volume_chart = cg.get_exchanges_volume_chart_by_id(id='binance', days=30)

131

132

# Get Coinbase volume for specific date range

133

coinbase_volume = cg.get_exchanges_volume_chart_by_id_within_time_range(

134

id='coinbase-exchange',

135

from_timestamp=1640995200, # Jan 1, 2022

136

to_timestamp=1672531200 # Jan 1, 2023

137

)

138

```

139

140

### Asset Platforms

141

142

Get information about blockchain networks and asset platforms that support tokens.

143

144

```python { .api }

145

def get_asset_platforms(**kwargs):

146

"""

147

List all asset platforms (blockchain networks) that support tokens.

148

149

Parameters:

150

- filter (str): Filter platforms ('nft' for NFT-supporting platforms)

151

152

Returns:

153

list: List of blockchain platforms with metadata including chain identifier and native token

154

"""

155

156

def get_asset_platform_by_id(asset_platform_id, **kwargs):

157

"""

158

Get token list for a specific asset platform.

159

160

Parameters:

161

- asset_platform_id (str): Platform ID (e.g., 'ethereum', 'binance-smart-chain')

162

163

Returns:

164

dict: Token list data for the specified platform

165

"""

166

```

167

168

**Usage Examples:**

169

170

```python

171

# Get all supported blockchain platforms

172

platforms = cg.get_asset_platforms()

173

174

# Get Ethereum platform token information

175

ethereum_tokens = cg.get_asset_platform_by_id(asset_platform_id='ethereum')

176

```

177

178

### Categories

179

180

Get cryptocurrency category information and market data.

181

182

```python { .api }

183

def get_coins_categories_list(**kwargs):

184

"""

185

List all cryptocurrency categories without market data.

186

187

Returns:

188

list: List of category information (category_id, name)

189

"""

190

191

def get_coins_categories(**kwargs):

192

"""

193

List all cryptocurrency categories with comprehensive market data.

194

195

Parameters:

196

- order (str): Sort order ('market_cap_desc', 'market_cap_asc', 'name_desc', 'name_asc', 'market_cap_change_24h_desc', 'market_cap_change_24h_asc')

197

198

Returns:

199

list: List of categories with market cap, volume, and change data

200

"""

201

```

202

203

**Usage Examples:**

204

205

```python

206

# Get simple list of categories

207

categories = cg.get_coins_categories_list()

208

209

# Get categories with market data sorted by market cap

210

category_markets = cg.get_coins_categories(order='market_cap_desc')

211

```

212

213

### Derivatives

214

215

Access data about cryptocurrency derivatives and futures markets.

216

217

```python { .api }

218

def get_derivatives(**kwargs):

219

"""

220

List all derivative tickers across all derivative exchanges.

221

222

Parameters:

223

- include_tickers (str): Include tickers ('all', 'unexpired', 'expired')

224

225

Returns:

226

list: List of derivative contracts with pricing and volume data

227

"""

228

229

def get_derivatives_exchanges(**kwargs):

230

"""

231

List all derivative exchanges with volume and open interest data.

232

233

Parameters:

234

- order (str): Sort order ('name_asc', 'name_desc', 'open_interest_btc_desc', 'trade_volume_24h_btc_desc')

235

- per_page (int): Results per page (1-100, default: 100)

236

- page (int): Page number (default: 1)

237

238

Returns:

239

list: List of derivative exchanges with market data

240

"""

241

242

def get_derivatives_exchanges_by_id(id, **kwargs):

243

"""

244

Get information about a specific derivative exchange.

245

246

Parameters:

247

- id (str): Derivative exchange ID

248

- include_tickers (str): Include ticker data ('all', 'unexpired', 'expired')

249

250

Returns:

251

dict: Comprehensive derivative exchange data with tickers and statistics

252

"""

253

254

def get_derivatives_exchanges_list(**kwargs):

255

"""

256

List all derivative exchange IDs and names.

257

258

Returns:

259

list: List of derivative exchange basic information (id, name)

260

"""

261

```

262

263

**Usage Examples:**

264

265

```python

266

# Get all derivative tickers

267

derivatives = cg.get_derivatives(include_tickers='unexpired')

268

269

# Get derivative exchanges by volume

270

deriv_exchanges = cg.get_derivatives_exchanges(order='trade_volume_24h_btc_desc')

271

272

# Get specific derivative exchange data

273

binance_futures = cg.get_derivatives_exchanges_by_id(id='binance_futures')

274

```

275

276

### Indexes

277

278

Access market index data and cryptocurrency index information.

279

280

```python { .api }

281

def get_indexes(**kwargs):

282

"""

283

List all market indexes with current values and metadata.

284

285

Parameters:

286

- per_page (int): Results per page (1-100, default: 100)

287

- page (int): Page number (default: 1)

288

289

Returns:

290

list: List of market indexes with current values and performance data

291

"""

292

293

def get_indexes_by_market_id_and_index_id(market_id, id, **kwargs):

294

"""

295

Get specific market index data by market ID and index ID.

296

297

Parameters:

298

- market_id (str): Market/exchange ID

299

- id (str): Index ID

300

301

Returns:

302

dict: Specific index data with historical performance

303

"""

304

305

def get_indexes_list(**kwargs):

306

"""

307

List all market index IDs and names.

308

309

Returns:

310

list: List of index basic information (id, name, market)

311

"""

312

```

313

314

**Usage Examples:**

315

316

```python

317

# Get all market indexes

318

indexes = cg.get_indexes()

319

320

# Get specific index data

321

btc_index = cg.get_indexes_by_market_id_and_index_id(

322

market_id='bitfinex',

323

id='BTC'

324

)

325

326

# Get simple list of available indexes

327

index_list = cg.get_indexes_list()

328

```

329

330

## Data Structures

331

332

### Exchange Data Format

333

Exchange information includes:

334

335

```python

336

{

337

"id": "binance",

338

"name": "Binance",

339

"year_established": 2017,

340

"country": "Cayman Islands",

341

"description": "...",

342

"url": "https://www.binance.com/",

343

"image": "https://assets.coingecko.com/markets/images/52/small/binance.jpg",

344

"trust_score": 10,

345

"trust_score_rank": 1,

346

"trade_volume_24h_btc": 284567.89,

347

"normalized_trade_volume_24h_btc": 284567.89

348

}

349

```

350

351

### Ticker Data Format

352

Trading pair tickers include:

353

354

```python

355

{

356

"base": "BTC",

357

"target": "USDT",

358

"market": {

359

"name": "Binance",

360

"identifier": "binance",

361

"has_trading_incentive": false

362

},

363

"last": 43250.50,

364

"volume": 12345.67,

365

"converted_last": {

366

"btc": 1.0,

367

"eth": 17.234,

368

"usd": 43250.50

369

},

370

"converted_volume": {

371

"btc": 12345.67,

372

"eth": 212876.34,

373

"usd": 534123456.78

374

},

375

"trust_score": "green",

376

"bid_ask_spread_percentage": 0.012345,

377

"timestamp": "2023-12-01T10:00:00.000Z",

378

"last_traded_at": "2023-12-01T10:00:00.000Z",

379

"last_fetch_at": "2023-12-01T10:00:30.000Z",

380

"is_anomaly": false,

381

"is_stale": false

382

}

383

```

384

385

### Volume Chart Format

386

Volume data returns arrays of timestamp-volume pairs:

387

388

```python

389

[

390

[timestamp1, volume1],

391

[timestamp2, volume2],

392

...

393

]

394

```

395

396

Timestamps are Unix timestamps in milliseconds, volumes are in the exchange's base currency or BTC equivalent.