mdj1412 commited on
Commit
a2d2569
โ€ข
1 Parent(s): c1654fa
Files changed (2) hide show
  1. README.md +3 -0
  2. dataset_creation/nasdaq_data.py +8 -5
README.md CHANGED
@@ -11,6 +11,9 @@ pinned: false
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
 
 
 
 
14
  # Stock News Analysis
15
 
16
  This project uses Natural Language Processing (NLP) techniques and machine learning models to analyze stock news, extract valuable insights, and provide visualizations to help users make informed investment decisions.
 
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
 
14
+
15
+ =============
16
+
17
  # Stock News Analysis
18
 
19
  This project uses Natural Language Processing (NLP) techniques and machine learning models to analyze stock news, extract valuable insights, and provide visualizations to help users make informed investment decisions.
dataset_creation/nasdaq_data.py CHANGED
@@ -50,19 +50,20 @@ def get_list(tickers=nasdaq100_symbols):
50
  # ์ฃผ์‹ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
51
  def get_data(tickers=nasdaq100_symbols, numOfDay=2):#numOfDay: ๋‚ ์งœ ๊ฐ„๊ฒฉ
52
  output = []
 
53
 
54
  # ์‹œ์ž‘ ๋‚ ์งœ ~ ์ตœ๊ทผ๊นŒ์ง€ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
55
  now = datetime.now() # ์˜ค๋Š˜ ๋‚ ์งœ
56
  date = now.weekday() # ์š”์ผ ํ™•์ธ
57
 
58
  if date == 5: # Saturday
59
- start_date = datetime(now.year, now.month, now.day, 0, 0) - timedelta(days=numOfDay+4)
60
  end_date = datetime(now.year, now.month, now.day, 0, 0)
61
  elif date == 6 or date == 0 or date == 1: # Sunday or Monday or Tuesday
62
- start_date = datetime(now.year, now.month, now.day, 0, 0) - timedelta(days=numOfDay+5)
63
  end_date = datetime(now.year, now.month, now.day, 0, 0)
64
  else: # Others
65
- start_date = datetime(now.year, now.month, now.day, 0, 0) - timedelta(days=numOfDay+3)
66
  end_date = datetime(now.year, now.month, now.day, 0, 0)
67
 
68
 
@@ -80,8 +81,10 @@ def get_data(tickers=nasdaq100_symbols, numOfDay=2):#numOfDay: ๋‚ ์งœ ๊ฐ„๊ฒฉ
80
  output.append(abc)
81
 
82
  # print("Output : ", output)
83
- if len(output[0]) < numOfDay:
84
- output = get_data(tickers, numOfDay+numOfDay-len(output[0]))
 
 
85
  return output
86
 
87
 
 
50
  # ์ฃผ์‹ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
51
  def get_data(tickers=nasdaq100_symbols, numOfDay=2):#numOfDay: ๋‚ ์งœ ๊ฐ„๊ฒฉ
52
  output = []
53
+ delta = (numOfDay / 7) * 2
54
 
55
  # ์‹œ์ž‘ ๋‚ ์งœ ~ ์ตœ๊ทผ๊นŒ์ง€ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
56
  now = datetime.now() # ์˜ค๋Š˜ ๋‚ ์งœ
57
  date = now.weekday() # ์š”์ผ ํ™•์ธ
58
 
59
  if date == 5: # Saturday
60
+ start_date = datetime(now.year, now.month, now.day, 0, 0) - timedelta(days=numOfDay+4+delta)
61
  end_date = datetime(now.year, now.month, now.day, 0, 0)
62
  elif date == 6 or date == 0 or date == 1: # Sunday or Monday or Tuesday
63
+ start_date = datetime(now.year, now.month, now.day, 0, 0) - timedelta(days=numOfDay+5+delta)
64
  end_date = datetime(now.year, now.month, now.day, 0, 0)
65
  else: # Others
66
+ start_date = datetime(now.year, now.month, now.day, 0, 0) - timedelta(days=numOfDay+3+delta)
67
  end_date = datetime(now.year, now.month, now.day, 0, 0)
68
 
69
 
 
81
  output.append(abc)
82
 
83
  # print("Output : ", output)
84
+ # from IPython import embed; embed()
85
+ if numOfDay != 60 and len(list(output[0].index.values)) < numOfDay:
86
+ print(numOfDay+numOfDay-len(list(output[0].index.values)))
87
+ output = get_data(tickers, numOfDay+numOfDay-len(list(output[0].index.values)))
88
  return output
89
 
90