Skip to content

Commit a47add5

Browse files
committed
Fix flake8 warnings
1 parent 5341bb9 commit a47add5

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

investing_algorithm_framework/app/app.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,6 @@ def _initialize_algorithm_for_backtest(self, algorithm):
498498
if portfolio_configuration_service.count() == 0:
499499
raise OperationalException("No portfolios configured")
500500

501-
# Initialize all portfolios that are registered
502-
503-
504501
strategy_orchestrator_service = \
505502
self.container.strategy_orchestrator_service()
506503
market_credential_service = self.container.market_credential_service()

investing_algorithm_framework/domain/models/backtesting/backtest_report.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from investing_algorithm_framework.domain.models \
1010
.backtesting.backtest_date_range import BacktestDateRange
1111
from investing_algorithm_framework.domain.models.base_model import BaseModel
12-
from investing_algorithm_framework.domain.models.time_unit import TimeUnit
1312
from investing_algorithm_framework.domain.models.position import Position
1413
from investing_algorithm_framework.domain.models.trade import Trade
1514
from investing_algorithm_framework.domain.models.order import Order

investing_algorithm_framework/domain/models/portfolio/portfolio.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ class Portfolio(BaseModel):
1212
* trading_symbol: str, trading symbol of the portfolio
1313
* unallocated: float, the size of the trading symbol that is not
1414
allocated. For example, if the trading symbol is USDT and the unallocated
15-
is 1000, it means that the portfolio has 1000 USDT that is not allocated to any position.
15+
is 1000, it means that the portfolio has 1000 USDT that is not
16+
allocated to any position.
1617
* net_size: float, net size of the portfolio is the initial balance of the
1718
portfolio plus the all the net gains of the trades. The
1819
* realized: float, the realized gain of the portfolio is the sum of all the
1920
realized gains of the trades.
2021
* total_revenue: float, the total revenue of the portfolio is the sum
2122
of all the orders (price * size)
2223
* total_cost: float, the total cost of the portfolio is the sum of all the
23-
costs of the trades (price * size (for buy orders) or -price * size (for sell orders))
24+
costs of the trades (price * size (for buy orders)
25+
or -price * size (for sell orders))
2426
* total_net_gain: float, the total net gain of the portfolio is the sum of
2527
all the net gains of the trades
2628
* total_trade_volume: float, the total trade volume of the

investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class PortfolioConfiguration(BaseModel):
2020
For backtesting, a portfolio configuration is used to create a
2121
portfolio that will be used to simulate the trading of the algorithm. if
2222
the user does not provide an initial balance, the portfolio will be created
23-
with a balance of according to the initial balanace of the PortfolioConfiguration class.
23+
with a balance of according to the initial balanace of
24+
the PortfolioConfiguration class.
2425
"""
2526

2627
def __init__(

investing_algorithm_framework/services/portfolios/backtest_portfolio_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class BacktestPortfolioService(PortfolioService):
1111
"""
1212
def create_portfolio_from_configuration(
1313
self, portfolio_configuration: PortfolioConfiguration,
14-
initial_amount = None
14+
initial_amount=None
1515
):
1616
"""
1717
Wil create a portfolio from a portfolio configuration for backtesting.

investing_algorithm_framework/services/portfolios/portfolio_configuration_service.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ def add(self, portfolio_configuration):
2222

2323
def get(self, identifier):
2424
portfolio_configuration = next(
25-
(portfolio_configuration for portfolio_configuration in
26-
self.portfolio_configurations if
27-
portfolio_configuration.identifier.upper() \
28-
== identifier.upper()),
25+
(
26+
portfolio_configuration for portfolio_configuration in
27+
self.portfolio_configurations
28+
if portfolio_configuration.identifier.upper() ==
29+
identifier.upper()),
2930
None
3031
)
3132

@@ -48,8 +49,8 @@ def find(self, query_params):
4849
elif identifier is not None:
4950
return next(
5051
(portfolio_configuration for portfolio_configuration in
51-
self.portfolio_configurations if
52-
portfolio_configuration.identifier.upper() \
52+
self.portfolio_configurations if
53+
portfolio_configuration.identifier.upper()
5354
== identifier.upper()),
5455
None
5556
)

0 commit comments

Comments
 (0)