简体   繁体   English

从Coinbase API获取购买价格金额和仅购买价格金额

[英]Getting the buy price amount and only the buy price amount from Coinbase API

I am messing around with Coinbase's API using Python. 我正在用Python弄乱Coinbase的API。 When trying to print out the buy price for BTC, I write: 当试图打印出BTC的买入价时,我写道:

client.get_buy_price()

Which is great, but it returns: 很棒,但是返回:

"amount": "7272.19", "base": "BTC", "currency": "USD" “金额”:“ 7272.19”,“基础”:“ BTC”,“货币”:“ USD”

Is there anyway that I can just get the amount only (7272.19)? 无论如何,我只能得到该金额(7272.19)吗?

I answered in the comments because i was unsure if it returned an object or a string. 我在评论中回答,因为我不确定它是否返回对象或字符串。

Getting it like it was an object worked for the thread starter. 像这样得到它是线程启动器的一个对象。

So the correct answer to the question was to get it like client.get_buy_price().amount 因此,对该问题的正确答案是像client.get_buy_price().amount那样获得它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM