def db_info(): size = Ticks.count() if size == 0: return jsonify({'db_size': 0}) created = Ticks.oldest() modified = Ticks.newest() model = {'db_size': size, 'db_created': created['Time'], 'db_modified': modified['Time']} return jsonify(model)
def exchange(name): ticker = Ticks.get_spot(name, datetime.utcnow() + timedelta(hours=-1)) model = [] for tick in ticker: model.append([tick['Time'].isoformat(), tick['Spot'], tick['Bid'], tick['Ask']]) return jsonify(result = model)
def exchanges(): exchanges = Ticks.get_exchange_names() return jsonify(result = exchanges)