Skip to content

Commit

Permalink
release v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ilcardella committed Dec 14, 2019
1 parent 1b07c70 commit aa6f635
Show file tree
Hide file tree
Showing 51 changed files with 1,626 additions and 1,050 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ ENV/
# mypy
.mypy_cache/

.credentials
data/.credentials
.pytest_cache
_builds
_build
pid.txt

Pipfile.lock
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
language: python

python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.7-dev"

cache: pip

# command to install dependencies
install:
- pip install -r requirements.txt
- export PIPENV_IGNORE_VIRTUALENVS=1
- pipenv install --dev

# command to run tests
script:
- ./trading_mate_ctrl test
- pipenv run pytest
- pipenv run sphinx-build -nWT -b dummy doc doc/_build/html
- python setup.py install
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2019-12-14
### Changed
- Issue37 - Improved installation process and dependencies setup
- Updated default .credentials configured path
- Re-design of system architecture and API
- Edited Portfolios are not saved automatically and a warning is displayed

### Added
- Added Pipfile to manage python dependencies
- Added `FEE` action
- Added `notes` field in trade
- Support load of multiple portfolios
- Save As and Save buttons per portfolio

## [1.0.0] 2019-05-03
### Added
- Initial release
19 changes: 19 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
sphinx-rtd-theme = "*"
requests-mock = "*"
pytest = "*"
docutils = "*"
m2r = "*"
Sphinx = "*"

[packages]
requests = "*"
alpha_vantage = "*"

[requires]
python_version = "3"
130 changes: 86 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,115 @@ TradingMate is a portfolio manager for stocks traders. It lets you record all
your trades with a simple and basic interface, showing the current status of
your assets and the overall profit (or loss!)

# Dependencies
## Dependencies

- Python 3.4+
- Python 3.5+
- Pipenv (optional)
- Tkinter: https://docs.python.org/3/library/tk.html
- AlphaVantage: https://www.alphavantage.co/

View file `requirements.txt` for the full list of python dependencies.
View `Pipfile` or `setup.py` for the full list of python dependencies.

# Install
## Install

After cloning this repo, to install TradingMate simply run:
First install python 3 and pipenv
```
./trading_mate_ctrl install
sudo apt-get update
sudo apt-get install python3 python3-pip
```
(This will require super-user access)

The required dependencies will be installed and all necessary files installed in /opt/TradingMate by default. It is recommended to add this path to your PATH environment variable.
The UI is based on Tkinter so let's install it
```
sudo apt-get update
sudo apt-get install python3-tk
```

# Setup
Clone this repo in your workspace and install `TradingMate` by running the following command in the repository root folder
```
sudo python3 setup.py install
```

## Setup

TradingMate uses AlphaVantage to fetch markets data online:

- Visit AlphaVantage website: `https://www.alphavantage.co`
- Request a free api key
- Insert these info in a file called `.credentials`
This must be in json format
```
{
- Insert these info in a file called `.credentials` in `$HOME/.TradingMate/data`
```
touch $HOME/.TradingMate/data/.credentials
```

This must be in json format and contain:
```
{
"av_api_key": "apiKey"
}
```
- Copy the `.credentials` file in the `$HOME/.TradingMate/data` folder
}
```

- Revoke permissions to read the file by others
```
cd $HOME/.TradingMate/data
sudo chmod 600 .credentials
```

```
cd $HOME/.TradingMate/data
sudo chmod 600 .credentials
```

### Configuration file

The `config.json` file is in the `$HOME/.TradingMate/config` folder and it contains several parameters to personalise how TradingMate works.
These are the descriptions of each parameter:

- **general/trading_log_path**: The absolute path of the trading log where the history
of your trades are saved
- **trading_logs**: The absolute path of the trading logs to automatically load on startup
- **general/credentials_filepath**: File path of the .credentials file
- **alpha_vantage/api_base_uri**: Base URI of AlphaVantage API
- **alpha_vantage/polling_period_sec**: The polling period to query AlphaVantage for stock prices

# Run

TradingMate can be controlled by the `trading_mate_ctrl` shell script.
The script provides commands to perform different actions:
## Start TradingMate

### Start TradingMate
You can start TradingMate in your current terminal
```
trading_mate
```
./trading_mate_ctrl start
or you can start it in detached mode, letting it run in the background
```
nohup trading_mate >/dev/null 2>&1 &
```

