Sunday, August 13, 2017
Saturday, August 12, 2017
Friday, August 11, 2017
Thursday, August 10, 2017
Wednesday, August 9, 2017
Bash (Unix shell): Converting Bitcoin Cash Amount to Yen
Command:
$ cat ./cryptocurrency_price_bittrex.sh
Result:
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 PAIR AMOUNT" >&2
exit 1
fi
pair=$1;
amount=$2;
yenrate=$(curl -s "https://coincheck.com/api/rate/BTC_JPY" | python -c "import sys, json; print json.load(sys.stdin)['rate']");
curl -s "https://bittrex.com/api/v1.1/public/getticker?market=$pair" | python -c "import sys, json; print float(json.load(sys.stdin)['result']['Last']) * float(sys.argv[1]) * float(sys.argv[2])" $amount $yenrate
Command (How many Yen for 0.19 Bitcoin Cash):
$ ./cryptocurrency_price_bittrex.sh BTC-BCC 0.19
Result:
7461.446566
$ cat ./cryptocurrency_price_bittrex.sh
Result:
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 PAIR AMOUNT" >&2
exit 1
fi
pair=$1;
amount=$2;
yenrate=$(curl -s "https://coincheck.com/api/rate/BTC_JPY" | python -c "import sys, json; print json.load(sys.stdin)['rate']");
curl -s "https://bittrex.com/api/v1.1/public/getticker?market=$pair" | python -c "import sys, json; print float(json.load(sys.stdin)['result']['Last']) * float(sys.argv[1]) * float(sys.argv[2])" $amount $yenrate
Command (How many Yen for 0.19 Bitcoin Cash):
$ ./cryptocurrency_price_bittrex.sh BTC-BCC 0.19
Result:
7461.446566
Tuesday, August 8, 2017
Tuesday, August 1, 2017
Bash (Unix shell): Getting Cryptocurrency Price Using API
Command:
$ cat cryptocurrency_price.sh
Result:
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 PAIR AMOUNT" >&2
exit 1
fi
pair=$1; amount=$2; curl -s "https://coincheck.com/api/rate/$pair" | python -c "import sys, json; print float(json.load(sys.stdin)['rate']) * float(sys.argv[1])" $amount
Command:
$ ./cryptocurrency_price.sh
Result:
Usage: ./cryptocurrency_price_jpy.sh PAIR AMOUNT
Command:
$ ./cryptocurrency_price.sh btc_jpy 1
Result:
318146.0
Command:
$ ./cryptocurrency_price_jpy.sh eth_jpy 13.5
Result:
303218.972773
Command:
$ ./cryptocurrency_price_jpy.sh xem_jpy 1000
Result:
18703.59758
$ cat cryptocurrency_price.sh
Result:
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 PAIR AMOUNT" >&2
exit 1
fi
pair=$1; amount=$2; curl -s "https://coincheck.com/api/rate/$pair" | python -c "import sys, json; print float(json.load(sys.stdin)['rate']) * float(sys.argv[1])" $amount
Command:
$ ./cryptocurrency_price.sh
Result:
Usage: ./cryptocurrency_price_jpy.sh PAIR AMOUNT
Command:
$ ./cryptocurrency_price.sh btc_jpy 1
Result:
318146.0
Command:
$ ./cryptocurrency_price_jpy.sh eth_jpy 13.5
Result:
303218.972773
Command:
$ ./cryptocurrency_price_jpy.sh xem_jpy 1000
Result:
18703.59758
Subscribe to:
Posts (Atom)