Compare commits

...

2 commits

8 changed files with 90 additions and 88 deletions

View file

@ -1,34 +1,9 @@
@import "./theme.scss"; @import "./theme.scss";
@import "./bar.scss"; @import "./bar/style.scss";
@import "./timer.scss"; @import "./timer/style.scss";
@import "./freqtrade/style.scss";
* { * {
all: unset; all: unset;
font-family: "FiraCode Nerd Font"; font-family: "FiraCode Nerd Font";
} }
.trades-box {
margin: 12px;
padding: 8px;
background-color: #121212;
border-radius: 8px;
}
.profit {
background-color: #121212;
border: solid 4px;
border-color: #12bb7b;
border-radius: 5px;
padding: 3px;
margin-left: 8px;
&.loss {
border-color: red;
}
.arrow {
margin-left: 6px;
font-size: 18px;
}
}

View file

@ -1,62 +1,5 @@
(include "./bar.yuck") (include "./bar/widget.yuck")
(include "./timer.yuck") (include "./timer/widget.yuck")
(include "./freqtrade/widget.yuck")
(defpoll bots
:initial `[]`
:interval "3s"
`curl http://localhost:42667/list`
)
(defpoll absolute_profit
:interval "1s"
:initial 0
`echo $((RANDOM % 11))`
)
(defwidget profit-box [percent price]
(box :class {price >= 0 ? "profit" : "profit loss"} :space-evenly false
(label :text {price >= 0 ? "▲" : "▼"} :class "arrow" :halign "start")
(label :text "${round(percent, 2)}% (${round(price, 2)})" :class "price" :justify "center" :hexpand true)
)
)
(defwidget trades-box []
(box :orientation "v" :class "trades-box"
(box :orientation "h" :style "margin: 2px; font-weight: bold"
(label :text "Freqtrade" :style "font-family: Arial; font-size: 24px")
(label :text "Open profit")
(label :text "Closed profit")
)
(for bot in bots
(box :orientation "h" :style "margin: 2px"
(label :text "${bot.name}" :halign "start" :style "font-weight: bold; margin-right: 8px")
(profit-box :percent {bot.open_profit_pct} :price {bot.open_profit})
(profit-box :percent {bot.closed_profit_pct} :price {bot.closed_profit})
)
)
)
)
(defwidget profits-graph []
(box :class "trades-box"
(graph
:value {arraylength(bots) > 1 ? -bots[2].open_profit_pct * 2.0 : 0}
:time-range "40m"
:thickness 2
:line-style "round"
:dynamic true
)
)
)
(defwindow freqtrade
:monitor 0
:stacking "bg"
:geometry (geometry :x "0%"
:anchor "top right"
)
(box :orientation "v"
(trades-box)
(profits-graph)
)
)

View file

@ -0,0 +1,25 @@
.trades-box {
margin: 12px;
padding: 8px;
background-color: #121212;
border-radius: 8px;
}
.profit {
background-color: #121212;
border: solid 4px;
border-color: #12bb7b;
border-radius: 5px;
padding: 3px;
margin-left: 8px;
&.loss {
border-color: red;
}
.arrow {
margin-left: 6px;
font-size: 18px;
}
}

View file

@ -0,0 +1,59 @@
(defpoll bots
:initial `[]`
:interval "3s"
`curl http://localhost:42667/list`
)
(defpoll absolute_profit
:interval "1s"
:initial 0
`echo $((RANDOM % 11))`
)
(defwidget profit-box [percent price]
(box :class {price >= 0 ? "profit" : "profit loss"} :space-evenly false
(label :text {price >= 0 ? "▲" : "▼"} :class "arrow" :halign "start")
(label :text "${round(percent, 2)}% (${round(price, 2)})" :class "price" :justify "center" :hexpand true)
)
)
(defwidget trades-box []
(box :orientation "v" :class "trades-box"
(box :orientation "h" :style "margin: 2px; font-weight: bold"
(label :text "Freqtrade" :style "font-family: Arial; font-size: 24px")
(label :text "Open profit")
(label :text "Closed profit")
)
(for bot in bots
(box :orientation "h" :style "margin: 2px"
(label :text "${bot.name}" :halign "start" :style "font-weight: bold; margin-right: 8px")
(profit-box :percent {bot.open_profit_pct} :price {bot.open_profit})
(profit-box :percent {bot.closed_profit_pct} :price {bot.closed_profit})
)
)
)
)
(defwidget profits-graph []
(box :class "trades-box"
(graph
:value {arraylength(bots) > 1 ? -bots[2].open_profit_pct * 2.0 : 0}
:time-range "40m"
:thickness 2
:line-style "round"
:dynamic true
)
)
)
(defwindow freqtrade
:monitor 0
:stacking "bg"
:geometry (geometry :x "0%"
:anchor "top right"
)
(box :orientation "v"
(trades-box)
(profits-graph)
)
)