update endpoint
This commit is contained in:
parent
e2088f9e34
commit
6377c72899
@ -1431,7 +1431,7 @@ async def get_price_alert(data: dict, api_key: str = Security(get_api_key)):
|
|||||||
'symbol': item.symbol,
|
'symbol': item.symbol,
|
||||||
'name': getattr(item, 'name', ''),
|
'name': getattr(item, 'name', ''),
|
||||||
'id': item.id,
|
'id': item.id,
|
||||||
'assetType': getattr(item, 'asset_type', ''),
|
'type': getattr(item, 'asset_type', '').lower().replace("stock", "stocks"),
|
||||||
'targetPrice': getattr(item, 'target_price', None),
|
'targetPrice': getattr(item, 'target_price', None),
|
||||||
'condition': getattr(item, 'condition', '').capitalize(),
|
'condition': getattr(item, 'condition', '').capitalize(),
|
||||||
'priceWhenCreated': getattr(item, 'price_when_created', None),
|
'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
|
# Serialize and compress the response data
|
||||||
res_serialized = orjson.dumps(res)
|
res_serialized = orjson.dumps(res)
|
||||||
compressed_data = gzip.compress(res_serialized)
|
compressed_data = gzip.compress(res_serialized)
|
||||||
print(combined_earnings)
|
|
||||||
return StreamingResponse(
|
return StreamingResponse(
|
||||||
io.BytesIO(compressed_data),
|
io.BytesIO(compressed_data),
|
||||||
media_type="application/json",
|
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:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def process_option_activity(item):
|
def process_option_activity(item):
|
||||||
item['put_call'] = 'Calls' if item['put_call'] == 'CALL' else 'Puts'
|
item['put_call'] = 'Calls' if item['put_call'] == 'CALL' else 'Puts'
|
||||||
item['underlying_type'] = item['underlying_type'].lower()
|
item['underlying_type'] = item['underlying_type'].lower()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user