Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/add data folder #56

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pages/strategy_performance/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from utils.database_manager import DatabaseManager
from utils.graphs import CandlesGraph
from utils.st_utils import initialize_st_page

from utils.os_utils import directory_exists, create_directory

initialize_st_page(title="Strategy Performance", icon="🚀")

Expand Down Expand Up @@ -41,6 +41,8 @@ def download_csv(df: pd.DataFrame, filename: str, key: str):
)


if not directory_exists("data"):
create_directory("data")
st.session_state["dbs"] = get_databases()
db_names = [x.db_name for x in st.session_state["dbs"].values() if x.status == 'OK']
if not db_names:
Expand Down
4 changes: 4 additions & 0 deletions utils/os_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def directory_exists(directory: str):
return os.path.exists(directory)


def create_directory(directory_path: str):
return os.mkdir(directory_path)


def save_file(name: str, content: str, path: str):
complete_file_path = os.path.join(path, name)
os.makedirs(path, exist_ok=True)
Expand Down