bugfixing

This commit is contained in:
MuslemRahimi 2025-01-15 11:00:38 +01:00
parent e591fd2bd3
commit 2c6e38137c

View File

@ -12,6 +12,10 @@ from functools import partial
import asyncio import asyncio
import aiohttp import aiohttp
today = datetime.today().date()
load_dotenv() load_dotenv()
api_key = os.getenv('UNUSUAL_WHALES_API_KEY') api_key = os.getenv('UNUSUAL_WHALES_API_KEY')
@ -92,7 +96,7 @@ def prepare_data(data, symbol):
if float(item['volume']) > 0: if float(item['volume']) > 0:
# Parse option_symbol # Parse option_symbol
date_expiration, option_type, strike_price = parse_option_symbol(item['option_symbol']) date_expiration, option_type, strike_price = parse_option_symbol(item['option_symbol'])
if date_expiration >= today:
# Round numerical and numerical-string values # Round numerical and numerical-string values
new_item = { new_item = {
key: safe_round(value) if isinstance(value, (int, float, str)) else value key: safe_round(value) if isinstance(value, (int, float, str)) else value
@ -130,6 +134,7 @@ def get_hottest_contracts():
response = requests.get(url, headers=headers) response = requests.get(url, headers=headers)
if response.status_code == 200: if response.status_code == 200:
data = response.json()['data'] data = response.json()['data']
prepare_data(data, symbol) prepare_data(data, symbol)
counter +=1 counter +=1