Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Kelp GUI should display spread % correctly, closes #619 (#622)
Browse files Browse the repository at this point in the history
* 1 - multiply spreadPercent in backend by 100.0

* 2 - cap spread % to 2 decimals

* 3 - move multiplication by 100 to the original calculation to keep things in one place
  • Loading branch information
nikhilsaraf authored Dec 14, 2020
1 parent 002a726 commit 6f11b60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gui/backend/get_bot_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (s *APIServer) runGetBotInfoDirect(w http.ResponseWriter, botName string) {

spread = topAsk - topBid
midPrice := (topAsk + topBid) / 2
spreadPct = spread / midPrice
spreadPct = 100.0 * spread / midPrice
}

bi := botInfo{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BotBidAskInfo extends Component {

let spreadPct = this.props.spread_pct;
if (spreadPct > 0) {
spreadPct = spreadPct.toFixed(4);
spreadPct = spreadPct.toFixed(2);
}

return (
Expand Down

0 comments on commit 6f11b60

Please sign in to comment.