コード例 #1
0
def full_quotes_queue(accessToken, symbol):
    upstox = Upstox(api_key, accessToken)
    upstox.get_master_contract(master_contract_FO)
    option = upstox.get_live_feed(
        upstox.get_instrument_by_symbol(master_contract_FO, symbol),
        LiveFeedType.Full)
    optionData = json.dumps(option).encode('utf-8')
    redis_obj.set(symbol, optionData)
コード例 #2
0
def update_option_queue(access_token, exchange, instrument):
    u = Upstox(api_key, access_token)
    u.get_master_contract(master_contract_FO)
    try:
        live_instrument = u.get_live_feed(
            u.get_instrument_by_symbol('NSE_FO', instrument),
            LiveFeedType.Full)
        redis_obj.set(instrument, json.dumps(live_instrument))
    except:
        print("deleting...", instrument)
        redis_obj.delete(instrument)