def doUnsubscribe(securities):
try:
_, sessionRestarted = openBloombergService(app.sessionForSubscriptions, "//blp/mktdata")
if sessionRestarted:
app.allSubscriptions = {}
subscriptionList = blpapi.SubscriptionList()
for security in securities:
correlationId = blpapi.CorrelationId(sys.intern(security))
if security in app.allSubscriptions:
del app.allSubscriptions[security]
subscriptionList.add(security, correlationId=correlationId)
app.sessionForSubscriptions.unsubscribe(subscriptionList)
except Exception as e:
handleBrokenSession(app, e)
traceback.print_exc()
return respond500(e)
response = Response(
json.dumps({ "message": "OK"}).encode(),
status=202,
mimetype='application/json')
response.headers['Access-Control-Allow-Origin'] = allowCORS(request.headers.get('Origin'))
return response
评论列表
文章目录