Skip to content

Commit

Permalink
Add flake8 exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
MDUYN committed Apr 12, 2024
1 parent 269949c commit 072c813
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
#----------------------------------------------
- run: python -m pip install black flake8 isort
- run: |
flake8 ./investing_algorithm_framework
flake8 ./investing_algorithm_framework --exclude="investing_algorithm_framework/domain/utils/backtesting.py"
test:
needs: linting
strategy:
Expand Down
3 changes: 2 additions & 1 deletion investing_algorithm_framework/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@ def run_backtests(

print(
f"{COLOR_YELLOW}Running backtests for date "
f"range:{COLOR_RESET} {COLOR_GREEN}{start_date} - {end_date} for a "
f"range:{COLOR_RESET} {COLOR_GREEN}{start_date} - "
f"{end_date} for a "
f"total of {len(algorithms)} algorithms.{COLOR_RESET}"
)
for algorithm in algorithms:
Expand Down
8 changes: 6 additions & 2 deletions investing_algorithm_framework/domain/models/order/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
from investing_algorithm_framework.domain.exceptions import \
OperationalException
from investing_algorithm_framework.domain.models.base_model import BaseModel
from investing_algorithm_framework.domain.models.order import OrderStatus, \
OrderType, OrderSide
from investing_algorithm_framework.domain.models.order.order_status import \
OrderStatus
from investing_algorithm_framework.domain.models.order.order_type import \
OrderType
from investing_algorithm_framework.domain.models.order.order_side import \
OrderSide
from investing_algorithm_framework.domain.models.order.order_fee import \
OrderFee

Expand Down
7 changes: 5 additions & 2 deletions investing_algorithm_framework/domain/utils/backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
COLOR_GREEN = '\033[92m'
COLOR_YELLOW = '\033[93m'


def print_tables_side_by_side(*tables, spacing: int = 3):
string_tables_split = [tabulate(t, headers="firstrow").splitlines() for t in tables]
string_tables_split = [tabulate(t, headers="firstrow")
.splitlines() for t in tables]
spacing_str = " " * spacing

num_lines = max(map(len, string_tables_split))
Expand Down Expand Up @@ -63,7 +65,8 @@ def pretty_print_profit_evaluation(
report.name for report in profits[:number_of_reports]
]
profit_table["Profit"] = [
f"{report.total_net_gain:.{precision}f} {report.trading_symbol}" for report in profits[:number_of_reports]
f"{report.total_net_gain:.{precision}f} {report.trading_symbol}"
for report in profits[:number_of_reports]
]
profit_table["Profit percentage"] = [
f"{report.total_net_gain_percentage:.{precision}f}%" for report in profits[:number_of_reports]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,6 @@ def get_data(self, **kwargs):
)

file_path = self._create_file_path()
timeframe_minutes = TimeFrame.from_string(self.timeframe)\
.amount_of_minutes
backtest_index_date = kwargs["backtest_index_date"]

# Filter the data based on the backtest index date and the end date
Expand Down

0 comments on commit 072c813

Please sign in to comment.