validateGridTrade(gridTrade) {
    const { quoteAssets, minNotionals } = this.state;

    const validation = [];

    let isValid = true;

    gridTrade.forEach((grid, index) => {
      const v = {
        messages: [],
        triggerPercentage: true,
        stopPercentage: true,
        limitPercentage: true,
        minPurchaseAmounts: quoteAssets.reduce((acc, quoteAsset) => {
          acc[quoteAsset] = true;
          return acc;
        }, {}),
        maxPurchaseAmounts: quoteAssets.reduce((acc, quoteAsset) => {
          acc[quoteAsset] = true;
          return acc;
        }, {})
      };

      const humanisedIndex = index + 1;

      if (index === 0 && grid.triggerPercentage < 1) {
        // If it is the first grid trade and the trigger percentage is less than 1,
        isValid = false;
        v.triggerPercentage = false;
        v.messages.push(
          `The trigger percentage for Grid #${humanisedIndex} cannot be less than 1.`
        );
      } else if (index !== 0 && grid.triggerPercentage >= 1) {
        // If it is not the first grid trade and the trigger percentage is more than 1,
        isValid = false;
        v.triggerPercentage = false;
        v.messages.push(
          `The trigger percentage for Grid #${humanisedIndex} cannot be equal or above 1.`
        );
      }

      // If the stop price percentage cannot be higher than the stop price percentage.
      if (grid.stopPercentage >= grid.limitPercentage) {
        isValid = false;
        v.limitPercentage = false;
        v.messages.push(
          `The stop price percentage cannot be equal or over the limit percentage.`
        );
      }

      _.forOwn(grid.minPurchaseAmounts, (value, quoteAsset) => {
        // If the max purchase amount is less than the minimum notional value,
        if (parseFloat(value) < parseFloat(minNotionals[quoteAsset])) {
          isValid = false;
          v.minPurchaseAmounts[quoteAsset] = false;
          v.messages.push(
            `The min purchase amount for ${quoteAsset} cannot be less than the minimum notional value ${minNotionals[quoteAsset]}.`
          );
        }
      });

      _.forOwn(grid.maxPurchaseAmounts, (value, quoteAsset) => {
        // If the max purchase amount is less than the minimum notional value,
        if (parseFloat(value) < parseFloat(minNotionals[quoteAsset])) {
          isValid = false;
          v.maxPurchaseAmounts[quoteAsset] = false;
          v.messages.push(
            `The max purchase amount for ${quoteAsset} cannot be less than the minimum notional value ${minNotionals[quoteAsset]}.`
          );
        }

        // If maximum purchase amount is less than minimum purchase amount,
        const minPurchaseAmount = grid.minPurchaseAmounts[quoteAsset];
        if (minPurchaseAmount > parseFloat(value)) {
          isValid = false;
          v.maxPurchaseAmounts[quoteAsset] = false;
          v.messages.push(
            `The max purchase amount for ${quoteAsset} cannot be less than the minimum purchase amount ${minPurchaseAmount}.`
          );
        }
      });

      validation.push(v);
    });

    this.setState({
      validation
    });
    this.props.handleSetValidation('gridBuy', isValid);
  }
Validate grid trade for buying

 - Only 1st trigger percentage can be above or equal to 1.
 - The stop price percentage cannot be higher than the stop price percentage.
 - Buy amount cannot be less than the minimum notional value.