GoekenDataScience 0.1.14__tar.gz → 0.1.17__tar.gz
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.
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/PKG-INFO +1 -1
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/pyproject.toml +1 -1
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/PKG-INFO +1 -1
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/goekendatascience/goekendatascience.py +13 -30
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/LICENSE.txt +0 -0
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/README.md +0 -0
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/setup.cfg +0 -0
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/SOURCES.txt +0 -0
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/dependency_links.txt +0 -0
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/requires.txt +0 -0
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/top_level.txt +0 -0
- {goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/goekendatascience/__init__.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "GoekenDataScience" # Package name on PyPI
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.17" # Increment this for new releases
|
|
8
8
|
description = "Python package for Goeken Data Science"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7" # minimum Python version
|
{goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/goekendatascience/goekendatascience.py
RENAMED
|
@@ -3,6 +3,7 @@ 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
|
|
|
@@ -20,34 +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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
print('Alpha Vangtage key',i,'failed, trying next key')
|
|
32
|
-
else:
|
|
33
|
-
try:
|
|
34
|
-
historical_data = pd.DataFrame(data[list(data.keys())[1]]).transpose()
|
|
35
|
-
key_success = 1
|
|
36
|
-
except:
|
|
37
|
-
print(str(data))
|
|
38
|
-
key_success = 0
|
|
39
|
-
|
|
40
|
-
if key_success == 1:
|
|
41
|
-
print('Successfully fetched data for',ticker)
|
|
42
|
-
historical_data.columns = ['O', 'H', 'L', 'C', 'V']
|
|
43
|
-
os.makedirs(self.output_folder, exist_ok=True)
|
|
44
|
-
csv_path = os.path.join(self.output_folder, f"{ticker} {self.todays_date}.csv")
|
|
45
|
-
historical_data.to_csv(csv_path, index=True)
|
|
46
|
-
print(f"Saved CSV to: {csv_path}")
|
|
47
|
-
else:
|
|
48
|
-
print("Failed to fetch data")
|
|
24
|
+
def fetch_historical_data(self, ticker):
|
|
25
|
+
ticker_data = yf.download(ticker, period='max')
|
|
26
|
+
os.makedirs(self.output_folder, exist_ok=True)
|
|
27
|
+
csv_path = os.path.join(self.output_folder, f"{ticker} {self.todays_date}.csv")
|
|
28
|
+
DataFrame = pd.DataFrame(ticker_data)
|
|
29
|
+
DataFrame.columns = ['Close','High','Low','Open','Volume']
|
|
30
|
+
DataFrame.to_csv(csv_path,index=True,header=True)
|
|
31
|
+
print(f"Saved CSV to: {csv_path}")
|
|
49
32
|
|
|
50
|
-
def update_tickers (self,tickers
|
|
33
|
+
def update_tickers (self,tickers):
|
|
51
34
|
self.folder_scan()
|
|
52
35
|
for ticker in tickers:
|
|
53
36
|
if ticker in self.namelist:
|
|
@@ -55,10 +38,10 @@ class TickerDataFetch:
|
|
|
55
38
|
print(ticker,"data found for",self.todays_date)
|
|
56
39
|
else:
|
|
57
40
|
os.remove(os.path.join(self.output_folder, f"{ticker} {self.namelist[ticker]}.csv"))
|
|
58
|
-
self.fetch_historical_data(ticker
|
|
41
|
+
self.fetch_historical_data(ticker)
|
|
59
42
|
print(ticker,"data found for",self.namelist[ticker],". Updating data for",self.todays_date)
|
|
60
43
|
else:
|
|
61
|
-
self.fetch_historical_data(ticker
|
|
44
|
+
self.fetch_historical_data(ticker)
|
|
62
45
|
print(ticker,"data not found",{ticker},". Updating data for",self.todays_date)
|
|
63
46
|
for ticker in self.namelist:
|
|
64
47
|
if ticker in tickers:
|
|
@@ -73,7 +56,7 @@ class TickerDataFetch:
|
|
|
73
56
|
self.folder_scan()
|
|
74
57
|
for ticker in self.namelist:
|
|
75
58
|
data = pd.read_csv(os.path.join(self.output_folder, f"{ticker} {self.namelist[ticker]}.csv"))
|
|
76
|
-
|
|
59
|
+
ticker_data.set_index('Date',inplace=True)
|
|
77
60
|
ticker_data[ticker] = data
|
|
78
61
|
return ticker_data
|
|
79
62
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/requires.txt
RENAMED
|
File without changes
|
{goekendatascience-0.1.14 → goekendatascience-0.1.17}/src/GoekenDataScience.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|