Post
Topic
Board Announcements (Altcoins)
Re: [PND]Pandacoin | 12 DAYS LEFT | August 30th - Rethinking Digital Currencies |
by
ozzke
on 18/08/2014, 10:14:18 UTC
Code:
#! /usr/bin/python2
# cryptonator API
# Written for Linux with Python2
# Author STumbles

import urllib2
import json
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("quantity", help="How many coins to convert", type=int)
parser.add_argument("base", help="Coin to start with", type=str)
parser.add_argument("target", help="Currency to convert to", type=str)
args = parser.parse_args()

class CoinConvert():
def __init__(self):
self.url = "https://www.cryptonator.com/api/ticker/%s-%s" % (args.base, args.target)
self.data = urllib2.urlopen(self.url).read()
self.json_data = json.loads(self.data)
try:
self.price = self.json_data['ticker']['price']
except:
print "error gathering a major key\nerror handling will be taken care of later\nfor now just report the problem to\n\nSTumbles @ freenode/pandacoinpnd"
try:
self.price = float(self.price)
except:
print "error converting result to float\nerror handling will be taken care of later\nfor now just report the problem to\n\nSTumbles @ freenode/pandacoinpnd"
self.answer = self.price * args.quantity
print self.answer

def main():
cc = CoinConvert()

if __name__ == "__main__":
main()


syntax: python2 coinconversion.py quantity base target

example: python2 coinconversion.py 10000 pnd ltc
example: python2 coinconversion.py 10000 pnd usd
example: python2 coinconversion.py 300 usd pnd



There wasnt much time put in to this, so i wouldnt ask for much if anything.
but if you want me to keep me motivated to write neat scripts for you guys
PUvHB2P7rBWq39skFYTW6Q3TzhQsN6BvdU - this will go directly towards beer and pizza to fuel me

what this do? plz explain

It's a scrypt for Linux as far as I understand to check the price of pnd Smiley