Spaces:
Runtime error
Runtime error
kristada673
commited on
Commit
•
9b5de9a
1
Parent(s):
8221867
Upload 3 files
Browse files
finnlp/data_sources/trends/_base.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class Trend_Downloader:
|
2 |
+
|
3 |
+
def __init__(self, args = {}):
|
4 |
+
pass
|
5 |
+
|
6 |
+
def download(self, start_date, end_date, stock = "all"):
|
7 |
+
pass
|
8 |
+
|
9 |
+
def clean_data(self):
|
10 |
+
pass
|
11 |
+
|
12 |
+
def gather_one_day(self,date,stock = "all",delay = 0.1):
|
13 |
+
pass
|
14 |
+
|
15 |
+
def transfer_standard_date_to_nonstandard(self,date):
|
16 |
+
pass
|
finnlp/data_sources/trends/baidu.py
ADDED
File without changes
|
finnlp/data_sources/trends/google.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pytrends.request import TrendReq
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
class Google_Trends:
|
5 |
+
def __init__(self,args = {}):
|
6 |
+
# https://github.com/GeneralMills/pytrends
|
7 |
+
self.pytrends = TrendReq(hl='en-US', tz=360)
|
8 |
+
|
9 |
+
def download(self, start_date, end_date, stock = 'apple' ):
|
10 |
+
self.date_list = pd.date_range(start_date,end_date)
|
11 |
+
timeframe = [f"{start_date} {end_date}"]
|
12 |
+
kw_list = [stock]
|
13 |
+
self.pytrends.build_payload(kw_list=kw_list, timeframe=timeframe)
|
14 |
+
res = self.pytrends.interest_over_time()
|
15 |
+
# res.columns = ["date","value"]
|
16 |
+
return res
|