Use returned position_type from signal generator instead of recalculating

This commit is contained in:
justin committed 2026-02-04 16:33:57 -07:00
1 parent 55f3e59d0b
commit e210dc7a4a
1 file changed
+2 -1
+2 -1
View File
@@ -991,6 +991,7 @@ def main():
if signal == 'sell' and not ENABLE_SHORT_SELLING: if signal == 'sell' and not ENABLE_SHORT_SELLING:
debug_print("Short selling disabled, ignoring sell signal") debug_print("Short selling disabled, ignoring sell signal")
signal = None signal = None
signal_position_type = None
bars = get_recent_bars(SYMBOL, 50) bars = get_recent_bars(SYMBOL, 50)
if bars is not None: if bars is not None:
@@ -1028,7 +1029,7 @@ def main():
entry_time = datetime.now(EASTERN) entry_time = datetime.now(EASTERN)
stop_loss = signal_stop_loss stop_loss = signal_stop_loss
position_active = True position_active = True
position_type = 'long' if signal == 'buy' else 'short' position_type = signal_position_type
if T1_SETTLEMENT_ENABLED and signal == 'buy': if T1_SETTLEMENT_ENABLED and signal == 'buy':
trade_amount = position_size trade_amount = position_size