Skip to content

Commit 7b6018c

Browse files
Update trade_workflow.py
1 parent 842286c commit 7b6018c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

trade_workflow.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from alpaca.data.historical import OptionHistoricalDataClient
99
from alpaca.data.requests import OptionLatestQuoteRequest
1010
from zoneinfo import ZoneInfo
11+
import sys
1112

1213
load_dotenv()
1314
GOOGLE_SCRIPT_URL = os.environ.get("GOOGLE_SCRIPT_URL")
@@ -119,7 +120,7 @@ def run_trade_workflow():
119120
clock = client.get_clock()
120121
if not getattr(clock, 'is_open', False):
121122
print(f"Market is closed (next open at {clock.next_open}). Exiting.")
122-
return
123+
return 1
123124
print(f"Market is open (current time: {clock.timestamp}). Continuing...")
124125
# 1. Close due trades
125126
open_trades = get_open_trades()
@@ -325,4 +326,4 @@ def run_trade_workflow():
325326
print(f"Error screening/opening AMC trade for {ticker}: {e}")
326327

327328
if __name__ == "__main__":
328-
run_trade_workflow()
329+
sys.exit(run_trade_workflow())

0 commit comments

Comments
 (0)