update endpoint

This commit is contained in:
MuslemRahimi 2024-12-05 22:26:18 +01:00
parent e2088f9e34
commit 6377c72899

View File

@ -1431,7 +1431,7 @@ async def get_price_alert(data: dict, api_key: str = Security(get_api_key)):
'symbol': item.symbol,
'name': getattr(item, 'name', ''),
'id': item.id,
'assetType': getattr(item, 'asset_type', ''),
'type': getattr(item, 'asset_type', '').lower().replace("stock", "stocks"),
'targetPrice': getattr(item, 'target_price', None),
'condition': getattr(item, 'condition', '').capitalize(),
'priceWhenCreated': getattr(item, 'price_when_created', None),
@ -1469,7 +1469,7 @@ async def get_price_alert(data: dict, api_key: str = Security(get_api_key)):
# Serialize and compress the response data
res_serialized = orjson.dumps(res)
compressed_data = gzip.compress(res_serialized)
print(combined_earnings)
return StreamingResponse(
io.BytesIO(compressed_data),
media_type="application/json",
@ -1479,6 +1479,8 @@ async def get_price_alert(data: dict, api_key: str = Security(get_api_key)):
except Exception as e:
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
def process_option_activity(item):
item['put_call'] = 'Calls' if item['put_call'] == 'CALL' else 'Puts'
item['underlying_type'] = item['underlying_type'].lower()