get_crypto_price
Retrieve KRW prices for cryptocurrencies from Bithumb exchange to analyze Kimchi Premium (KIMP) data and compare Korean versus international market rates.
Instructions
Bithumb에서 특정 암호화폐의 KRW 가격을 조회합니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | 암호화폐 심볼 (예: BTC, ETH, USDT) | BTC |
Implementation Reference
- index.js:234-252 (handler)Handler for the 'get_crypto_price' tool. Extracts symbol from arguments, fetches price using bithumbPrice helper, and returns a formatted text response with the price information.case 'get_crypto_price': { const symbol = args?.symbol || 'BTC'; const price = await bithumbPrice(symbol, 'KRW'); result = { success: true, symbol: symbol.toUpperCase(), price: price, timestamp: new Date().toISOString(), }; return { content: [ { type: 'text', text: `💰 ${symbol.toUpperCase()} 가격 (Bithumb)\n\n${price.toLocaleString('ko-KR')} KRW\n\n⏰ ${new Date().toLocaleString('ko-KR')}`, }, ], }; }
- index.js:154-168 (registration)Registration of the 'get_crypto_price' tool in the list of available tools, including name, description, and input schema.{ name: 'get_crypto_price', description: 'Bithumb에서 특정 암호화폐의 KRW 가격을 조회합니다.', inputSchema: { type: 'object', properties: { symbol: { type: 'string', description: '암호화폐 심볼 (예: BTC, ETH, USDT)', default: 'BTC', }, }, required: [], }, },
- index.js:22-39 (helper)Helper function that fetches the cryptocurrency price from the Bithumb API using axios.async function bithumbPrice(symbol = 'BTC', fiat = 'KRW') { const pair = `${symbol.toUpperCase()}_${fiat.toUpperCase()}`; const url = `https://api.bithumb.com/public/ticker/${pair}`; try { const response = await axios.get(url, { timeout: 5000 }); const data = response.data; if (data.status !== '0000') { throw new Error(`Bithumb error: ${JSON.stringify(data)}`); } const price = data.data.closing_price; return parseFloat(price); } catch (error) { throw new Error(`Bithumb API 오류: ${error.message}`); } }