This commit is contained in:
geoffsee
2025-05-23 09:48:26 -04:00
commit 66d3c06230
84 changed files with 6529 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import {ApiResponse} from "./types";
export async function collect_gainers_losers(x: { apiKey: string, limit: number }): Promise<ApiResponse> {
const { apiKey, limit } = x;
//
const data: ApiResponse = await fetch(`https://pro-api.coinmarketcap.com/v1/cryptocurrency/trending/gainers-losers?limit=${limit}`, {
headers: {
"x-cmc_pro_api_key": apiKey
}
}).then((symbolDataRequest) => symbolDataRequest.json());
return data;
}

View File

@@ -0,0 +1,48 @@
type Quote = {
price: number;
volume_24h: number;
percent_change_1h: number;
percent_change_24h: number;
percent_change_7d: number;
market_cap: number;
last_updated: string;
};
type Platform = null;
type Tag = string;
type Data = {
id: number;
name: string;
symbol: string;
slug: string;
cmc_rank?: number;
num_market_pairs: number;
circulating_supply: number;
total_supply: number;
max_supply: number;
last_updated: string;
date_added: string;
tags: Tag[];
platform: Platform;
quote: {
USD: Quote;
BTC?: Quote;
ETH?: Quote;
};
};
type Status = {
timestamp: string;
error_code: number;
error_message: string | null;
elapsed: number;
credit_count: number;
};
export type ApiResponse = {
data: Data[];
status: Status;
};