博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python获取比特币数据_使用Python获取当前的比特币价格
阅读量:2520 次
发布时间:2019-05-11

本文共 833 字,大约阅读时间需要 2 分钟。

python获取比特币数据

Using the API, you can easily fetch the current price using a very small Python script.

使用 API,您可以使用非常小的Python脚本轻松获取当前的价格。

import import requestsrequestsurl url = = 'http://data.mtgox.com/api/2/BTCUSD/money/ticker''http://data.mtgox.com/api/2/BTCUSD/money/ticker'r r = = requestsrequests .. getget (( urlurl , , headersheaders == {
{
'Accept''Accept' : : 'application/json''application/json' })})print print rr .. jsonjson ()[()[ 'data''data' ][][ 'avg''avg' ][][ 'display_short''display_short' ]]

If you want to support for multiple currencies and more information, here’s an extended version:

如果您想支持多种货币和更多信息,请使用以下扩展版本:

Usage:

用法:

$ python bitcoin.py---BTCUSDLow: $ 305.00Average: $ 362.75High: $ 395.00Last: $ 342.00---BTCEURLow: € 221.85Average: € 272.07High: € 298.00Last: € 253.01---

翻译自:

python获取比特币数据

转载地址:http://tnqwd.baihongyu.com/

你可能感兴趣的文章
避免使用不必要的浮动
查看>>
第一节:ASP.NET开发环境配置
查看>>
sqlserver database常用命令
查看>>
rsync远程同步的基本配置与使用
查看>>
第二天作业
查看>>
访问属性和访问实例变量的区别
查看>>
Spring MVC 异常处理 - SimpleMappingExceptionResolver
查看>>
props 父组件给子组件传递参数
查看>>
【loj6038】「雅礼集训 2017 Day5」远行 树的直径+并查集+LCT
查看>>
十二种获取Spring的上下文环境ApplicationContext的方法
查看>>
UVA 11346 Probability 概率 (连续概率)
查看>>
linux uniq 命令
查看>>
Openssl rand命令
查看>>
HDU2825 Wireless Password 【AC自动机】【状压DP】
查看>>
BZOJ1015: [JSOI2008]星球大战starwar【并查集】【傻逼题】
查看>>
HUT-XXXX Strange display 容斥定理,线性规划
查看>>
mac修改用户名
查看>>
一道关于员工与部门查询的SQL笔试题
查看>>
Canvas基础
查看>>
[Hive - LanguageManual] Alter Table/Partition/Column
查看>>