Giter Club home page Giter Club logo

tradingmate's Introduction

TradingMate

TradingMate CI Documentation Status

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

View pyproject.toml for the full list of python dependencies.

Install

  • Install Python3
sudo apt-get update
sudo apt-get install python3
  • Install Python GTK+ 3 following the instructions provided here

  • Install TradingMate

make install-system

Setup

TradingMate supports different sources to fetch stocks prices. The desired interface can be configured through a configuration parameter as explained below and based on the chosen interface you can follow the related setup instructions.

AlphaVantage

AlphaVantage is great collection of API that provide several feature. It requires a key:

  • Visit AlphaVantage website: https://www.alphavantage.co

  • Request a free api key

  • Insert these info in a file called .credentials in ${HOME}/.TradingMate/config

    touch ${HOME}/.TradingMate/config/.credentials
    

    This must be in json format and contain:

    {
        "av_api_key": "key_from_alphavantage"
    }
    
  • Revoke permissions to read the file by others

    sudo chmod 600 ${HOME}/.TradingMate/config/.credentials
    

YFinance

YFinance uses Yahoo Finance REST API and it does not require authentication

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:

  • trading_logs: The absolute path of the trading logs to automatically load on startup
  • general
    • credentials_filepath: File path of the .credentials file
    • polling_period_sec: Period of time in seconds for stock prices polling
    • stocks_interface
      • active: The active API used to retrieve stock data
      • values: Supported values
  • alpha_vantage
    • api_base_uri: Base URI of AlphaVantage API
    • polling_period_sec: The period of time (in seconds) between each AlphaVantage query
  • yfinance
    • polling_period_sec: The period of time (in seconds) between each query

Start TradingMate

You can start TradingMate with

trading_mate

Uninstall

You can use pip to uninstall TradingMate:

pip3 uninstall TradingMate

Development

Install poetry on your system: https://python-poetry.org/

Create the virtual environment with poetry

cd /path/to/repository
make install

Test

You can run the tests with:

make test

Check

The check make target will run the formatter, the linters and the tests

make check

Documentation

The Sphinx documentation contains further details about each TradingMate module. Read the documentation at:

https://tradingmate.readthedocs.io

You can build it locally from the repo root folder:

make docs

The generated html files will be under docs/_build/html.

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 master branch.

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

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

Python GTK+ 3 reference: here

tradingmate's People

Contributors

andrebask avatar dependabot[bot] avatar ilcardella avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tradingmate's Issues

Investigate use of yfinance

yfinance is a new python module to interface with yahoo finance api. It could be a valid alternative to AlphaVantage. Need investigation about requests rate limits and values accuracy

Refactor and test Model

This task is about refactoring (renaming too) the Model class in appropriate components and functions.
Need to add unit test too

Create control script

Create a script in the root folder to control TradingMate:

  • start
  • stop
  • test
  • test in a docker container

Manage multiple portfolios

Add the functionality to open a new trading_log.json and instead of update the window with the new data, a new tab should open containing information of the newly opened portfolio.
Ideally the main window should be able to contain a tab for each portfolio.

The UI should already be able to support multiple tabs.
The Backend instead will need a small refactor, probably just allow to handle multiple instance of the Portfolio module

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

File: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: setup.py

Add option to close a portfolio

Add a context menu in the notebook tab section with the option to close the selected portfolio. Maybe also option to open a new portfolio, save, save as and add trade

Delete last trade bug

There is a bug with the command "Delete last trade". It happened that an error log appeared and the trade was not deleted from the UI, but it was from the json file

JSON config file

Update the config file format to be a JSON file rather than xml

Remove update delay when adding trades

After adding a new trade, if the timing is right (or wrong) there could be a delay of few seconds before the new information are actually added to the UI.
The Add Trade event should trigger an UI update rather than waiting for the timed update

Install command

Create an "install" command in the trading_mate_ctrl script that copies the code and the configuration into a place as "/usr/local/bin" or similar.

Install script falls in a loop

  • The install command falls inside an infinite loop if pip is not found on the system
  • The sudo command should be removed and the user should call the install with explicit sudo

Readme file

The README needs to be updated and refactored with more info

Integrate IG rest API

Integrate an interface to access the IG rest API to fetch data for current price, current holdings, etc.
Add configuration parameter to select the data source (alphavantage or ig or any other)

App title is Tk

The application title in the top bar and in the dock is Tk instead of being the app name

Add FEE action

Add Fee in the action enumeration with a comment field

Integrate TradingBot

Create a new panel to control the autotrading service:

  • start
  • stop
  • output latest log

Add status bar

Add a status bar at the bottom of the portfolio tab. It could show:

  • internet connection
  • confirmation of actions (save, add trade, etc.)
  • trading log filepath

Update UI

Investigate if it worth to change the UI framework from tkinter to something else.
An example could be wxPython

JSON db file

Update the xml file to log account activities to be a JSON file.
Does it worth to use a SQL database?

handle wrong settings

Handle with a message dialog when the settings are edited inserting non existing files or wrong format files etc.

Create settings menu

Create a settings menu entry: list all configurable parameters available in the config.json and let edit them updating the json file too.

Update history table

There are a few improvements to add to the trade history table:

  • Rename Amount into Quantity (this worth also for any other UI element)
  • Symbol entries should be "LSE:xxx" and not "LON:xxx". LON label is specific to AlphaVantage and the component that calls the API should have a mapping to convert LSE into LON
  • Add a last colum as Total: shows the total cost/profit of the trade, maybe coloured green or red if positive or negative

Creates docs

  • setup Sphinx documentation for the project
  • write general info of the project
  • host it on readthedocs.org
  • document source code

Add colours to UI

Values in the portfolio balances and the current positions could be coloured green or red based on the PL value

Install in home directory

The installation directory can be in the home directory (maybe ~/.bin) so the install.py script would not require sudo

Create backend webservice

The UI and the backend logic could be split even more in two different and independent components.
The idea is to have the business logic in a webservice using Flask which provide rest api for all the common actions.
The UI would have to update its interface with the backend calling the rest api

Add log window

Add a button in the settings window to open a new window (children of the main window) which tails the current instance log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.