Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"BITBOT_SHOWIMAGE": "true"
},
"justMyCode": false
}
},
]
}
2 changes: 1 addition & 1 deletion config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/expanded.mplstyle → config/default.expanded.mplstyle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions config/small.expanded.mplstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ytick.major.pad: -5
xtick.major.pad: -10
3 changes: 1 addition & 2 deletions config/small_screen.mplstyle → config/small.mplstyle
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions src/configuration/bitbot_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/drawing/chart_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
21 changes: 17 additions & 4 deletions src/drawing/market_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Binary file modified tests/images/APPLE 1mo defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/APPLE 3mo defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/BTC EXPANDED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/BTC HOLDINGS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/BTC OVERLAY2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/BTC VOLUME EXPANDED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/BTC VOLUME OVERLAY2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/BTC VOLUME.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/bitmex BTC 1d defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/bitmex BTC 1h defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/bitmex BTC 5m defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/bitmex ETH 1d defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/bitmex ETH 1h defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/bitmex ETH 5m defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/cryptocom CRO 1d defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/cryptocom CRO 1h defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/cryptocom CRO 5m defaults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.