Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- #Convert your timezone to unix time. Use an epoch accurate to the second.
- epoch = 1634475600
- #Change fdatetime to match your .json filename.
- fdatetime = '211017_2254'
- #Change this to 'inCirculation' for number of coins, or 'price' for price.
- fdata = 'inCirculation'
- #Change this to rename the output .txt file.
- ftype = 'daily'
- #don't change this
- fname = 'getMarketInfo'+fdatetime+'.json'
- #don't change this
- epoch *= 1000
- txt = ftype+fdata+fdatetime+'_'+str(epoch)+'.txt'
- outf = open(txt, 'w')
- outf.write(str(epoch)+'\n')
- with open(fname) as f:
- data = json.load(f)
- for h in data['coinInfo']['data']:
- looping = 1
- for i in data['coinInfo']['data'][h]['history']:
- for j in i:
- if(looping==0):
- break
- if(j=='timestamp'):
- if(i[j]>=epoch):
- if(h=='himemoriluna'):
- print('luna ' + str(i[fdata]))
- outf.write('luna ' + str(i[fdata]) + '\n')
- else:
- print(h + ' ' + str(i[fdata]))
- outf.write(h + ' ' + str(i[fdata]) + '\n')
- looping = 0
- break
- outf.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement