10 liens privés
siste pour apprendre git
idée cadeau SCAE
idée pour cadeau SCAE
#permet de générer un code html pour publication de snyppet pyton
import tkinter
main_window = tkinter.Tk() # on lance la fenetre tkinter
label_titre = tkinter.Label(main_window, text='Titre du code')
label_titre.grid()
titre = tkinter.Text(main_window,height=2, width = 120)
titre.grid()
label_code= tkinter.Label(main_window, text='Code')
label_code.grid()
code = tkinter.Text(main_window,height=12, width = 120)
code.grid()
def generer():
balise_html.delete('1.0', tkinter.END)
balise_html.insert(tkinter.END,'<a href="#' + titre.get( '1.0', tkinter.END).replace(' ','').replace('\n','') + '">' + titre.get( '1.0', tkinter.END).replace('\n','')+'</a><br>')
code_html.delete('1.0', tkinter.END)
code_html.insert(tkinter.END,'<p><div id="' + titre.get( '1.0', tkinter.END).replace(' ','').replace('\n','') + '"></div>'+'\n')
code_html.insert(tkinter.END,'<b>' + titre.get( '1.0', tkinter.END).replace('\n','') + '<br></b>'+'\n')
code_html.insert(tkinter.END,code.get( '1.0', tkinter.END).replace(' ',' ').replace('\n','<br>'+'\n')+'</p>')
button_generer = tkinter.Button(main_window,text=u"Générer code", command=generer, bg='LightSkyBlue1')
button_generer.grid ()
label_balise = tkinter.Label(main_window, text='Ancre html a placer en début de fichier')
label_balise.grid()
balise_html = tkinter.Text(main_window,height=2, width = 120)
balise_html.grid()
label_html = tkinter.Label(main_window, text='Code html a placer dans le corps du fichier')
label_html.grid()
code_html = tkinter.Text(main_window,height=12, width = 120)
code_html.grid()
main_window.mainloop()
input()
displayEventTime: false // pour ne pas afficher l'heure
firstDay: 1 // mettre le premier jour a lundi
#Interet : Bitcoin, Litecoin,Ethereum,Monero,Zcash,Dash
import urllib.request, json, datetime,matplotlib.pyplot as plt
cur_to_plt = "Litecoin"
dat_invest = '2017-05-01'
currency_name= {"Bitcoin" : "XBT", "Ethereum" : "ETH", "Bitcoin Cash": "BCH" , "Monero" : "XMR", "Dash" : "DASH" , "Litecoin" : "LTC" , "Ripple" : "XRP" , \
"Ethereum Classic" : "ETC" , "Augur REP tokens" : "REP", "Zcash" : "ZEC" }
currency_min_size = {"Augur" : 0.3 ,"Bitcoin" : 0.002, "Bitcoin Cash" : 0.002 ,"Dash" : 0.03 , "Dogecoin" : 3000 , "Ethereum" : 0.02, "Ethereum Classic" : 0.3, "Gnosis" : 0.03, \
"Litecoin" : 0.1, "Monero" : 0.1, "Ripple" : 30, "Zcash" : 0.03, "Tether" : 5}
with urllib.request.urlopen("https://api.kraken.com/0/public/OHLC?pair=" + currency_name[cur_to_plt]+"EUR&interval=1440") as url:
datas = json.loads(url.read().decode())
with open('OHLC.json', 'r') as f:
datas = json.load(f)
for i in datas['result'].keys() :
if 'EUR' in i : clef = i
for i in datas['result'][clef] :
if datetime.datetime.fromtimestamp(i[0]).strftime('%Y-%m-%d') == dat_invest :
gain = (float(datas['result'][clef][-1][1])*(50 / float(i[1])))-50
data_toplot = [float(i[1]) for i in datas['result'][clef] if (datetime.datetime.fromtimestamp(i[0])- datetime.datetime(int(dat_invest.split('-')[0]), int(dat_invest.split('-')[1]), int(dat_invest.split('-')[2]))).days > 1]
header = [datetime.datetime.fromtimestamp(i[0])for i in datas['result'][clef] if (datetime.datetime.fromtimestamp(i[0])- datetime.datetime(int(dat_invest.split('-')[0]), int(dat_invest.split('-')[1]), int(dat_invest.split('-')[2]))).days > 1]
plt.plot_date(header,data_toplot,linestyle='solid',markersize=2)
try:
plt.title(cur_to_plt + '\n € min order : ' +str("%.2f" % (currency_min_size[cur_to_plt]*data_toplot[-1])) + ' \n gain depuis ' + dat_invest +': ' + str("%.2f" % gain))
except :
pass
plt.show()
!/usr/bin/env python3
import urllib.request, json, datetime, matplotlib
with urllib.request.urlopen("https://api.kraken.com/0/public/Spread?pair=XBTEUR&since=1509397648") as url:
datas = json.loads(url.read().decode())
with open('Spread.json', 'r') as f:
datas = json.load(f)
for i in datas['result'].keys() : print(i)
for i in datas['result']['XXBTZEUR'] :
print (str((datetime.datetime.fromtimestamp(i[0]))) + ' ' + str(i[1])+ ' ' + str(i[2]))
print(len(datas['result']['XXBTZEUR']))
print (datas['result']['last'])