diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 581912f6..b5f5ea42 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,21 +2,19 @@ ## Contribute to the value investing bot -Feel like our bot is missing a feature? We welcome your pull requests! +Feel like the framework is missing a feature or can be fixed? We welcome your pull requests! Few pointers for contributions: -- Create your PR against the `develop` branch, not `master`. +- Create your branch against the `develop` branch, not `master`. - New features need to contain unit tests and must be PEP8 conformant (max-line-length = 100). - Creating a feature, must be done on a branch with prefix `feature_`. - Making a hotfix, must be done on a branch with prefix `hotfix_`. -If you are unsure, discuss the feature on our [Slack](https://join.slack.com/t/investingbots/shared_invite/enQtODgwNTg3MzA2MjYyLTdiZjczZDRlNWJjNDdmYThiMGE0MzFhOTg4Y2E0NzQ2OTgxYjA1NzU3ZWJiY2JhOTE1ZGJlZGFiNDU3OTAzMDg) +If you are unsure, discuss the feature or hotfix on our [Slack](https://inv-algo-framework.slack.com) or in a [issue](https://github.com/investingbots/value-investing-bot/issues) before a PR. -## Getting started - -## Before sending the PR: +## Rules ### 1. Run unit tests @@ -46,55 +44,22 @@ pytest tests/test_.py::test_ #### Run Flake8 ```bash -flake8 bot +flake8 investing_algorithm_framework ``` -We receive a lot of code that fails the `flake8` checks. -To help with that, we encourage you to install the git pre-commit -hook that will warn you when you try to commit code that fails these checks. -Guide for installing them is [here](http://flake8.pycqa.org/en/latest/user/using-hooks.html). - ### 3. Test if all type-hints are correct #### Run mypy ``` bash -mypy bot +mypy investing_algorithm_framework ``` -## (Core)-Committer Guide - -### Process: Pull Requests - -How to prioritize pull requests, from most to least important: - -1. Fixes for broken tests. Broken means broken on any supported platform or Python version. -1. Extra tests to cover corner cases. -1. Minor edits to docs. -1. Bug fixes. -1. Major edits to docs. -1. Features. - -Ensure that each pull request meets all requirements in the Contributing document. - -### Process: Issues - -If an issue is a bug that needs an urgent fix, mark it for the next patch release. -Then either fix it or mark as please-help. - -For other issues: encourage friendly discussion, moderate debate, offer your thoughts. - ### Process: Your own code changes All code changes, regardless of who does them, need to be reviewed and merged by someone else. This rule applies to all the core committers. -Exceptions: - -- Minor corrections and fixes to pull requests submitted by others. -- While making a formal release, the release manager can make necessary, appropriate changes. -- Small documentation changes that reinforce existing subject matter. Most commonly being, but not limited to spelling and grammar corrections. - ### Responsibilities - Ensure cross-platform compatibility for every change that's accepted. Windows, Mac & Linux. @@ -107,11 +72,14 @@ Exceptions: Contributors may be given commit privileges. Preference will be given to those with: -1. Past contributions to value investing btot and other related open-source projects. Contributions to value investing bot include both code (both accepted and pending) and friendly participation in the issue tracker and Pull request reviews. Quantity and quality are considered. +1. Past contributions to value investing algorithm framework and other related open-source projects. +Contributions to value for the framework include both code (both accepted and pending) and friendly participation in the issue tracker and Pull request reviews. Quantity and quality are considered. 1. A coding style that the other core committers find simple, minimal, and clean. 1. Access to resources for cross-platform development and testing. 1. Time to devote to the project regularly. -Being a Committer does not grant write permission on `develop` or `master` for security reasons (Users trust the value investing bot with their Exchange API keys). +Being a Committer does not grant write permission on `develop` or `master` for security reasons (Users trust the investing algorithm framework with their financial secrets). + +### Help -After being Committer for some time, a Committer may be named Core Committer and given full repository access. +If you want help, or not sure on how to become a committer for the project, feel free to sent an email to: investing.algorithm.framework@gmail.com \ No newline at end of file diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 4344e649..00000000 --- a/INSTALL +++ /dev/null @@ -1,6 +0,0 @@ -Thanks for downloading the investing bot framework. - -To install it, make sure you have Python 3.6 or greater installed. Then run -this command from the command prompt: - - python -m pip install . \ No newline at end of file diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 00000000..2e60e82f --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,39 @@ +# Installation + + +### Install Python +Being a Python framework, it requires Python. Python includes a lightweight database called +SQLite that the framework can use so you won’t need to set up a database just yet. + +As of now, the framework only works with python 3.x. + +### Python pip install (recommended) + +You can easily use pip to install the framework in your python environment. + +```sh +$ pip install investing-algorithm-framework +``` + +### Installation from source + +First clone the repository +```sh +$ git clone https://github.com/investing-algorithms/investing-algorithm-framework.git +``` + +Then install the framework by running: +```sh +$ pip install +``` + +### Verifying the installation + +To verify that you correctly installed the framework, type python from your shell. Then at the Python prompt, +try to import investing-algorithm-framework: + +```python +import investing-algorithm-framework +print(investing-algorithm-framework.get_version()) +``` + \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index c6615221..653e5e47 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -graft investing_bot_framework +graft investing_algorithm_framework include AUTHORS include INSTALL include LICENSE diff --git a/README.md b/README.md index 88d45387..f2aa3e76 100644 --- a/README.md +++ b/README.md @@ -2,97 +2,48 @@ # Investing Algorithm Framework -The Investing Algorithm Framework is a free and open source Python framework that encourages rapid development and clean, -pragmatic design. +The Investing Algorithm Framework is a python framework to build investment algorithms. It encourages rapid development and clean, +pragmatic design. It is free for personal usage and open source. -The goal is to give you a configurable investing algorithm where you can decide how you implement your data providers, -strategies, and order executors. +In most cases, you'll probably never have to change code on this repo directly if you are building your algorithm/bot. But if you do, check out CONTRIBUTING.md -#####Disclaimer -If you use this framework for your investments, do not risk money which you are afraid to lose. We can't stress this -enough: +If you'd like to chat with investing-algorithm-framework users and developers, [join us on Slack](https://inv-algo-framework.slack.com) -BEFORE YOU START USING MONEY WITH THE FRAMEWORK, MAKE SURE THAT YOU TESTED YOUR COMPONENTS THOROUGHLY. USE THE SOFTWARE AT +#### Disclaimer +If you use this framework for your investments, do not risk money which you are afraid to lose. We can't stress this +enough: + +BEFORE YOU START USING MONEY WITH THE FRAMEWORK, MAKE SURE THAT YOU TESTED YOUR COMPONENTS THOROUGHLY. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR INVESTMENT RESULTS. -Also, make sure that you read the source code of any plugin you use or implementation of an algorithm made with this +Also, make sure that you read the source code of any plugin you use or implementation of an algorithm made with this framework. -Documentation ------- -All documentation is in the "docs" directory and online at "". If you're just getting started, here's how we recommend -you read the docs: - -* First, read install for instructions on installing Investing Algorithm Framework. -* Next, work through the tutorials in order. ("Quickstart", "Template algorithm", "Custom algorithm"). -* For concrete algorithm examples you probably want to read through the topical guides. - - -## Development branches - -The project is currently setup in two main branches: - -- `develop` - This branch has often new features, but might also cause breaking changes. -- `master` - This branch contains the latest stable release. The bot 'should' be stable on this branch, and is generally well tested. -- `feature/*` - These are feature branches, which are being worked on heavily. Please don't use these unless you want to test a specific feature. -- `hotfix/*` - These are hot fix branches, which are being worked on heavily. Please don't use these unless you really need to. - +## Documentation +All documentation can be found online at "". ### Help / Slack For any questions not covered by the documentation or for further -information about the bot, we encourage you to join our slack channel. +information about the framework, we encourage you to join our slack channel. -[Slack](https://join.slack.com/t/investingbots/shared_invite/enQtODgwNTg3MzA2MjYyLTdiZjczZDRlNWJjNDdmYThiMGE0MzFhOTg4Y2E0NzQ2OTgxYjA1NzU3ZWJiY2JhOTE1ZGJlZGFiNDU3OTAzMDg) +[join us on Slack](https://inv-algo-framework.slack.com) ### [Bugs / Issues](https://github.com/investingbots/value-investing-bot/issues?q=is%3Aissue) If you discover a bug in the bot, please -[search our issue tracker](https://github.com/investingbots/value-investing-bot/issues?q=is%3Aissue) +[search our issue tracker](https://github.com/investing-algorithms/investing-algorithm-framework/issues?q=is%3Aissue) first. If it hasn't been reported, please -[create a new issue](https://github.com/investingbots/value-investing-bot/issues/new) and -ensure you follow the template guide so that our team can assist you as -quickly as possible. - -### [Feature Requests](https://github.com/investingbots/value-investing-bot/labels/enhancement) - -Have you a great idea to improve the bot you want to share? Please, -first search if this feature was not [already discussed](https://github.com/investingbots/value-investing-bot/labels/enhancement). -If it hasn't been requested, please -[create a new request](https://github.com/investingbots/value-investing-bot/new) -and ensure you follow the template guide so that it does not get lost -in the bug reports. - -### [Pull Requests](https://github.com/investingbots/value-investing-bot/pulls) +[create a new issue](https://github.com/investing-algorithms/investing-algorithm-framework/issues/new) and +ensure you follow the template guide so that developers can assist you as quickly as possible. -Feel like our bot is missing a feature? We welcome your pull requests! +Feel like the framework is missing a feature? We welcome your pull requests! Please read our -[Contributing document](https://github.com/investingbots/value-investing-bot/blob/develop/CONTRIBUTING.md) +[Contributing document](https://github.com/investing-algorithms/investing-algorithm-framework/blob/master/CONTRIBUTING.md) to understand the requirements before sending your pull-requests. -**Note** before starting any major new feature work, *please open an issue describing what you are planning to do* or talk to us on [Slack](https://join.slack.com/t/investingbots/shared_invite/enQtODgwNTg3MzA2MjYyLTdiZjczZDRlNWJjNDdmYThiMGE0MzFhOTg4Y2E0NzQ2OTgxYjA1NzU3ZWJiY2JhOTE1ZGJlZGFiNDU3OTAzMDg). +**Note** before starting any major new feature work, *please open an issue describing what you are planning to do* or talk to us on [Slack](https://join.slack.com/t/investingbots/shared_invite/enQtODgwNTg3MzA2MjYyLTdiZjczZDRlNWJjNDdmYThiMGE0MzFhOTg4Y2E0NzQ2OTgxYjA1NzU3ZWJiY2JhOTE1ZGJlZGFiNDU3OTAzMDg). This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it. -**Important:** Always create your PR against the `develop` branch, not `master`. - -## Requirements - -### Uptodate clock -The clock must be accurate, syncronized to a NTP server very frequently to avoid problems with communication to the exchanges. - -### Min hardware required - -To run this bot we recommend you a cloud instance with a minimum of: - -- Minimal (advised) system requirements: 2GB RAM, 1GB disk space, 2vCPU - -In the future raspberry pi support will be added. - -### Software requirements - -- [Python 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/) -- [pip](https://pip.pypa.io/en/stable/installing/) -- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) -- [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended) -- [Docker](https://www.docker.com/products/docker) (Recommended) \ No newline at end of file +**Important:** Always create your feature or hotfix against the `develop` branch, not `master`. diff --git a/investing_algorithm_framework/bin/investing-algorithm-framework-admin b/bin/investing-algorithm-framework-admin similarity index 100% rename from investing_algorithm_framework/bin/investing-algorithm-framework-admin rename to bin/investing-algorithm-framework-admin diff --git a/ci/test.sh b/ci/test.sh index 3b72dcf3..de034ad2 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -python3 -m unittest discover -s ../ +pytest ../. diff --git a/investing_algorithm_framework/__init__.py b/investing_algorithm_framework/__init__.py index d22ca761..b3bc7789 100644 --- a/investing_algorithm_framework/__init__.py +++ b/investing_algorithm_framework/__init__.py @@ -1,4 +1,4 @@ from investing_algorithm_framework.utils.version import get_version -VERSION = (1, 0, 0, 'alpha', 0) +VERSION = (0, 1, 0, 'alpha', 0) diff --git a/investing_algorithm_framework/tests/resources/__init__.py b/investing_algorithm_framework/tests/resources/__init__.py deleted file mode 100644 index 629d5502..00000000 --- a/investing_algorithm_framework/tests/resources/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -import os - -import investing_algorithm_framework.tests.resources.standard_settings - - -class BaseTestMixin: - - @staticmethod - def initialize_environment(): - os.environ.setdefault( - 'INVESTING_BOT_FRAMEWORK_SETTINGS_MODULE', 'investing_algorithm_framework.tests.resources.standard_settings' - ) - diff --git a/investing_algorithm_framework/tests/utils/__init__.py b/investing_algorithm_framework/tests/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/setup.py b/setup.py index 62996604..48653856 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,6 @@ 'colorama', 'wrapt', 'requests' ], python_requires='>=3.6', - scripts=['investing_algorithm_framework/bin/investing-algorithm-framework-admin'], + scripts=['bin/investing-algorithm-framework-admin'], include_package_data=True, ) diff --git a/investing_algorithm_framework/tests/__init__.py b/tests/__init__.py similarity index 100% rename from investing_algorithm_framework/tests/__init__.py rename to tests/__init__.py diff --git a/investing_algorithm_framework/tests/core/__init__.py b/tests/core/__init__.py similarity index 100% rename from investing_algorithm_framework/tests/core/__init__.py rename to tests/core/__init__.py diff --git a/investing_algorithm_framework/tests/core/data/__init__.py b/tests/core/data_providers/__init__.py similarity index 100% rename from investing_algorithm_framework/tests/core/data/__init__.py rename to tests/core/data_providers/__init__.py diff --git a/investing_algorithm_framework/tests/core/data/data_providers/data_provider.py b/tests/core/data_providers/data_provider.py similarity index 85% rename from investing_algorithm_framework/tests/core/data/data_providers/data_provider.py rename to tests/core/data_providers/data_provider.py index 28295f44..8e7aea76 100644 --- a/investing_algorithm_framework/tests/core/data/data_providers/data_provider.py +++ b/tests/core/data_providers/data_provider.py @@ -1,5 +1,4 @@ -from investing_algorithm_framework.tests.core.data.data_providers.resources import TestDataProviderOne, \ - TestDataProviderTwo, TestObserver +from tests.core.data_providers.resources import TestDataProviderOne, TestDataProviderTwo, TestObserver def test(): diff --git a/investing_algorithm_framework/tests/core/data/data_providers/resources.py b/tests/core/data_providers/resources.py similarity index 100% rename from investing_algorithm_framework/tests/core/data/data_providers/resources.py rename to tests/core/data_providers/resources.py diff --git a/investing_algorithm_framework/tests/core/data/data_providers/__init__.py b/tests/core/executors/__init__.py similarity index 100% rename from investing_algorithm_framework/tests/core/data/data_providers/__init__.py rename to tests/core/executors/__init__.py diff --git a/investing_algorithm_framework/tests/core/executors/resources.py b/tests/core/executors/resources.py similarity index 100% rename from investing_algorithm_framework/tests/core/executors/resources.py rename to tests/core/executors/resources.py diff --git a/investing_algorithm_framework/tests/core/executors/test_executor.py b/tests/core/executors/test_executor.py similarity index 93% rename from investing_algorithm_framework/tests/core/executors/test_executor.py rename to tests/core/executors/test_executor.py index de785ce0..b9e5ba39 100644 --- a/investing_algorithm_framework/tests/core/executors/test_executor.py +++ b/tests/core/executors/test_executor.py @@ -1,8 +1,7 @@ from threading import active_count -from unittest import TestCase from time import sleep -from investing_algorithm_framework.tests.core.executors.resources import TestExecutor, TestWorkerOne, TestWorkerTwo, \ +from tests.core.executors.resources import TestExecutor, TestWorkerOne, TestWorkerTwo, \ TestObserver, TestWorkerThree diff --git a/investing_algorithm_framework/tests/core/executors/test_scheduler.py b/tests/core/executors/test_scheduler.py similarity index 100% rename from investing_algorithm_framework/tests/core/executors/test_scheduler.py rename to tests/core/executors/test_scheduler.py diff --git a/investing_algorithm_framework/tests/core/executors/__init__.py b/tests/core/resolvers/__init__.py similarity index 100% rename from investing_algorithm_framework/tests/core/executors/__init__.py rename to tests/core/resolvers/__init__.py diff --git a/investing_algorithm_framework/tests/core/resolvers/test_database_resolver.py b/tests/core/resolvers/test_database_resolver.py similarity index 95% rename from investing_algorithm_framework/tests/core/resolvers/test_database_resolver.py rename to tests/core/resolvers/test_database_resolver.py index 48c4ce5e..35af0541 100644 --- a/investing_algorithm_framework/tests/core/resolvers/test_database_resolver.py +++ b/tests/core/resolvers/test_database_resolver.py @@ -1,7 +1,8 @@ import os from sqlalchemy import Column, String, Integer -from investing_algorithm_framework.tests.resources import BaseTestMixin, utils +from tests.resources import BaseTestMixin +from tests.resources import utils from investing_algorithm_framework.core.configuration import settings from investing_algorithm_framework.core.extensions import db diff --git a/tests/resources/__init__.py b/tests/resources/__init__.py new file mode 100644 index 00000000..757cdec9 --- /dev/null +++ b/tests/resources/__init__.py @@ -0,0 +1,13 @@ +import os + +import tests.resources.standard_settings + + +class BaseTestMixin: + + @staticmethod + def initialize_environment(): + os.environ.setdefault( + 'INVESTING_BOT_FRAMEWORK_SETTINGS_MODULE', 'tests.resources.standard_settings' + ) + diff --git a/investing_algorithm_framework/tests/resources/standard_settings.py b/tests/resources/standard_settings.py similarity index 100% rename from investing_algorithm_framework/tests/resources/standard_settings.py rename to tests/resources/standard_settings.py diff --git a/investing_algorithm_framework/tests/resources/utils.py b/tests/resources/utils.py similarity index 99% rename from investing_algorithm_framework/tests/resources/utils.py rename to tests/resources/utils.py index 7fb043b7..02c042ce 100644 --- a/investing_algorithm_framework/tests/resources/utils.py +++ b/tests/resources/utils.py @@ -1,6 +1,7 @@ import random import string + def random_string(n, spaces: bool = False): if spaces: diff --git a/investing_algorithm_framework/tests/core/resolvers/__init__.py b/tests/utils/__init__.py similarity index 100% rename from investing_algorithm_framework/tests/core/resolvers/__init__.py rename to tests/utils/__init__.py diff --git a/investing_algorithm_framework/tests/utils/test_version.py b/tests/utils/test_version.py similarity index 100% rename from investing_algorithm_framework/tests/utils/test_version.py rename to tests/utils/test_version.py