Skip to content

Commit

Permalink
Merge pull request #1 from JeremyBrent/jb/github-actions
Browse files Browse the repository at this point in the history
added github action
  • Loading branch information
JeremyBrent authored Sep 26, 2024
2 parents ffaef3b + db02c64 commit ca80311
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Unittests
run-name: Automated Github action for Unittests - ${{ github.actor }}
on:
pull_request
jobs:
unittests:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server in ${{ runner.workspace}}!"

- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'

- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run tests
run: |
python -m unittest discover -s tests
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.13
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,14 @@ Any new models should be replicated based on existing research found

We should also implement a more sophisticated metric for
measuring the performance of the FSA models. Currently, we are only using a raw accuracy.

# The Code Base
Given the timeframe of the project, I put together a small, end-to-end project. Some of these end
to end features include unittests, CICD with Github actions, environment creation with Make and
requirements.txt, and github branch protection rules found
[here](https://github.com/JeremyBrent/stock_market_analyzer/settings/branch_protection_rules/54816872)
which require 1. PRs and 2. passing Github actions in order to update the main branch.

With more time, some things I would build upon would be,
expanding unittest portfolio would need to build out, and further developing the Github actions
if we were deploying this model as a service
5 changes: 3 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime as dt
from src.consts import DATE_FORMAT
from zoneinfo import ZoneInfo


class Utils:
Expand All @@ -14,8 +15,8 @@ def convert_datetime(timestamp: int) -> tuple[str, str]:
:param timestamp:
:return:
"""
# Convert to datetime object
original_date = dt.datetime.fromtimestamp(timestamp)
# Ensure datetime is in NY Timezone bc that's were the NYSE is located
original_date = dt.datetime.fromtimestamp(timestamp, tz=ZoneInfo("America/New_York"))
dt_object = original_date

# Define 4 PM as the time to compare against
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ def test_convert_datetime(self):

for input, expected_data in test_data.items():
actual_output = self.utils.convert_datetime(input)
self.assertEqual(actual_output, expected_data)
self.assertEqual(actual_output, expected_data)

0 comments on commit ca80311

Please sign in to comment.