Created
August 31, 2017 13:44
-
-
Save membrive/7f182761a29300d60341886528554664 to your computer and use it in GitHub Desktop.
Script to check the value of a market in Bittrex.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import requests | |
import sys | |
if len(sys.argv) <= 1: | |
print('Usage: bp [market]') | |
exit(1) | |
url = 'https://bittrex.com/api/v1.1/public/getticker?market=' + str(sys.argv[1]) | |
response = requests.get(url) | |
content = json.loads(response.content.decode('utf-8')) | |
if content['success'] == False: | |
print('Not found') | |
exit(1) | |
print('Last: ' + str(format(float(content['result']['Last']), '.8f'))) | |
print('Bid: ' + str(format(float(content['result']['Bid']), '.8f'))) | |
print('Ask: ' + str(format(float(content['result']['Ask']), '.8f'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment