Skip to content

Commit

Permalink
add minimal comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Sep 12, 2015
1 parent 28d9713 commit b4651ed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions collect-data/collect_trades.py
Expand Up @@ -14,6 +14,9 @@


def format_trade(trade):
'''
Formats trade data
'''
if all(key in trade for key in ('tid', 'amount', 'price', 'timestamp')):
trade['_id'] = trade.pop('tid')
trade['amount'] = float(trade['amount'])
Expand All @@ -24,6 +27,9 @@ def format_trade(trade):


def get_json(url):
'''
Gets json from the API
'''
resp = urllib2.urlopen(url)
return json.load(resp, object_hook=format_trade), resp.getcode()

Expand Down

0 comments on commit b4651ed

Please sign in to comment.