mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
00e200b0b7
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.
19 lines
936 B
JavaScript
19 lines
936 B
JavaScript
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
|
|
cli({
|
|
site: 'binance',
|
|
name: 'price',
|
|
description: 'Quick price check for a trading pair',
|
|
domain: 'data-api.binance.vision',
|
|
strategy: Strategy.PUBLIC,
|
|
browser: false,
|
|
args: [
|
|
{ name: 'symbol', type: 'str', required: true, positional: true, help: 'Trading pair symbol (e.g. BTCUSDT, ETHUSDT)' },
|
|
],
|
|
columns: ['symbol', 'price', 'change', 'change_pct', 'high', 'low', 'volume', 'quote_volume', 'trades'],
|
|
pipeline: [
|
|
{ fetch: { url: 'https://data-api.binance.vision/api/v3/ticker/24hr?symbol=${{ args.symbol }}' } },
|
|
{ map: { symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change: '${{ item.priceChange }}', change_pct: '${{ item.priceChangePercent }}', high: '${{ item.highPrice }}', low: '${{ item.lowPrice }}', volume: '${{ item.volume }}', quote_volume: '${{ item.quoteVolume }}', trades: '${{ item.count }}' } },
|
|
],
|
|
});
|