Update asset_analysis.py
Browse files- asset_analysis.py +5 -1
asset_analysis.py
CHANGED
|
@@ -24,9 +24,13 @@ def get_start_date(interval):
|
|
| 24 |
today = date.today()
|
| 25 |
if interval in ['1d', '1wk', '1mo']:
|
| 26 |
years_ago = 5
|
|
|
|
|
|
|
|
|
|
| 27 |
else:
|
| 28 |
years_ago = 2
|
| 29 |
-
|
|
|
|
| 30 |
return start_date.strftime("%Y-%m-%d")
|
| 31 |
|
| 32 |
def fetch_asset_data(symbol, start_date, end_date, interval='1d', asset_type='stock'):
|
|
|
|
| 24 |
today = date.today()
|
| 25 |
if interval in ['1d', '1wk', '1mo']:
|
| 26 |
years_ago = 5
|
| 27 |
+
days_ago = 365*years_ago
|
| 28 |
+
elif interval == '1h':
|
| 29 |
+
days_ago = 5
|
| 30 |
else:
|
| 31 |
years_ago = 2
|
| 32 |
+
days_ago = 365*years_ago
|
| 33 |
+
start_date = today - timedelta(days=365 * days_ago)
|
| 34 |
return start_date.strftime("%Y-%m-%d")
|
| 35 |
|
| 36 |
def fetch_asset_data(symbol, start_date, end_date, interval='1d', asset_type='stock'):
|