Files
jackwener__opencli/clis/binance/losers.js
jakevin 00e200b0b7 migrate: move binance adapters from src/clis/ to clis/ (#967)
Binance was the only adapter left in src/clis/ after the TS→JS
migration (PR #928). Move all 11 adapters and the test file to
clis/binance/, strip TypeScript syntax from the test, and switch
the test import to the @jackwener/opencli/pipeline package export.
2026-04-11 21:21:52 +08:00

23 lines
1.0 KiB
JavaScript

import { cli, Strategy } from '@jackwener/opencli/registry';
cli({
site: 'binance',
name: 'losers',
description: 'Top losing trading pairs by 24h price change',
domain: 'data-api.binance.vision',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'limit', type: 'int', default: 10, help: 'Number of trading pairs' },
],
columns: ['rank', 'symbol', 'price', 'change_24h', 'volume'],
pipeline: [
{ fetch: { url: 'https://data-api.binance.vision/api/v3/ticker/24hr' } },
{ filter: 'item.priceChangePercent' },
{ map: { symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change_24h: '${{ item.priceChangePercent }}', volume: '${{ item.quoteVolume }}', sort_change: '${{ Number(item.priceChangePercent) }}' } },
{ sort: { by: 'sort_change' } },
{ map: { rank: '${{ index + 1 }}', symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change_24h: '${{ item.priceChangePercent }}', volume: '${{ item.quoteVolume }}' } },
{ limit: '${{ args.limit }}' },
],
});