investing-algorithm-framework 2.0.1__tar.gz → 2.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/PKG-INFO +1 -1
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/algorithm.py +17 -3
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/app.py +1 -3
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/services/market_data_sources.py +25 -1
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/order_service/order_service.py +21 -24
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/portfolio_service/portfolio_service.py +0 -1
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework.egg-info/PKG-INFO +2 -2
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/AUTHORS.md +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/LICENSE +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/README.md +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/stateless/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/stateless/action_handlers/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/stateless/action_handlers/check_online_handler.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/stateless/action_handlers/run_strategy_handler.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/stateless/exception_handler.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/strategy.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/task.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/controllers/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/controllers/orders.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/controllers/portfolio.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/controllers/positions.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/create_app.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/error_handler.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/responses.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/run_strategies.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/schemas/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/schemas/order.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/schemas/portfolio.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/schemas/position.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/app/web/setup_cors.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/create_app.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/dependency_container.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/config.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/constants.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/data_structures.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/decimal_parsing.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/exceptions.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/backtest_profile.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/base_model.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/market/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/market/market_credential.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/order/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/order/order.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/order/order_fee.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/order/order_side.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/order/order_status.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/order/order_type.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/portfolio/portfolio.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/portfolio/portfolio_configuration.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/position/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/position/position.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/strategy_profile.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/time_frame.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/time_interval.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/time_unit.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/trade.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/trading_data_types.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/models/trading_time_frame.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/services/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/services/market_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/singleton.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/stateless_actions.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/strategy.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/utils/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/utils/backtesting.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/utils/csv.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/utils/random.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/utils/signatures.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/utils/stoppable_thread.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/domain/utils/synchronized.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/database/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/database/sql_alchemy.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/decimal_parser.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/ccxt.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/market_data_sources/csv.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/model_extension.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/order/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/order/order.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/order/order_fee.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/portfolio/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/portfolio/portfolio_snapshot.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/position/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/position/position.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/models/position/position_snapshot.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/order_fee_repository.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/order_repository.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/portfolio_repository.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/portfolio_snapshot_repository.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/position_repository.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/position_snapshot_repository.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/repositories/repository.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/services/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/services/market_service/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/services/market_service/ccxt_market_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/services/performance_service/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/services/performance_service/backtest_performance_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/infrastructure/services/performance_service/performance_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/backtest_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/configuration_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/market_credential_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/market_data_source_service/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/market_data_source_service/backtest_market_data_source_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/market_data_source_service/market_data_source_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/order_service/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/order_service/order_backtest_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/portfolio_configuration_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/portfolio_service/__init__.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/portfolio_service/backtest_portfolio_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/portfolio_snapshot_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/position_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/position_snapshot_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/repository_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework/services/strategy_orchestrator_service.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework.egg-info/SOURCES.txt +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework.egg-info/dependency_links.txt +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework.egg-info/requires.txt +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/investing_algorithm_framework.egg-info/top_level.txt +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/setup.cfg +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/setup.py +0 -0
- {investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/tests/test_create_app.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: investing_algorithm_framework
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: A framework for creating an investment algorithm
|
|
5
5
|
Home-page: https://github.com/coding-kitties/investing-algorithm-framework.git
|
|
6
6
|
Download-URL: https://github.com/coding-kitties/investing-algorithm-framework/archive/v0.1.1.tar.gz
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import decimal
|
|
2
3
|
from typing import List
|
|
3
4
|
|
|
4
5
|
from investing_algorithm_framework.domain import OrderStatus, OrderFee, \
|
|
@@ -718,9 +719,22 @@ class Algorithm:
|
|
|
718
719
|
if order.get_trade_closed_at() is not None
|
|
719
720
|
]
|
|
720
721
|
|
|
721
|
-
def round_down(self, value,
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
def round_down(self, value, amount_of_decimals):
|
|
723
|
+
|
|
724
|
+
if self.count_decimals(value) <= amount_of_decimals:
|
|
725
|
+
return value
|
|
726
|
+
|
|
727
|
+
with decimal.localcontext() as ctx:
|
|
728
|
+
d = decimal.Decimal(value)
|
|
729
|
+
ctx.rounding = decimal.ROUND_DOWN
|
|
730
|
+
return float(round(d, amount_of_decimals))
|
|
731
|
+
|
|
732
|
+
def count_decimals(self, number):
|
|
733
|
+
decimal_str = str(number)
|
|
734
|
+
if '.' in decimal_str:
|
|
735
|
+
return len(decimal_str.split('.')[1])
|
|
736
|
+
else:
|
|
737
|
+
return 0
|
|
724
738
|
|
|
725
739
|
def get_open_trades(self, target_symbol=None):
|
|
726
740
|
portfolios = self.portfolio_service.get_all()
|
|
@@ -84,13 +84,11 @@ class App:
|
|
|
84
84
|
portfolio_configurations = portfolio_configuration_service.get_all()
|
|
85
85
|
portfolio_service = self.container.portfolio_service()
|
|
86
86
|
|
|
87
|
-
print("caiogjieajigoea")
|
|
88
|
-
print(portfolio_configurations)
|
|
89
87
|
for portfolio_configuration in portfolio_configurations:
|
|
90
88
|
portfolio_service.create_portfolio_from_configuration(
|
|
91
89
|
portfolio_configuration
|
|
92
90
|
)
|
|
93
|
-
|
|
91
|
+
|
|
94
92
|
def _initialize_stateless(self):
|
|
95
93
|
configuration_service = self.container.configuration_service()
|
|
96
94
|
configuration_service.config[SQLALCHEMY_DATABASE_URI] = "sqlite://"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from abc import abstractmethod, ABC
|
|
2
|
+
from typing import Callable
|
|
2
3
|
from datetime import datetime
|
|
3
4
|
|
|
4
5
|
|
|
@@ -30,7 +31,14 @@ class BacktestMarketDataSource(ABC):
|
|
|
30
31
|
pass
|
|
31
32
|
|
|
32
33
|
@abstractmethod
|
|
33
|
-
def get_data(
|
|
34
|
+
def get_data(
|
|
35
|
+
self,
|
|
36
|
+
market_credential_service,
|
|
37
|
+
backtest_index_date,
|
|
38
|
+
from_time_stamp=None,
|
|
39
|
+
to_time_stamp=None,
|
|
40
|
+
**kwargs
|
|
41
|
+
):
|
|
34
42
|
pass
|
|
35
43
|
|
|
36
44
|
@property
|
|
@@ -162,6 +170,22 @@ class OHLCVMarketDataSource(MarketDataSource, ABC):
|
|
|
162
170
|
def end_date_func(self):
|
|
163
171
|
return self._end_date_func
|
|
164
172
|
|
|
173
|
+
@end_date.setter
|
|
174
|
+
def end_date(self, value):
|
|
175
|
+
self._end_date = value
|
|
176
|
+
|
|
177
|
+
@start_date.setter
|
|
178
|
+
def start_date(self, value):
|
|
179
|
+
self._start_date = value
|
|
180
|
+
|
|
181
|
+
@end_date_func.setter
|
|
182
|
+
def end_date_func(self, func: Callable):
|
|
183
|
+
self._end_date_func = func
|
|
184
|
+
|
|
185
|
+
@start_date_func.setter
|
|
186
|
+
def start_date_func(self, func: Callable):
|
|
187
|
+
self._start_date_func = func
|
|
188
|
+
|
|
165
189
|
|
|
166
190
|
class TickerMarketDataSource(MarketDataSource, ABC):
|
|
167
191
|
|
|
@@ -153,7 +153,7 @@ class OrderService(RepositoryService):
|
|
|
153
153
|
if OrderType.LIMIT.equals(order.get_order_type()):
|
|
154
154
|
|
|
155
155
|
if OrderSide.BUY.equals(order.get_order_side()):
|
|
156
|
-
self.market_service.create_limit_buy_order(
|
|
156
|
+
external_order = self.market_service.create_limit_buy_order(
|
|
157
157
|
target_symbol=order.get_target_symbol(),
|
|
158
158
|
trading_symbol=order.get_trading_symbol(),
|
|
159
159
|
amount=order.get_amount(),
|
|
@@ -161,33 +161,30 @@ class OrderService(RepositoryService):
|
|
|
161
161
|
market=portfolio.get_market()
|
|
162
162
|
)
|
|
163
163
|
else:
|
|
164
|
-
self.market_service
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
external_order = self.market_service\
|
|
165
|
+
.create_limit_sell_order(
|
|
166
|
+
target_symbol=order.get_target_symbol(),
|
|
167
|
+
trading_symbol=order.get_trading_symbol(),
|
|
168
|
+
amount=order.get_amount(),
|
|
169
|
+
price=order.get_price(),
|
|
170
|
+
market=portfolio.get_market()
|
|
171
|
+
)
|
|
171
172
|
else:
|
|
172
173
|
if OrderSide.BUY.equals(order.get_order_side()):
|
|
173
174
|
raise OperationalException("Market buy order not supported")
|
|
174
175
|
else:
|
|
175
|
-
self.market_service
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
"updated_at": datetime.now()
|
|
188
|
-
}
|
|
189
|
-
)
|
|
190
|
-
return order
|
|
176
|
+
external_order = self.market_service\
|
|
177
|
+
.create_market_sell_order(
|
|
178
|
+
target_symbol=order.get_target_symbol(),
|
|
179
|
+
trading_symbol=order.get_trading_symbol(),
|
|
180
|
+
amount=order.get_amount(),
|
|
181
|
+
market=portfolio.get_market()
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
data = external_order.to_dict()
|
|
185
|
+
data["status"] = OrderStatus.OPEN.value
|
|
186
|
+
data["updated_at"] = datetime.now()
|
|
187
|
+
return self.update(order_id, data)
|
|
191
188
|
except Exception as e:
|
|
192
189
|
logger.error("Error executing order: {}".format(e))
|
|
193
190
|
return self.update(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 2.0.
|
|
2
|
+
Name: investing_algorithm_framework
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: A framework for creating an investment algorithm
|
|
5
5
|
Home-page: https://github.com/coding-kitties/investing-algorithm-framework.git
|
|
6
6
|
Download-URL: https://github.com/coding-kitties/investing-algorithm-framework/archive/v0.1.1.tar.gz
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{investing_algorithm_framework-2.0.1 → investing_algorithm_framework-2.0.3}/tests/test_create_app.py
RENAMED
|
File without changes
|