Created
April 14, 2024 13:42
-
-
Save evolify/4740b13c1e362b1f37a3733255e4645e to your computer and use it in GitHub Desktop.
pumpfun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios" | |
import dayjs from "dayjs" | |
import path from "path" | |
import fs from "fs" | |
const PAGE_SIZE = 50 | |
const MIN_MC = 15 * 1000 | |
function formatMC(val){ | |
return (val / 1000).toFixed(2) | |
} | |
axios.defaults.proxy = { | |
protocol: "http", | |
host: "127.0.0.1", | |
port: "7890" | |
} | |
function getUrl(offset){ | |
return `https://client-api-2-74b1891ee9f9.herokuapp.com/coins?offset=${offset}&limit=${PAGE_SIZE}&sort=last_trade_timestamp&order=DESC&includeNsfw=false` | |
} | |
async function getList(page){ | |
try{ | |
const res = await axios.get(getUrl(page * PAGE_SIZE)) | |
return res.data || [] | |
}catch{ | |
return [] | |
} | |
} | |
async function getData(pages = 3){ | |
const data = [] | |
for(let i = 0; i < pages; i++){ | |
console.log("--- load page", i+1) | |
const list = await getList(i) | |
list.forEach(t=>{ | |
if(t.complete) return | |
if(t.usd_market_cap < MIN_MC) return | |
data.push(t) | |
}) | |
} | |
return data.sort((a, b) => b.usd_market_cap - a.usd_market_cap) | |
} | |
async function main(){ | |
const list = await getData(11) | |
let content = "symbol, mc, create_time pumpfun, tg, twitter, websit" | |
list.forEach(t=>{ | |
const item = [t.symbol, formatMC(t.usd_market_cap), dayjs(t.created_timestamp).format("MM-DD HH:mm"), `https://pump.fun/${t.mint}`, t.telegram || "none", t.twitter || "none", t.websit || "none"] | |
content+=`\n${item.join(", ")}` | |
}) | |
console.log(content) | |
fs.writeFileSync(path.resolve("output/list.csv"), content) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment