Skip to content

Commit

Permalink
fix: next-buy-grid missing for completed buy grids (chrisleekr#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
rando128 authored Dec 22, 2022
1 parent 8ed5fcc commit 1f6fd0a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions public/js/CoinWrapperBuySignal.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,15 @@ class CoinWrapperBuySignal extends React.Component {

const nextGridAmount = nextGridQty * currentPrice;

const executedBuyGrids = gridTrade.filter(trade => trade.executed).length;
const firstNonExecutedTradeIndex = gridTrade.findIndex(
trade => trade.executed === false
);

const hasManualTrade = currentGridTradeIndex !== executedBuyGrids;
const hasManualTrade = firstNonExecutedTradeIndex < currentGridTradeIndex;

const isSingleSellGrid = symbolConfiguration.sell.currentGridTradeIndex >=0 & sellGridTrade.length == 1;
const isSingleSellGrid =
(symbolConfiguration.sell.currentGridTradeIndex >= 0) &
(sellGridTrade.length === 1);

return (nextGridAmount > 0) & !hasManualTrade & isSingleSellGrid ? (
<React.Fragment key={'coin-wrapper-buy-next-grid-row-' + symbol}>
Expand Down

0 comments on commit 1f6fd0a

Please sign in to comment.