【问题标题】:How to get cryptocurrency's price in EUR Node.js?如何以 EUR Node.js 获得加密货币的价格?
【发布时间】:2021-09-21 09:48:40
【问题描述】:

以 coinbase-api 为例,我可以通过这种方式获取加密货币的价格:

const eth_eur = await publicClient.getProductOrderBook('ETH-EUR', { level: 1 });

如您所见,我需要配对cryptocurrency - eur,这很重要。那么,我该如何使用 binance api 呢?

我试图使用这样的东西:

const price = await binance.futuresFundingRate("ETHUSDT");

但这不是我需要的。我需要欧元价格。

【问题讨论】:

    标签: binance coinbase-api


    【解决方案1】:

    您可以将“当前平均价格”端点 (docs) 用于与 EUR 配对的基础货币。

    例子:

    const axios = require('axios');
    
    axios.get('https://api.binance.com/api/v3/avgPrice?symbol=BTCEUR').then(response => {
        const body = response.data;
        console.log(body.price);
    });
    

    【讨论】:

      猜你喜欢
      • 2021-10-15
      • 2021-08-04
      • 2021-04-08
      • 1970-01-01
      • 1970-01-01
      • 2019-02-07
      • 2022-01-15
      • 2022-11-12
      • 1970-01-01
      相关资源
      最近更新 更多