Skip to content

Commit

Permalink
renamed main package to tradingmate (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilcardella committed Jul 29, 2020
1 parent 18b69ba commit 6b5a49d
Show file tree
Hide file tree
Showing 44 changed files with 32 additions and 66 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Trading portfolio and real time stock price monitor"
authors = ["Alberto Cardellini"]
license = "MIT"
packages = [
{ include = "src" }
{ include = "tradingmate" }
]
include = ["config/config.json", "data/trading_log.json"]

Expand Down
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
name="TradingMate",
version="2.2.0",
python_requires=">=3",
package_dir={"": "src"},
packages=find_namespace_packages(where="src"),
scripts=["src/TradingMate.py"],
package_dir={"": "tradingmate"},
packages=find_namespace_packages(where="tradingmate"),
scripts=["tradingmate/TradingMate.py"],
entry_points={"console_scripts": ["trading_mate = TradingMate:main"]},
install_requires=[
"alpha-vantage==2.2.0",
Expand All @@ -18,19 +18,19 @@
package_data={
"config": ["*.json"],
"data": ["*.json"],
"src/UI/assets/gtk": ["*.glade"],
"tradingmate/UI/assets/gtk": ["*.glade"],
},
data_files=[
(os.path.join(os.sep, "opt", "TradingMate", "config"), ["config/config.json"]),
(os.path.join(os.sep, "opt", "TradingMate", "data"), ["data/trading_log.json"]),
(
os.path.join(os.sep, "opt", "TradingMate", "data", "assets", "gtk"),
[
"src/UI/assets/gtk/add_trade_window_layout.glade",
"src/UI/assets/gtk/main_window_layout.glade",
"src/UI/assets/gtk/notebook_page_layout.glade",
"src/UI/assets/gtk/settings_window_layout.glade",
"src/UI/assets/gtk/log_window_layout.glade",
"tradingmate/UI/assets/gtk/add_trade_window_layout.glade",
"tradingmate/UI/assets/gtk/main_window_layout.glade",
"tradingmate/UI/assets/gtk/notebook_page_layout.glade",
"tradingmate/UI/assets/gtk/settings_window_layout.glade",
"tradingmate/UI/assets/gtk/log_window_layout.glade",
],
),
],
Expand Down
Empty file removed src/UI/__init__.py
Empty file.
Empty file removed src/UI/gtk/__init__.py
Empty file.
Empty file removed src/Utils/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion test/test_configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, "{}/src".format(parentdir))
sys.path.insert(0, "{}/tradingmate".format(parentdir))

from Utils.ConfigurationManager import ConfigurationManager

Expand Down
2 changes: 1 addition & 1 deletion test/test_db_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, "{}/src".format(parentdir))
sys.path.insert(0, "{}/tradingmate".format(parentdir))

from Model.DatabaseHandler import DatabaseHandler
from Utils.Trade import Trade
Expand Down
2 changes: 1 addition & 1 deletion test/test_holding.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, "{}/src".format(parentdir))
sys.path.insert(0, "{}/tradingmate".format(parentdir))

from Model.Holding import Holding

Expand Down
2 changes: 1 addition & 1 deletion test/test_portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, "{}/src".format(parentdir))
sys.path.insert(0, "{}/tradingmate".format(parentdir))

from Model.Portfolio import Portfolio
from Utils.ConfigurationManager import ConfigurationManager
Expand Down
2 changes: 1 addition & 1 deletion test/test_trading_mate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, "{}/src".format(parentdir))
sys.path.insert(0, "{}/tradingmate".format(parentdir))

from TradingMate import TradingMate
from Model.Portfolio import Portfolio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import inspect
import logging

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from Utils.Utils import Utils
from Utils.Trade import Trade

Expand Down
4 changes: 0 additions & 4 deletions src/Model/Holding.py → tradingmate/Model/Holding.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import sys
import logging

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)


class Holding:
def __init__(self, symbol, quantity, open_price=None):
Expand Down
3 changes: 0 additions & 3 deletions src/Model/Portfolio.py → tradingmate/Model/Portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import hashlib
import time

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from .Holding import Holding
from Utils.Utils import Actions, Messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import inspect
import logging

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from Utils.TaskThread import TaskThread
from Utils.ConfigurationManager import ConfigurationManager
Expand Down
7 changes: 7 additions & 0 deletions tradingmate/Model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from . import DatabaseHandler, Holding, Portfolio, StockPriceGetter
from .broker import (
AlphaVantageInterface,
StocksInterface,
StocksInterfaceFactory,
YFinanceInterface,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import time
from alpha_vantage.timeseries import TimeSeries

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from Utils.Utils import Markets
from .StocksInterface import StocksInterface

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import functools
import threading

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

# Mutex used for thread synchronisation
lock = threading.Lock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
import sys
import inspect

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)


from .YFinanceInterface import YFinanceInterface
from .AlphaVantageInterface import AlphaVantageInterface

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import time
import yfinance as yf

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from Utils.Utils import Markets
from .StocksInterface import StocksInterface

Expand Down
6 changes: 6 additions & 0 deletions tradingmate/Model/broker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from . import (
AlphaVantageInterface,
StocksInterface,
StocksInterfaceFactory,
YFinanceInterface,
)
4 changes: 0 additions & 4 deletions src/TradingMate.py → tradingmate/TradingMate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import subprocess
import re

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from Model.DatabaseHandler import DatabaseHandler
from Model.Portfolio import Portfolio
from Utils.ConfigurationManager import ConfigurationManager
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
import json
import logging

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from Utils.Utils import Utils


Expand Down
4 changes: 0 additions & 4 deletions src/Utils/TaskThread.py → tradingmate/Utils/TaskThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import inspect
import time

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)


class TaskThread(threading.Thread):
"""Thread that executes a task every N seconds"""
Expand Down
4 changes: 0 additions & 4 deletions src/Utils/Trade.py → tradingmate/Utils/Trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import datetime
import hashlib

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

from Utils.Utils import Actions

TIME_FORMAT = "%H:%M"
Expand Down
8 changes: 3 additions & 5 deletions src/Utils/Utils.py → tradingmate/Utils/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
import json
import logging

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)


class Actions(Enum):
BUY = 1
Expand All @@ -32,7 +28,9 @@ class Messages(Enum):
ERROR_SAVE_SETTINGS = "Unable to save the settings"
WINDOW_UNSUPPORTED_ACTION = "This window does not support the selected action"
ARE_YOU_SURE = "Are you sure?"
UNSUPPORTED_BROKER_FEATURE = "Configured stock interface does not support this feature"
UNSUPPORTED_BROKER_FEATURE = (
"Configured stock interface does not support this feature"
)
SOMETHING_WRONG = "Something went wrong"


Expand Down
1 change: 1 addition & 0 deletions tradingmate/Utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ConfigurationManager, TaskThread, Trade, Utils

0 comments on commit 6b5a49d

Please sign in to comment.