Skip to content

Commit f2b1bf1

Browse files
committed
added get_available_cash in portfolio
1 parent 0cf3564 commit f2b1bf1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

scripts/risk_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,10 @@ def _calculate_atr(portfolio, ticker, period: int = 14) -> float:
142142
Returns:
143143
ATR value
144144
"""
145-
start_date = portfolio.date
146-
end_date = start_date - timedelta(days=period)
145+
146+
end_date = portfolio.date
147+
start_date = (datetime.strptime(end_date, '%Y-%m-%d') - timedelta(days=period)).strftime('%Y-%m-%d')
147148

148-
start_date = start_date.strftime('%Y-%m-%d')
149-
end_date = end_date.strftime('%Y-%m-%d')
150149

151150
logger.info(f"start_date : {start_date}")
152151
logger.info(f"end_date : {end_date}")

0 commit comments

Comments
 (0)