Skip to content

Commit d0b151c

Browse files
author
investingbots
authored
Merge pull request #15 from investingbots/hotfix_remove_unused_files
Hotfix remove unused files
2 parents ebcbccc + 449352f commit d0b151c

Some content is hidden

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

66 files changed

+1195
-750
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
language: python
2+
3+
install:
4+
- pip install -r requirements.txt
5+
6+
script: pytest # run test
7+
8+
after_success:
9+
- codecov # submit coverage

README.md

Lines changed: 19 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,32 @@
1-
# Investing bot
1+
[![Build Status](https://travis-ci.org/investingbots/investing-bot-framework.svg?branch=master)](https://travis-ci.org/investingbots/investing-bot-framework)
22

3-
The investing bot is a free and open source investing bot written in Python. The goal is to give you a configurable bot
4-
where you can decide on how you implement your data providers, strategies, and brokers/exchanges. Also we want to allow
5-
you to let your bot facilitate multiple users.
3+
# Investing Algorithm Framework
64

7-
It is designed to be controlled via Telegram. As of now, we are aiming to make the configuration of the different
8-
components by the use of plugins. Please see the documentation on how to make your own plugin.
5+
The Investing Algorithm Framework is a free and open source Python framework that encourages rapid development and clean,
6+
pragmatic design.
97

10-
### Disclaimer
11-
This software is for educational purposes only. Do not risk money which you are afraid to lose. We can't stress this
12-
enough: BEFORE YOU START USING MONEY WITH THE BOT, MAKE SURE THAT YOU TESTED YOU STRATEGIES AND DATA PROVIDERS.
13-
USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.
8+
The goal is to give you a configurable investing algorithm where you can decide how you implement your data providers,
9+
strategies, and order executors.
1410

15-
Always start by running a investing bot in Dry-run and do not engage money before you understand how it works and what profit/loss you should expect.
11+
#####Disclaimer
12+
If you use this framework for your investments, do not risk money which you are afraid to lose. We can't stress this
13+
enough:
1614

17-
We strongly recommend you to have coding and Python knowledge, or trust the people that created the plugins your using.
18-
Do not hesitate to read the source code and understand the mechanism of this bot or the plugin you're using.
19-
20-
Brokers/Exchange marketplaces supported
21-
------
22-
Will be updated in the future
15+
BEFORE YOU START USING MONEY WITH THE FRAMEWORK, MAKE SURE THAT YOU TESTED YOUR COMPONENTS THOROUGHLY. USE THE SOFTWARE AT
16+
YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR INVESTMENT RESULTS.
2317

18+
Also, make sure that you read the source code of any plugin you use or implementation of an algorithm made with this
19+
framework.
2420

2521
Documentation
2622
------
27-
Will be updated in the future
28-
29-
## Features
30-
31-
- [x] **Based on Python 3.6+**: Support for all operating systems - Windows, macOS and Linux.
32-
- [x] **Persistence**: Persistence is achieved through sqlite.
33-
- [ ] **Dry-run**: Run the bot without playing money.
34-
- [ ] **REST API**: Manage the bot with the use of a REST API.
35-
- [ ] **Backtesting**: Run a simulation of your buy/sell strategy.
36-
- [ ] **Manageable via Telegram**: Manage the bot with Telegram.
37-
- [ ] **Display profit/loss**: Display your profit/loss.
38-
- [ ] **Daily summary of profit/loss**: Provide a daily summary of your profit/loss.
39-
- [ ] **Performance status report**: Provide a performance status of your current trades.
40-
41-
## Quick start
42-
43-
The investing bot provides a Linux/macOS script to install all dependencies and help you to configure the bot.
44-
45-
The script will come as a future update
46-
47-
### Bot commands
48-
49-
50-
```
51-
usage: main.py [-h] [-V] [-c PATH]
52-
53-
Trading bot based on value principles
54-
55-
optional arguments:
56-
-h, --help show this help message and exit
57-
-V, --version show program's version number and exit
58-
-c PATH, --config PATH
59-
Specify configuration file (default: `config.json`).
60-
61-
```
62-
63-
### Telegram RPC commands
64-
65-
Telegram is not mandatory. However, this is a great way to control your bot.
23+
All documentation is in the "docs" directory and online at "". If you're just getting started, here's how we recommend
24+
you read the docs:
6625

26+
* First, read install for instructions on installing Investing Algorithm Framework.
27+
* Next, work through the tutorials in order. ("Quickstart", "Template algorithm", "Custom algorithm").
28+
* For concrete algorithm examples you probably want to read through the topical guides.
29+
6730

6831
## Development branches
6932

@@ -74,7 +37,6 @@ The project is currently setup in two main branches:
7437
- `feature/*` - These are feature branches, which are being worked on heavily. Please don't use these unless you want to test a specific feature.
7538
- `hotfix/*` - These are hot fix branches, which are being worked on heavily. Please don't use these unless you really need to.
7639

77-
## Support
7840

7941
### Help / Slack
8042

ci/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
python3 -m unittest discover -s ../
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from investing_bot_framework.utils.version import get_version
2+
3+
VERSION = (1, 0, 0, 'alpha', 0)
4+

investing_bot_framework/core/configuration/__init__.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import os
2+
import logging.config
23
from typing import Any
34
from importlib import import_module
45
from enum import Enum
56

67
from investing_bot_framework.core.exceptions import ImproperlyConfigured, OperationalException
78
from investing_bot_framework.core.configuration.template import Template
8-
from investing_bot_framework.core.configuration.config_constants import SETTINGS_MODULE_PATH_ENV_NAME, SETTINGS_STRATEGY_REGISTERED_APPS, \
9-
SETTINGS_DATA_PROVIDER_REGISTERED_APPS
9+
from investing_bot_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
1011

1112

1213
class TimeUnit(Enum):
@@ -59,14 +60,17 @@ class BaseSettings:
5960
Base wrapper for settings module. It will load all the default settings for a given settings module
6061
"""
6162

62-
def __init__(self, settings_module: str = None) -> None:
63+
def __init__(self) -> None:
6364
self._configured = False
64-
self._settings_module = settings_module
65+
self._settings_module = None
6566

66-
if self._settings_module is not None:
67-
self.configure()
67+
def configure(self, settings_module: str = None) -> None:
68+
self._settings_module = settings_module
6869

69-
def configure(self) -> None:
70+
if settings_module is None:
71+
self.settings_module = os.environ.get(SETTINGS_MODULE_PATH_ENV_NAME)
72+
else:
73+
self.settings_module = settings_module
7074

7175
if self.settings_module is None:
7276
raise ImproperlyConfigured("There is no settings module defined")
@@ -93,14 +97,15 @@ def configure(self) -> None:
9397

9498
self._configured = True
9599

100+
logging.config.dictConfig(self[SETTINGS_LOGGING_CONFIG])
101+
96102
@property
97103
def settings_module(self) -> str:
98104
return self._settings_module
99105

100106
@settings_module.setter
101107
def settings_module(self, settings_module: str) -> None:
102108
self._settings_module = settings_module
103-
self.configure()
104109

105110
@property
106111
def configured(self) -> bool:
@@ -131,8 +136,4 @@ def get(self, key: str, default: Any = None) -> Any:
131136
return default
132137

133138

134-
def resolve_settings():
135-
return BaseSettings(os.environ.get(SETTINGS_MODULE_PATH_ENV_NAME))
136-
137-
138-
settings = resolve_settings()
139+
settings = BaseSettings()

investing_bot_framework/core/configuration/config_constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
SETTINGS_DATA_PROVIDER_REGISTERED_APPS = 'INSTALLED_DATA_PROVIDER_APPS'
99
SETTINGS_STRATEGY_REGISTERED_APPS = 'INSTALLED_STRATEGY_APPS'
1010
SETTINGS_MAX_WORKERS = 'DEFAULT_MAX_WORKERS'
11+
SETTINGS_BOT_CONTEXT_CONFIGURATION = 'BOT_CONTEXT_CONFIGURATION'
12+
SETTINGS_LOGGING_CONFIG = 'LOGGING'
1113

1214
# Operational constants
1315
DEFAULT_MAX_WORKERS = 2
16+
17+
# Database related constants
18+
BASE_DIR = 'BASE_DIR'
19+
DATABASE_NAME = 'DATABASE_NAME'

investing_bot_framework/core/context/bot_context.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from investing_bot_framework.core.configuration import settings
44
from investing_bot_framework.core.exceptions import OperationalException
55
from investing_bot_framework.core.utils import Singleton
6-
from investing_bot_framework.core.context.states import BotState
6+
from investing_bot_framework.core.states import BotState
77

88

99
class BotContext(metaclass=Singleton):
@@ -18,19 +18,13 @@ class BotContext(metaclass=Singleton):
1818
# Settings reference
1919
settings = settings
2020

21-
def initialize(self, bot_state: Type[BotState]) -> None:
22-
23-
# Stop the current state of the investing_bot_framework
24-
if self._state:
25-
self._state.stop()
26-
21+
def register_initial_state(self, bot_state: Type[BotState]) -> None:
2722
self._state = bot_state(context=self)
2823

2924
def transition_to(self, bot_state: Type[BotState]) -> None:
3025
"""
3126
Function to change the running BotState at runtime.
3227
"""
33-
3428
self._state = bot_state(context=self)
3529

3630
def _check_state(self, raise_exception: bool = False) -> bool:
@@ -42,7 +36,7 @@ def _check_state(self, raise_exception: bool = False) -> bool:
4236

4337
if raise_exception:
4438
raise OperationalException(
45-
"Bot context doesn't have a state, Make sure that you set the state of bot either "
39+
"Bot context doesn't have a state. Make sure that you set the state of bot either "
4640
"by initializing it or making sure that you transition to a new valid state."
4741
)
4842
else:
@@ -66,18 +60,3 @@ def _run_state(self) -> None:
6660
transition_state = self._state.get_transition_state_class()
6761
self.transition_to(transition_state)
6862

69-
def stop(self) -> None:
70-
"""
71-
Stop the current state of the investing_bot_framework
72-
"""
73-
74-
self._check_state(raise_exception=True)
75-
self._state.stop()
76-
77-
def reconfigure(self) -> None:
78-
"""
79-
Reconfigure the current state of the investing_bot_framework
80-
"""
81-
82-
self._check_state(raise_exception=True)
83-
self._state.reconfigure()

investing_bot_framework/core/context/state_validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
class StateValidator(ABC):
55
"""
66
Class StateValidator: validates the given state. Use this class to change the transition process of a state.
7-
Use it as a hook to decide if a state must transition, e.g. only change to a strategy state if all the
8-
provided data meets a certain threshold.
7+
Use it as a hook to decide if a state must transition, e.g. only change to a strategies state if all the
8+
provided data_providers meets a certain threshold.
99
"""
1010

1111
@abstractmethod

investing_bot_framework/core/context/states/__init__.py

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

0 commit comments

Comments
 (0)