Skip to content

Commit

Permalink
added try catch for VIX
Browse files Browse the repository at this point in the history
  • Loading branch information
powprashant committed Sep 22, 2023
1 parent f0299bd commit 4d6193e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/daily_short.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ def main(args) -> None:
# For now simply log the current INDIAVIX
# A very high vix day should be avoided, though the premiums will be very
# high
current_vix = strike_mgr.get_indices()["INDIAVIX"] / 100
logger.info("INDIA VIX :%.2f", current_vix)
if current_vix > 20.0:
logger.info("VIX IS HIGH TODAY, AVOIDING TRADING")
return
try:
current_vix = strike_mgr.get_indices()["INDIAVIX"] / 100
logger.info("INDIA VIX :%.2f", current_vix)
if current_vix > 20.0:
logger.info("VIX IS HIGH TODAY, AVOIDING TRADING")
return
except Exception as exp:
logger.error(exp)
logger.error("Could not obtain VIX, continuing")
order_mgr = order_manager.OrderManager(client=client, config=config)
if args.tag != "" and args.monitor_target <= 0.0 and not args.pnl:
order_mgr.debug_status(tag=args.tag)
Expand Down

0 comments on commit 4d6193e

Please sign in to comment.