金价实时行情API接口用Python实现调用示例

功能介绍

1.多个子接口可提供当日实时黄金行情数据,如上交所,银行账户黄金,国际金价及金店价格等。

2、获取最低价、最高价、卖价、昨日收盘价、开盘价、涨跌值、最新价格、时间、买价、涨跌幅等行情。

3、updatetime 参数为更新数据的时间。

4、多通道切换查询,接口稳定可靠。

如何用Python进行对接?

下面我们用阿里云接口为例,Python代码(上海黄金交易所接口)如下

接口地址:https://market.aliyun.com/apimarket/detail/cmapi00067356
import urllib, urllib3, sys, uuid
import ssl


host = 'https://tsgold2.market.alicloudapi.com'
path = '/shgold'
method = 'GET'
appcode = '你自己的AppCode'
querys = ''
bodys = {}
url = host + path

http = urllib3.PoolManager()
headers = {
    'Authorization': 'APPCODE ' + appcode
}
response = http.request('GET', url, headers=headers)
content = response.data.decode('utf-8')
if (content):
    print(content)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值