import sys, re with open('strategy/swing.py', 'r', encoding='utf-8') as f: text = f.read() text = text.replace('elif daily_trend < 0:', 'elif daily_trend < 0:\n return self._neutral(symbol, now, current_price, "negative_trend_ignored")\n elif False:') with open('strategy/swing.py', 'w', encoding='utf-8') as f: f.write(text)