diff --git a/.vscode/launch.json b/.vscode/launch.json index 726e3c86..db9f6631 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -15,6 +15,6 @@ "BITBOT_SHOWIMAGE": "true" }, "justMyCode": false - } + }, ] } \ No newline at end of file diff --git a/config/config.ini b/config/config.ini index ed79bd37..e32bab40 100644 --- a/config/config.ini +++ b/config/config.ini @@ -3,7 +3,7 @@ exchange = bitmex instrument = BTC/USD stock_symbol = holdings = 0 -instruments = LTC/BTC,ETH/BTC +instruments = LTC/USD,ETH/BTC [display] rotation = 0 diff --git a/config/expanded.mplstyle b/config/default.expanded.mplstyle similarity index 88% rename from config/expanded.mplstyle rename to config/default.expanded.mplstyle index 9d120973..8081f161 100644 --- a/config/expanded.mplstyle +++ b/config/default.expanded.mplstyle @@ -12,8 +12,8 @@ xtick.direction: in ytick.direction: in ytick.minor.visible: False -xtick.major.pad: -10 -ytick.major.pad: -20 +xtick.major.pad: -20 +ytick.major.pad: -5 figure.subplot.left: 0 figure.subplot.right: 1 diff --git a/config/small.expanded.mplstyle b/config/small.expanded.mplstyle new file mode 100644 index 00000000..cca9bfee --- /dev/null +++ b/config/small.expanded.mplstyle @@ -0,0 +1,2 @@ +ytick.major.pad: -5 +xtick.major.pad: -10 \ No newline at end of file diff --git a/config/small_screen.mplstyle b/config/small.mplstyle similarity index 79% rename from config/small_screen.mplstyle rename to config/small.mplstyle index 21ff458e..059c74ce 100644 --- a/config/small_screen.mplstyle +++ b/config/small.mplstyle @@ -1,7 +1,6 @@ - xtick.labelsize: 6 ytick.labelsize: 6 axes.xmargin: 0.15 axes.ymargin: 0.15 -axes.zmargin: 0.1 +axes.zmargin: 0.1 \ No newline at end of file diff --git a/src/configuration/bitbot_files.py b/src/configuration/bitbot_files.py index 2b588e3b..8a658976 100644 --- a/src/configuration/bitbot_files.py +++ b/src/configuration/bitbot_files.py @@ -24,10 +24,11 @@ def __init__(self, base_path): self.logging_ini = self.existing_file_path('logging.ini') self.base_style = self.existing_file_path('base.mplstyle') - self.expanded_style = self.existing_file_path('expanded.mplstyle') - self.default_style = self.existing_file_path('default.mplstyle') self.volume_style = self.existing_file_path('volume.mplstyle') - self.small_screen_style = self.existing_file_path('small_screen.mplstyle') + self.default_style = self.existing_file_path('default.mplstyle') + self.small_screen_style = self.existing_file_path('small.mplstyle') + self.expanded_style = self.existing_file_path('default.expanded.mplstyle') + self.small_expanded_style = self.existing_file_path('small.expanded.mplstyle') def existing_file_path(self, file_name): file_path = pjoin(self.config_folder, file_name) diff --git a/src/drawing/chart_overlay.py b/src/drawing/chart_overlay.py index d153539f..e980079b 100644 --- a/src/drawing/chart_overlay.py +++ b/src/drawing/chart_overlay.py @@ -62,6 +62,10 @@ def overlay1(self, chartdata): def overlay2(self, chartdata): portfolio_value = self.value_held(chartdata) + # 🎹 draw instrument name + yield RotatedTextBlock(chartdata.instrument, self.medium_font) + # 🕎 candle width + yield DrawText(chartdata.candle_width, self.medium_font, colour='red', align=Align.TopRight) # 🏳️ title block yield TextBlock([ # ➗ draw coloured change percentage @@ -73,10 +77,6 @@ def overlay2(self, chartdata): if portfolio_value else DrawText.random_from_bool(self.ai_comments(), self.price_increasing(chartdata), self.title_font)] ], align=Align.LeastIntrusive) - # 🎹 draw instrument name - yield RotatedTextBlock(chartdata.instrument, self.medium_font) - # 🕎 candle width - yield DrawText(chartdata.candle_width, self.medium_font, colour='red', align=Align.TopRight) def price_increasing(self, chartdata): return chartdata.start_price() < chartdata.last_close() diff --git a/src/drawing/market_chart.py b/src/drawing/market_chart.py index cbfe0d21..b81e4142 100644 --- a/src/drawing/market_chart.py +++ b/src/drawing/market_chart.py @@ -63,13 +63,22 @@ def plot_chart(self, config, layout, ax, candle_data): volume_overlay(ax[1], opens, closes, volumes, colorup='white', colordown='red', width=1) self.fig.subplots_adjust(bottom=0.01) + # 📑 styles overide each other left to right? def get_default_styles(self, config, display, files): + small_display = self.is_small_display(display) + + if small_display: + yield files.small_screen_style + yield files.default_style + if config.expand_chart(): yield files.expanded_style - else: - yield files.default_style - if display.size()[0] < 300: - yield files.small_screen_style + if small_display: + yield files.small_expanded_style + + def is_small_display(self, display): + small_display = display.size()[0] < 300 + return small_display def create_chart_figure(self, config, display, files): # 📏 apply global base style @@ -87,6 +96,10 @@ def create_chart_figure(self, config, display, files): ax1 = fig.add_subplot(gs[0], zorder=1) ax2 = None + # 📏 align price tick labels for expanded chart + if(config.expand_chart()): + ax1.set_yticklabels(ax1.get_yticklabels(), ha='left') + if config.show_volume(): with plt.style.context(files.volume_style): ax2 = fig.add_subplot(gs[1], zorder=0) diff --git a/tests/images/APPLE 1mo defaults.png b/tests/images/APPLE 1mo defaults.png index e65fabee..c3190138 100644 Binary files a/tests/images/APPLE 1mo defaults.png and b/tests/images/APPLE 1mo defaults.png differ diff --git a/tests/images/APPLE 3mo defaults.png b/tests/images/APPLE 3mo defaults.png index 1c6c8843..5396e1d1 100644 Binary files a/tests/images/APPLE 3mo defaults.png and b/tests/images/APPLE 3mo defaults.png differ diff --git a/tests/images/BTC EXPANDED.png b/tests/images/BTC EXPANDED.png index e7b747df..926745bb 100644 Binary files a/tests/images/BTC EXPANDED.png and b/tests/images/BTC EXPANDED.png differ diff --git a/tests/images/BTC HOLDINGS.png b/tests/images/BTC HOLDINGS.png index 2a0ed20c..5b68f223 100644 Binary files a/tests/images/BTC HOLDINGS.png and b/tests/images/BTC HOLDINGS.png differ diff --git a/tests/images/BTC OVERLAY2.png b/tests/images/BTC OVERLAY2.png index f108eb14..6486b3b5 100644 Binary files a/tests/images/BTC OVERLAY2.png and b/tests/images/BTC OVERLAY2.png differ diff --git a/tests/images/BTC VOLUME EXPANDED.png b/tests/images/BTC VOLUME EXPANDED.png index 1381bbfb..342c2dcf 100644 Binary files a/tests/images/BTC VOLUME EXPANDED.png and b/tests/images/BTC VOLUME EXPANDED.png differ diff --git a/tests/images/BTC VOLUME OVERLAY2.png b/tests/images/BTC VOLUME OVERLAY2.png index dfd93ea9..6134442d 100644 Binary files a/tests/images/BTC VOLUME OVERLAY2.png and b/tests/images/BTC VOLUME OVERLAY2.png differ diff --git a/tests/images/BTC VOLUME.png b/tests/images/BTC VOLUME.png index 4638139a..26fb4322 100644 Binary files a/tests/images/BTC VOLUME.png and b/tests/images/BTC VOLUME.png differ diff --git a/tests/images/bitmex BTC 1d defaults.png b/tests/images/bitmex BTC 1d defaults.png index 9fd33da8..584bb7ca 100644 Binary files a/tests/images/bitmex BTC 1d defaults.png and b/tests/images/bitmex BTC 1d defaults.png differ diff --git a/tests/images/bitmex BTC 1h defaults.png b/tests/images/bitmex BTC 1h defaults.png index c913b5ff..29be897d 100644 Binary files a/tests/images/bitmex BTC 1h defaults.png and b/tests/images/bitmex BTC 1h defaults.png differ diff --git a/tests/images/bitmex BTC 5m defaults.png b/tests/images/bitmex BTC 5m defaults.png index 8cba8695..6aa99f4a 100644 Binary files a/tests/images/bitmex BTC 5m defaults.png and b/tests/images/bitmex BTC 5m defaults.png differ diff --git a/tests/images/bitmex ETH 1d defaults.png b/tests/images/bitmex ETH 1d defaults.png index b037ed33..7382d0fc 100644 Binary files a/tests/images/bitmex ETH 1d defaults.png and b/tests/images/bitmex ETH 1d defaults.png differ diff --git a/tests/images/bitmex ETH 1h defaults.png b/tests/images/bitmex ETH 1h defaults.png index 0cfe55a9..77bf61a4 100644 Binary files a/tests/images/bitmex ETH 1h defaults.png and b/tests/images/bitmex ETH 1h defaults.png differ diff --git a/tests/images/bitmex ETH 5m defaults.png b/tests/images/bitmex ETH 5m defaults.png index 920fe816..82a259db 100644 Binary files a/tests/images/bitmex ETH 5m defaults.png and b/tests/images/bitmex ETH 5m defaults.png differ diff --git a/tests/images/cryptocom CRO 1d defaults.png b/tests/images/cryptocom CRO 1d defaults.png index facf42cd..a99d267c 100644 Binary files a/tests/images/cryptocom CRO 1d defaults.png and b/tests/images/cryptocom CRO 1d defaults.png differ diff --git a/tests/images/cryptocom CRO 1h defaults.png b/tests/images/cryptocom CRO 1h defaults.png index 0250ffaa..875f81f2 100644 Binary files a/tests/images/cryptocom CRO 1h defaults.png and b/tests/images/cryptocom CRO 1h defaults.png differ diff --git a/tests/images/cryptocom CRO 5m defaults.png b/tests/images/cryptocom CRO 5m defaults.png index 94962d09..4fbd20e4 100644 Binary files a/tests/images/cryptocom CRO 5m defaults.png and b/tests/images/cryptocom CRO 5m defaults.png differ