Skip to content

Commit

Permalink
Fix flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MDUYN committed Nov 14, 2024
1 parent 311b3d0 commit e6a7751
Show file tree
Hide file tree
Showing 11 changed files with 301 additions and 587 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,4 @@ bumpversion.egg-info/
**/backtest_data/*
*/backtest_reports/
**/backtest_reports/*
.vscode/
26 changes: 18 additions & 8 deletions investing_algorithm_framework/deployment/azure/azure_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.storage import StorageManagementClient
from azure.mgmt.web import WebSiteManagementClient
from zipfile import ZipFile
import shutil


def deploy_to_azure_functions(azure_credentials_json, azure_function_path):
"""
This function deploys a Python function app to Azure Functions.
Parameters:
- azure_credentials_json (str): Path to the Azure credentials JSON file.
- azure_function_path (str): Path to the Python function app directory.
- azure_credentials_json (str): Path to the Azure credentials
JSON file.
- azure_function_path (str): Path to the Python function
app directory.
Returns:
None
Expand All @@ -28,7 +30,6 @@ def deploy_to_azure_functions(azure_credentials_json, azure_function_path):
LOCATION = "eastus"
STORAGE_ACCOUNT_NAME = "mystorageaccount123"
FUNCTION_APP_NAME = "my-python-function-app"
APP_SERVICE_PLAN_NAME = "myAppServicePlan"

# Authenticate using DefaultAzureCredential
credential = DefaultAzureCredential()
Expand Down Expand Up @@ -56,13 +57,22 @@ def deploy_to_azure_functions(azure_credentials_json, azure_function_path):
# Create Function App (with a Consumption Plan)
site_config = {
"location": LOCATION,
"server_farm_id": f"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP_NAME}/providers/Microsoft.Web/serverfarms/{APP_SERVICE_PLAN_NAME}",
"server_farm_id": f"/subscriptions/{SUBSCRIPTION_ID}" +
"/resourceGroups" +
"/{RESOURCE_GROUP_NAME}/providers/Microsoft.Web/" +
"serverfarms/{APP_SERVICE_PLAN_NAME}",
"reserved": True, # This is necessary for Linux-based function apps
"site_config": {
"app_settings": [
{"name": "FUNCTIONS_WORKER_RUNTIME", "value": "python"},
{"name": "AzureWebJobsStorage",
"value": f"DefaultEndpointsProtocol=https;AccountName={STORAGE_ACCOUNT_NAME};AccountKey=<account_key>"},
{
"name": "FUNCTIONS_WORKER_RUNTIME", "value": "python"
},
{
"name": "AzureWebJobsStorage",
"value": "DefaultEndpointsProtocol=https;" + \
f"AccountName={STORAGE_ACCOUNT_NAME}" + \
";AccountKey=account_key>",
}
]
},
"kind": "functionapp",
Expand Down
5 changes: 0 additions & 5 deletions investing_algorithm_framework/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
load_backtest_report, convert_polars_to_pandas, \
csv_to_list, StoppableThread, pretty_print_backtest_reports_evaluation, \
pretty_print_backtest, load_csv_into_dict, load_backtest_reports
from .graphs import create_prices_graph, create_ema_graph, create_rsi_graph, create_line_graph
from .metrics import get_price_efficiency_ratio

__all__ = [
Expand Down Expand Up @@ -116,11 +115,7 @@
"RoundingService",
"BacktestDateRange",
"load_backtest_report",
"create_prices_graph",
"create_ema_graph",
"create_rsi_graph",
"get_price_efficiency_ratio",
"create_line_graph",
"convert_polars_to_pandas",
"DateRange"
]
Loading

0 comments on commit e6a7751

Please sign in to comment.