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

Added timeseries to dataframes that return a date #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions quiverquant.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def congress_trading(self, ticker="", politician=False):
r = requests.get(url, headers=self.headers)
j = json.loads(r.content)
df = pd.DataFrame(j)
if not politician and len(ticker)>0:
df["Date"] = pd.to_datetime(df["Date"])
df = df.set_index("Date")
return df

def gov_contracts(self, ticker=""):
Expand All @@ -43,6 +46,10 @@ def lobbying(self, ticker=""):

r = requests.get(url, headers=self.headers)
df = pd.DataFrame(json.loads(r.content))
if len(ticker) > 0:
# converts index of pandas dataframe to Date time index rather than a tuple
df["Date"] = pd.to_datetime(df["Date"])
df = df.set_index("Date")
return df


Expand All @@ -58,6 +65,10 @@ def wikipedia(self, ticker=""):
raise NameError('Upgrade your subscription plan to access this dataset.')

df = pd.DataFrame(json.loads(r.content))
if len(ticker) > 0:
# converts index of pandas dataframe to Date time index rather than a tuple
df["Date"] = pd.to_datetime(df["Date"])
df = df.set_index("Date")
return df

def wallstreetbets(self, ticker=""):
Expand All @@ -72,6 +83,10 @@ def wallstreetbets(self, ticker=""):
raise NameError('Upgrade your subscription plan to access this dataset.')

df = pd.DataFrame(json.loads(r.content))
if len(ticker) > 0:
# converts index of pandas dataframe to Date time index rather than a tuple
df["Date"] = pd.to_datetime(df["Date"])
df = df.set_index("Date")
return df


Expand Down