python portfolio.py

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python portfolio.py相关的知识,希望对你有一定的参考价值。

#!/usr/bin/python3
import requests
import json
from urllib.request import urlopen
from gi.repository import Notify
import time


rbtc = requests.get(url='https://blockchain.info/ticker')
objbtc = rbtc.json()
mybtc = 0.00812164
myeth = 0.13370304
btc =  float((objbtc['USD']['last']))

reth = requests.get(url='https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD')
objeth = reth.json()
eth =  (objeth['USD'])

mytotal = round(mybtc*btc + myeth*eth,2)
body = 'My CrytpoMoney - USD :$'+str(mytotal)
summary = 'BTC: $'+str(round(mybtc*btc,2))+'  ETH: $'+str(round(myeth*eth,2))

Notify.init('CryptoMoney')
notification = Notify.Notification.new(body,summary)
notification.show()
Notify.uninit()

以上是关于python portfolio.py的主要内容,如果未能解决你的问题,请参考以下文章

001--python全栈--基础知识--python安装

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍

Python学习之认识python