gpt4 book ai didi

python - Coinbase - get_spot_price - 历史

转载 作者:太空宇宙 更新时间:2023-11-04 02:40:21 25 4
gpt4 key购买 nike

一定是新手问题。试图获取 coinbase 上的历史每日现货价格。使用 api 的 python 实现如下。

https://developers.coinbase.com/api/v2#get-spot-price

price = client.get_spot_price(currency_pair= 'BTC-USD', date='2016-5-10')

结果(实际上是今天的价格):

    2016-5-10
{
"amount": "5613.84",
"base": "BTC",
"currency": "USD"
}

我得到当前的现货价格。谁能对我所缺少的东西有所了解?谢谢!

最佳答案

如果你只是自己点击 URI,它工作正常:

https://api.coinbase.com/v2/prices/BTC-USD/spot?date=2017-05-10

这给出了一个合理的答案(加上一个我们可以忽略这个问题的警告):

{"data":{"base":"BTC","currency":"USD","amount":"1758.04"},"warnings":[{"id":"missing_version","message":"Please supply API version (YYYY-MM-DD) as CB-VERSION header","url":"https://developers.coinbase.com/api#versioning"}]}

所以您在某个地方进行了错误的查询。图书馆坏了,或者您正在以与您所说的不同的方式使用它。试试上面的 URL,然后尝试使用 Wireshark 之类的工具来查看您的基于库的解决方案正在查询什么。

关于python - Coinbase - get_spot_price - 历史,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46731543/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com