Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tfukaza committed Jun 2, 2024
1 parent 1fd0a39 commit 0a4004e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 33 deletions.
7 changes: 3 additions & 4 deletions harvest/broker/dummy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime as dt
import itertools
import time
from typing import Callable, Dict, Union

Expand Down Expand Up @@ -153,10 +154,8 @@ def fetch_chain_data(self, symbol: str, date: Union[str, dt.datetime]) -> pd.Dat

# Create a permutation of all the data
data = []
for t in types:
for s in strikes:
for e in expirations:
data.append([symbol, e, t, s])
for typ, strike, expiration in itertools.product(types, strikes, expirations):
data.append([symbol, expiration, typ, strike])

# Create a DataFrame from the data
# Columns are exp_date, strike, and type, with the index being the OCC symbol
Expand Down
20 changes: 6 additions & 14 deletions harvest/plugin/_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from typing import List


Expand All @@ -10,32 +11,23 @@ class Plugin:
{Name of source}{Functionality added}Plugin
"""

def __init__(self, name: str, dependencies: List[str] = None) -> None:
def __init__(self, name: str, dependencies: List[str]):
"""
:name: a string that will serve as the name of the plugin. Must
be a valid python variable because in the algo class, this plugin
will be an attribute of the algo and accessable via algo.name.
will be an attribute of the algo and accessible via algo.name.
:dependencies: a list of python packages as strings that will be
checked to ensure they are installed.
Put all imports here in order to test if we have them. If not then
error and call the installation function.
"""
self.name = name

for dep in dependencies:
self._check_dependency(dep)
if dep not in sys.modules:
raise ImportError(f"Missing dependency: {dep}. Run the installation steps.")

def installation(self) -> str:
"""
Returns how to install the necessary prerequsites for this plugin.
Returns how to install the necessary prerequisites for this plugin.
"""
raise NotImplementedError(f"No installation steps for plugin: {type(self).__name__}")

def _check_dependency(self, dep: str) -> None:
# try:
# exec(f"import {dep}")
# except ModuleNotFoundError as e:
# debugger.error(f"Error importing module!\n {e}")
# debugger.error(self.installation())
# raise e
pass
3 changes: 0 additions & 3 deletions harvest/plugin/dolt_options_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ def __init__(self, name: str = "dolt_options", path: str = "options") -> None:
self.read = read

def installation(self) -> str:
"""
Returns how to install the necessary prerequsites for this plugin.
"""
return """
Useful Links:
https://www.dolthub.com/
Expand Down
26 changes: 14 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ classifiers =
packages = find:
python_requires = >=3.9
install_requires =
pandas == 2.2.2
finta == 1.3
pyyaml == 5.3
tqdm == 4.66.4
tzlocal == 5.2
tzdata == 2024.1
yfinance >= 0.2.38
SQLAlchemy == 2.0.0
flask-login == 0.6.3
flask-cors == 3.0.10
flask == 3.0.3
rich == 13.7.1
pandas >= 2.0.0
finta >= 1.0
pyyaml >= 5.0
tqdm >= 4.0.0
tzlocal >= 5.0
tzdata >= 2020.1
rich >= 13.0.0
SQLAlchemy >= 2.0.0

[options.extras_require]
Alpaca =
Expand All @@ -39,6 +35,12 @@ install_requires =
webull
Kraken =
krakenex
Yahoo =
yfinance >= 0.2.38
Web =
flask
flask-login
flask-cors
Dev =
coverage

Expand Down

0 comments on commit 0a4004e

Please sign in to comment.