Skip to content

Instantly share code, notes, and snippets.

@membrive
Created August 31, 2017 13:44
Show Gist options
  • Save membrive/7f182761a29300d60341886528554664 to your computer and use it in GitHub Desktop.
Save membrive/7f182761a29300d60341886528554664 to your computer and use it in GitHub Desktop.
Script to check the value of a market in Bittrex.
#!/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