## Stop TradingMate

### Stop TradingMate
To stop a TradingMate instance running in the background
```
ps -ef | grep trading_mate | xargs kill -9
```

Closing the main window will stop the whole application.
You can also use the command:
## Uninstall
You can use `pip` to uninstall `TradingMate`:
```
./trading_mate_ctrl stop
sudo pip3 uninstall TradingMate
```

# Test
## Development

The `Pipfile` helps you to setup a development virtual environmnet installing the required dependencies.
Install `pipenv`
```
sudo -H pip3 install -U pipenv
```

Test can't run with the installed script.
You can run the test from a "workspace" environment with:
Create the virtual environment
```
./trading_mate_ctrl test
cd /path/to/repository
pipenv install --dev
```
You can run the test in Docker containers against different python versions:

### Test

You can run the test from the workspace with:
```
./trading_mate_ctrl test_docker
pipenv run pytest
```

# Documentation
### Documentation

The Sphinx documentation contains further details about each TradingMate module
with source code documentation of each component.
Expand All @@ -94,13 +124,25 @@ https://tradingmate.readthedocs.io

You can build it locally from the "workspace" root folder:
```
./trading_mate_ctrl docs
pipenv run sphinx-build -nWT -b html doc doc/_build/html
```

The generated html files will be under `doc/_build/html`.

# Contributing
## Contributing

Any contribution or suggestion is welcome, please follow the suggested workflow.

### Pull Requests

To add a new feature or to resolve a bug, create a feature branch from the
`develop` branch.

Commit your changes and if possible add unit/integration test cases.
Eventually push your branch and create a Pull Request against `develop`.

If you instead find problems or you have ideas and suggestions for future
improvements, please open an Issue. Thanks for the support!

I appreciate any help so if you have suggestions or issues open an Issue for discussion.
If you can contribute please just open a pull request with your changes.
Thanks for all the support!
## Credits
Icons by <a target="_blank" href="https://icons8.com">Icons8</a>
6 changes: 4 additions & 2 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"trading_logs": [
"/opt/TradingMate/data/trading_log.json"
],
"general": {
"trading_log_path": "{home}/.TradingMate/trading_log.json",
"credentials_filepath": "{home}/.TradingMate/config/.credentials"
"credentials_filepath": "/opt/TradingMate/data/.credentials"
},
"alpha_vantage": {
"api_base_uri": "https://www.alphavantage.co/query",
Expand Down
1 change: 1 addition & 0 deletions data/trading_log.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"name": "portfolio1",
"trades": []
}
38 changes: 38 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-i https://pypi.org/simple
alabaster==0.7.12
atomicwrites==1.3.0
attrs==19.3.0
babel==2.7.0
certifi==2019.11.28
chardet==3.0.4
docutils==0.15.2
idna==2.8
imagesize==1.1.0
importlib-metadata==1.3.0
jinja2==2.10.3
m2r==0.2.1
markupsafe==1.1.1
mistune==0.8.4
more-itertools==8.0.2
packaging==19.2
pluggy==0.13.1
py==1.8.0
pygments==2.5.2
pyparsing==2.4.5
pytest==5.3.1
pytz==2019.3
requests-mock==1.7.0
requests==2.22.0
six==1.13.0
snowballstemmer==2.0.0
sphinx-rtd-theme==0.4.3
sphinx==2.2.2
sphinxcontrib-applehelp==1.0.1
sphinxcontrib-devhelp==1.0.1
sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
urllib3==1.25.7
wcwidth==0.1.7
zipp==0.6.0
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/conf.py → doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand Down
5 changes: 2 additions & 3 deletions docs/index.rst → doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TradingMate's documentation
===========================

Introduction
^^^^^^^^^^^^
------------

TradingMate is an autonomous trading system that uses customised strategies to
trade in the London Stock Exchange market.
Expand All @@ -11,11 +11,10 @@ new trading strategies and how to integrate them with TradingMate.
Explore the next sections for a detailed documentation of each module too.

.. toctree::
:maxdepth: 2
:maxdepth: 1
:numbered:

source/system.rst
source/modules.rst
source/changelog.rst

.. mdinclude:: ../README.md
File renamed without changes.
File renamed without changes.

0 comments on commit aa6f635

Please sign in to comment.