bugfixing
This commit is contained in:
parent
cf81a91abb
commit
19c3ee4d06
@ -196,32 +196,35 @@ async def main():
|
|||||||
net_premium = 0
|
net_premium = 0
|
||||||
|
|
||||||
for item in data:
|
for item in data:
|
||||||
if item['ticker'] == symbol:
|
try:
|
||||||
if item['put_call'] == 'Calls':
|
if item['ticker'] == symbol:
|
||||||
call_premium += item['cost_basis']
|
|
||||||
call_open_interest += int(item['open_interest'])
|
|
||||||
call_volume += int(item['volume'])
|
|
||||||
elif item['put_call'] == 'Puts':
|
|
||||||
put_premium += item['cost_basis']
|
|
||||||
put_open_interest += int(item['open_interest'])
|
|
||||||
put_volume += int(item['volume'])
|
|
||||||
|
|
||||||
if item['sentiment'] == 'Bullish':
|
|
||||||
bullish_premium +=item['cost_basis']
|
|
||||||
if item['put_call'] == 'Calls':
|
if item['put_call'] == 'Calls':
|
||||||
net_call_premium +=item['cost_basis']
|
call_premium += item['cost_basis']
|
||||||
|
call_open_interest += int(item['open_interest'])
|
||||||
|
call_volume += int(item['volume'])
|
||||||
elif item['put_call'] == 'Puts':
|
elif item['put_call'] == 'Puts':
|
||||||
net_put_premium +=item['cost_basis']
|
put_premium += item['cost_basis']
|
||||||
|
put_open_interest += int(item['open_interest'])
|
||||||
if item['sentiment'] == 'Bearish':
|
put_volume += int(item['volume'])
|
||||||
bearish_premium +=item['cost_basis']
|
|
||||||
if item['put_call'] == 'Calls':
|
|
||||||
net_call_premium -=item['cost_basis']
|
|
||||||
elif item['put_call'] == 'Puts':
|
|
||||||
net_put_premium -=item['cost_basis']
|
|
||||||
|
|
||||||
if item['sentiment'] == 'Neutral':
|
if item['sentiment'] == 'Bullish':
|
||||||
neutral_premium +=item['cost_basis']
|
bullish_premium +=item['cost_basis']
|
||||||
|
if item['put_call'] == 'Calls':
|
||||||
|
net_call_premium +=item['cost_basis']
|
||||||
|
elif item['put_call'] == 'Puts':
|
||||||
|
net_put_premium +=item['cost_basis']
|
||||||
|
|
||||||
|
if item['sentiment'] == 'Bearish':
|
||||||
|
bearish_premium +=item['cost_basis']
|
||||||
|
if item['put_call'] == 'Calls':
|
||||||
|
net_call_premium -=item['cost_basis']
|
||||||
|
elif item['put_call'] == 'Puts':
|
||||||
|
net_put_premium -=item['cost_basis']
|
||||||
|
|
||||||
|
if item['sentiment'] == 'Neutral':
|
||||||
|
neutral_premium +=item['cost_basis']
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
with open(f"json/options-historical-data/companies/{symbol}.json", "r") as file:
|
with open(f"json/options-historical-data/companies/{symbol}.json", "r") as file:
|
||||||
past_data = orjson.loads(file.read())[0]
|
past_data = orjson.loads(file.read())[0]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user