GoekenDataScience 0.1.2__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.
- goekendatascience-0.1.2.dist-info/METADATA +22 -0
- goekendatascience-0.1.2.dist-info/RECORD +7 -0
- goekendatascience-0.1.2.dist-info/WHEEL +5 -0
- goekendatascience-0.1.2.dist-info/licenses/LICENSE.txt +21 -0
- goekendatascience-0.1.2.dist-info/top_level.txt +1 -0
- goekenstats/__init__.py +3 -0
- goekenstats/goekenstats.py +69 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: GoekenDataScience
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Python package for Goeken Data Science analytics
|
|
5
|
+
Author-email: Ryan Goeken <your@email.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yourusername/GoekenStats
|
|
8
|
+
Requires-Python: >=3.7
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Requires-Dist: pandas>=2.0
|
|
12
|
+
Requires-Dist: numpy>=1.26
|
|
13
|
+
Requires-Dist: requests>=2.32
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# TickerDataFetcher
|
|
17
|
+
|
|
18
|
+
A simple Python package for fetching and updating historical stock data from Alpha Vantage.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
```bash
|
|
22
|
+
pip install GoekenStats
|
|
@@ -0,0 +1,7 @@
|
|
|
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,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ryan Goeken
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
goekenstats
|
goekenstats/__init__.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pandas as pd
|
|
3
|
+
import requests
|
|
4
|
+
import datetime
|
|
5
|
+
from datetime import date
|
|
6
|
+
|
|
7
|
+
class TickerDataFetch:
|
|
8
|
+
|
|
9
|
+
def __init__(self):
|
|
10
|
+
self.AV_key = 'K8LPY5GIQZ2REC46'
|
|
11
|
+
self.todays_date = str(date.today())
|
|
12
|
+
self.script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
13
|
+
self.output_folder = os.path.join(self.script_dir, "Historical Data")
|
|
14
|
+
|
|
15
|
+
def folder_scan(self):
|
|
16
|
+
self.List = os.listdir(self.output_folder)
|
|
17
|
+
self.namelist = {}
|
|
18
|
+
for item in self.List:
|
|
19
|
+
ticker_name = item.split('.')[0].split()[0]
|
|
20
|
+
ticker_date = item.split('.')[0].split()[1]
|
|
21
|
+
self.namelist[ticker_name] = ticker_date
|
|
22
|
+
|
|
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']
|
|
29
|
+
os.makedirs(self.output_folder, exist_ok=True)
|
|
30
|
+
csv_path = os.path.join(self.output_folder, f"{ticker} {self.todays_date}.csv")
|
|
31
|
+
historical_data.to_csv(csv_path, index=True)
|
|
32
|
+
print(f"Saved CSV to: {csv_path}")
|
|
33
|
+
|
|
34
|
+
def update_tickers (self,tickers):
|
|
35
|
+
self.folder_scan()
|
|
36
|
+
for ticker in tickers:
|
|
37
|
+
if ticker in self.namelist:
|
|
38
|
+
if self.namelist[ticker] == self.todays_date:
|
|
39
|
+
print(ticker,"data found for",self.todays_date)
|
|
40
|
+
else:
|
|
41
|
+
os.remove(os.path.join(self.output_folder, f"{ticker} {self.namelist[ticker]}.csv"))
|
|
42
|
+
self.fetch_historical_data(ticker)
|
|
43
|
+
print(ticker,"data found for",self.namelist[ticker],". Updating data for",self.todays_date)
|
|
44
|
+
else:
|
|
45
|
+
self.fetch_historical_data(ticker)
|
|
46
|
+
print(ticker,"data not found",{ticker},". Updating data for",self.todays_date)
|
|
47
|
+
for ticker in self.namelist:
|
|
48
|
+
if ticker in tickers:
|
|
49
|
+
pass
|
|
50
|
+
else:
|
|
51
|
+
os.remove(os.path.join(self.output_folder, f"{ticker} {self.namelist[ticker]}.csv"))
|
|
52
|
+
print("Removed",ticker,".")
|
|
53
|
+
self.folder_scan()
|
|
54
|
+
|
|
55
|
+
def import_tickers(self):
|
|
56
|
+
ticker_data = {}
|
|
57
|
+
self.folder_scan()
|
|
58
|
+
for ticker in self.namelist:
|
|
59
|
+
data = pd.read_csv(os.path.join(self.output_folder, f"{ticker} {self.namelist[ticker]}.csv"))
|
|
60
|
+
print(data.columns[0])
|
|
61
|
+
ticker_data[ticker] = data
|
|
62
|
+
return ticker_data
|
|
63
|
+
|
|
64
|
+
class DataManipulation:
|
|
65
|
+
def __init__(self):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
def shift_cells(self):
|
|
69
|
+
pass
|