Skip to content

Commit 3bddba0

Browse files
author
investing-algorithms
authored
Merge pull request #32 from investing-algorithms/feature_core
Rearrange core package
2 parents 81a057d + 62529cc commit 3bddba0

File tree

64 files changed

+210
-241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+210
-241
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22

3-
from investing_algorithm_framework.core.management import execute_from_command_line
3+
from investing_algorithm_framework.management import execute_from_command_line
44

55
if __name__ == "__main__":
66
execute_from_command_line()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
Invokes investing_algorithm_framework-admin when the investing_algorithm_framework framework module is run as a script.
3-
Example: python -m investing_algorithm_framework createalgorithm SampleAlgorithm
3+
Example: python -m investing_algorithm_framework create_standard_algo SampleAlgorithm
44
"""
55

6-
from investing_algorithm_framework.core.management import execute_from_command_line
6+
from investing_algorithm_framework.management import execute_from_command_line
77

88
if __name__ == "__main__":
99
execute_from_command_line()

investing_algorithm_framework/core/configuration/__init__.py renamed to investing_algorithm_framework/configuration/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
from enum import Enum
66

77
from investing_algorithm_framework.core.exceptions import ImproperlyConfigured, OperationalException
8-
from investing_algorithm_framework.core.configuration.template import Template
9-
from investing_algorithm_framework.core.configuration.config_constants import SETTINGS_MODULE_PATH_ENV_NAME, \
10-
SETTINGS_STRATEGY_REGISTERED_APPS, SETTINGS_DATA_PROVIDER_REGISTERED_APPS, BASE_DIR, SETTINGS_LOGGING_CONFIG
8+
from investing_algorithm_framework.configuration.config_constants import SETTINGS_MODULE_PATH_ENV_NAME, \
9+
SETTINGS_STRATEGY_REGISTERED_APPS, SETTINGS_DATA_PROVIDER_REGISTERED_APPS, SETTINGS_LOGGING_CONFIG
1110

1211

1312
class TimeUnit(Enum):
14-
1513
SECOND = 'SEC',
1614
MINUTE = 'MIN',
1715
HOUR = 'HR',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from investing_algorithm_framework.configuration.setup.default_template_creators import DefaultProjectCreator

investing_algorithm_framework/core/configuration/setup/default_template_creators.py renamed to investing_algorithm_framework/configuration/setup/default_template_creators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
import investing_algorithm_framework
55
from investing_algorithm_framework.core.exceptions import ImproperlyConfigured
6-
from investing_algorithm_framework.core.configuration.setup.template_creator import TemplateCreator
6+
from investing_algorithm_framework.configuration.setup.template_creator import TemplateCreator
77

88

99
class DefaultProjectCreator(TemplateCreator):
10-
TEMPLATE_ROOT_DIR = 'templates/algorithm_project_directory'
10+
TEMPLATE_ROOT_DIR = 'templates/projects/algorithm_project_directory'
1111
PROJECT_NAME_PLACEHOLDER = '{{ project_name }}'
1212
PROJECT_TEMPLATE_DIR_NAME = 'algorithm_project_template'
1313

investing_algorithm_framework/core/configuration/setup/template_creator.py renamed to investing_algorithm_framework/configuration/setup/template_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import stat
33
from abc import ABC, abstractmethod
44

5-
from investing_algorithm_framework.core.configuration import Template
5+
from investing_algorithm_framework.configuration.setup.template import Template
66

77

88
class TemplateCreator(Template, ABC):

investing_algorithm_framework/core/configuration/setup/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

investing_algorithm_framework/core/context/context.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from typing import Type
22

3-
from investing_algorithm_framework.core.configuration import settings
3+
from investing_algorithm_framework.configuration import settings
44
from investing_algorithm_framework.core.exceptions import OperationalException
55
from investing_algorithm_framework.core.utils import Singleton
6-
from investing_algorithm_framework.core.states import BotState
6+
from investing_algorithm_framework.core.state import State
77

88

99
class Context(metaclass=Singleton):
@@ -13,15 +13,15 @@ class Context(metaclass=Singleton):
1313
"""
1414

1515
# A reference to the current state of the context.
16-
_state: BotState = None
16+
_state: State = None
1717

1818
# Settings reference
1919
settings = settings
2020

21-
def register_initial_state(self, bot_state: Type[BotState]) -> None:
22-
self._state = bot_state(context=self)
21+
def register_initial_state(self, state: Type[State]) -> None:
22+
self._state = state(context=self)
2323

24-
def transition_to(self, bot_state: Type[BotState]) -> None:
24+
def transition_to(self, bot_state: Type[State]) -> None:
2525
"""
2626
Function to change the running BotState at runtime.
2727
"""

0 commit comments

Comments
 (0)