GoekenDataScience 0.1.2__py3-none-any.whl → 0.1.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ from .goekendatascience import TickerDataFetch, DataManipulation
2
+
3
+ __all__ = ["TickerDataFetch", "DataManipulation"]
@@ -3,16 +3,17 @@ import pandas as pd
3
3
  import requests
4
4
  import datetime
5
5
  from datetime import date
6
+ import yfinance as yf
6
7
 
7
8
  class TickerDataFetch:
8
9
 
9
10
  def __init__(self):
10
- self.AV_key = 'K8LPY5GIQZ2REC46'
11
11
  self.todays_date = str(date.today())
12
12
  self.script_dir = os.path.dirname(os.path.abspath(__file__))
13
13
  self.output_folder = os.path.join(self.script_dir, "Historical Data")
14
14
 
15
15
  def folder_scan(self):
16
+ os.makedirs(self.output_folder, exist_ok=True)
16
17
  self.List = os.listdir(self.output_folder)
17
18
  self.namelist = {}
18
19
  for item in self.List:
@@ -20,18 +21,16 @@ class TickerDataFetch:
20
21
  ticker_date = item.split('.')[0].split()[1]
21
22
  self.namelist[ticker_name] = ticker_date
22
23
 
23
- def fetch_historical_data(self,ticker):
24
- url = f'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol={ticker}&outputsize=full&apikey={self.AV_key}'
25
- r = requests.get(url)
26
- data = r.json()
27
- historical_data = pd.DataFrame(data['Time Series (Daily)']).transpose()
28
- historical_data.columns = ['O', 'H', 'L', 'C', 'V']
24
+ def fetch_historical_data(self, ticker):
25
+ ticker_data = yf.download(ticker, period='max')
29
26
  os.makedirs(self.output_folder, exist_ok=True)
30
27
  csv_path = os.path.join(self.output_folder, f"{ticker} {self.todays_date}.csv")
31
- historical_data.to_csv(csv_path, index=True)
28
+ DataFrame = pd.DataFrame(ticker_data)
29
+ DataFrame.columns = ['Close','High','Low','Open','Volume']
30
+ DataFrame.to_csv(csv_path,index=True,header=True)
32
31
  print(f"Saved CSV to: {csv_path}")
33
32
 
34
- def update_tickers (self,tickers):
33
+ def update_tickers (self,tickers,AV_key):
35
34
  self.folder_scan()
36
35
  for ticker in tickers:
37
36
  if ticker in self.namelist:
@@ -39,10 +38,10 @@ class TickerDataFetch:
39
38
  print(ticker,"data found for",self.todays_date)
40
39
  else:
41
40
  os.remove(os.path.join(self.output_folder, f"{ticker} {self.namelist[ticker]}.csv"))
42
- self.fetch_historical_data(ticker)
41
+ self.fetch_historical_data(ticker,AV_key)
43
42
  print(ticker,"data found for",self.namelist[ticker],". Updating data for",self.todays_date)
44
43
  else:
45
- self.fetch_historical_data(ticker)
44
+ self.fetch_historical_data(ticker,AV_key)
46
45
  print(ticker,"data not found",{ticker},". Updating data for",self.todays_date)
47
46
  for ticker in self.namelist:
48
47
  if ticker in tickers:
@@ -57,7 +56,7 @@ class TickerDataFetch:
57
56
  self.folder_scan()
58
57
  for ticker in self.namelist:
59
58
  data = pd.read_csv(os.path.join(self.output_folder, f"{ticker} {self.namelist[ticker]}.csv"))
60
- print(data.columns[0])
59
+ ticker_data.set_index('Date',inplace=True)
61
60
  ticker_data[ticker] = data
62
61
  return ticker_data
63
62
 
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GoekenDataScience
3
- Version: 0.1.2
4
- Summary: Python package for Goeken Data Science analytics
3
+ Version: 0.1.16
4
+ Summary: Python package for Goeken Data Science
5
5
  Author-email: Ryan Goeken <your@email.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/yourusername/GoekenStats
@@ -9,7 +9,7 @@ Requires-Python: >=3.7
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
11
  Requires-Dist: pandas>=2.0
12
- Requires-Dist: numpy>=1.26
12
+ Requires-Dist: numpy<2.0,>=1.26
13
13
  Requires-Dist: requests>=2.32
14
14
  Dynamic: license-file
15
15
 
@@ -19,4 +19,4 @@ A simple Python package for fetching and updating historical stock data from Alp
19
19
 
20
20
  ## Installation
21
21
  ```bash
22
- pip install GoekenStats
22
+ pip install GoekenDataScience
@@ -0,0 +1,7 @@
1
+ goekendatascience/__init__.py,sha256=j_tBPRvfa1A9Sm1ks-ukFR9pYkW5Tmk02ct6SiCqfe4,117
2
+ goekendatascience/goekendatascience.py,sha256=lrK3CA3kJpqrfxtOyXovFgHrp0cGsVG7ZX-aKd3zraw,2715
3
+ goekendatascience-0.1.16.dist-info/licenses/LICENSE.txt,sha256=_1SdDE0mGZEIDtOGHP7Kgo-Bf9c27L5rQUwvU4mscCY,1089
4
+ goekendatascience-0.1.16.dist-info/METADATA,sha256=aU7A_ktvTLuWxdkyW43D8DFpgfwx-OdvVDe-x5p5xNk,624
5
+ goekendatascience-0.1.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ goekendatascience-0.1.16.dist-info/top_level.txt,sha256=F-jZq2o9_m8Tk-sCJsB6PC6sMyNYAy1m-UduxikdyhU,18
7
+ goekendatascience-0.1.16.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ goekendatascience
@@ -1,7 +0,0 @@
1
- goekendatascience-0.1.2.dist-info/licenses/LICENSE.txt,sha256=_1SdDE0mGZEIDtOGHP7Kgo-Bf9c27L5rQUwvU4mscCY,1089
2
- goekenstats/__init__.py,sha256=9Gs18VBVL2qqWPozi6FUW1abnfih6Nrkhbs0_2MXLio,111
3
- goekenstats/goekenstats.py,sha256=XVFHshY-d0nkxgEHZBd5wuw31VZUXJKuax8I-OC-7uU,2789
4
- goekendatascience-0.1.2.dist-info/METADATA,sha256=tCkN7V_frIiijdX6zkAdSKFvM31ei7dEyAXn-uovNA4,622
5
- goekendatascience-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- goekendatascience-0.1.2.dist-info/top_level.txt,sha256=fr5iok9jwn03JaaQILbL2aumQ5zGs8vgvI4v5sTHjCE,12
7
- goekendatascience-0.1.2.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- goekenstats
goekenstats/__init__.py DELETED
@@ -1,3 +0,0 @@
1
- from .GoekenStats import TickerDataFetch, DataManipulation
2
-
3
- __all__ = ["TickerDataFetch", "DataManipulation"]