Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stocks/ta/vwap #4894

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions openbb_terminal/common/technical_analysis/overlap_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import logging
import os
from datetime import datetime
from typing import List, Optional, Union

import pandas as pd
Expand Down Expand Up @@ -93,8 +94,8 @@ def view_ma(
def view_vwap(
data: pd.DataFrame,
symbol: str = "",
start_date: Optional[str] = None,
end_date: Optional[str] = None,
start_date: Optional[datetime] = None,
end_date: Optional[datetime] = None,
offset: int = 0,
interval: str = "",
export: str = "",
Expand Down Expand Up @@ -129,18 +130,19 @@ def view_vwap(
start = data.index[0].date()
console.print(f"No start date specified. Start date: {start}")
else:
start = start_date
start = datetime.date(start_date)

if end_date is None:
end = data.index[-1].date()
console.print(f"No end date specified. End date: {end}")
else:
end = end_date
end = datetime.date(end_date)

day_df = data[(start <= data.index.date) & (data.index.date <= end)]

if len(day_df) == 0:
return console.print(
f"[red]No data found between {start.strftime('%Y-%m-%d')} and {end.strftime('%Y-%m-%d')}\n[/red]"
f"[red]No data found between {start.strftime('%Y-%m-%d')} and {end.strftime('%Y-%m-%d')}[/red]"
)

ta = PlotlyTA()
Expand Down