Esempio n. 1
0
def getRealTimeData(symbol):
    values = ys.request(symbol, 'l1pohgd1t1').split(',')
    data = {}
    data['price'] = values[0] 

    # Added by StockBook developers.
    data['prev_close'] = values[1]
    data['opening'] = values[2]
    data['high_day'] = values[3]
    data['low_day'] = values[4]
    data['day'] = values[5]
    data['time'] = values[6]
    data['code'] = symbol
    return data
Esempio n. 2
0
def getIndex(symbol):
    """
    Get all available quote data for the given ticker symbol.
    
    Returns a dictionary.
    """
    values = ys.request(symbol, 'l1c1xpohgd1t1n').split(',')
    data = {}
    data['price'] = values[0] 
    data['change'] = values[1]
    data['stock_exchange'] = values[2]

    # Added by StockBook developers.
    data['prev_close'] = values[3]
    data['opening'] = values[4]
    data['high_day'] = values[5]
    data['low_day'] = values[6]
    data['day'] = values[7]
    data['time'] = values[8]
    data['code'] = symbol
    data['full_name'] = values[9][1:] # TODO - Check

    return data