Class Blocks

java.lang.Object
com.strategyquant.tradinglib.Blocks
All Implemented Interfaces:
com.strategyquant.lib.snippets.ICustomClasses

public class Blocks extends Object implements com.strategyquant.lib.snippets.ICustomClasses
The Class Blocks.
  • Field Details

    • Log

      public static final org.slf4j.Logger Log
      The Constant Log.
  • Method Details

    • init

      public static void init() throws Exception
      Inits the.
      Throws:
      Exception - the exception
    • getBlockObject

      public static IBlock getBlockObject(String snippetName, StrategyBase strategy, org.jdom2.Element elBlock) throws BlockDefinitionException
      Gets the block object.
      Parameters:
      snippetName - the snippet name
      strategy - the strategy
      elBlock - the el block
      Returns:
      the block object
      Throws:
      BlockDefinitionException - the block definition exception
    • get

      public static IBlock get(String snippetName) throws BlockDefinitionException
      Gets the.
      Parameters:
      snippetName - the snippet name
      Returns:
      the i block
      Throws:
      BlockDefinitionException - the block definition exception
    • exists

      public static boolean exists(String snippetName) throws BlockDefinitionException
      Exists.
      Parameters:
      snippetName - the snippet name
      Returns:
      true, if successful
      Throws:
      BlockDefinitionException - the block definition exception
    • generateBlockTreeXml

      public static org.jdom2.Element generateBlockTreeXml(IBlock block) throws BlockDefinitionException
      Generate block tree xml.
      Parameters:
      block - the block
      Returns:
      the element
      Throws:
      BlockDefinitionException - the block definition exception
    • generateBlocksXml

      public static void generateBlocksXml(org.jdom2.Element elRoot) throws BlockDefinitionException
      Generate blocks xml.
      Parameters:
      elRoot - the el root
      Throws:
      BlockDefinitionException - the block definition exception
    • checkContains

      public static boolean checkContains(Class<?> aClass, String className)
      Check contains.
      Parameters:
      aClass - the a class
      className - the class name
      Returns:
      true, if successful
    • getBlockType

      public static int getBlockType(IBlock block) throws Exception
      Gets the block type.
      Parameters:
      block - the block
      Returns:
      the block type
      Throws:
      Exception - the exception
    • getReturnType

      public static int getReturnType(IBlock block) throws Exception
      Gets the return type.
      Parameters:
      block - the block
      Returns:
      the return type
      Throws:
      Exception - the exception
    • getAllAvailableBlocks

      public static IBlock[] getAllAvailableBlocks() throws Exception
      Gets the all available blocks.
      Returns:
      the all available blocks
      Throws:
      Exception - the exception
    • generateExitRulesXml

      public static void generateExitRulesXml(org.jdom2.Element elExitRules) throws BlockDefinitionException
      Generate exit rules xml.
      Parameters:
      elExitRules - the el exit rules
      Throws:
      BlockDefinitionException - the block definition exception
    • reload

      public void reload()
      Reload.
      Specified by:
      reload in interface com.strategyquant.lib.snippets.ICustomClasses
    • generateOppositeBlocksMap

      public static TreeMap<String,​String> generateOppositeBlocksMap()
      Generate opposite blocks map.
      Returns:
      the tree map
    • getOppositeBlock

      public static IBlock getOppositeBlock(IBlock block) throws BlockDefinitionException
      Gets the opposite block.
      Parameters:
      block - the block
      Returns:
      the opposite block
      Throws:
      BlockDefinitionException - the block definition exception
    • getSameBlock

      public static IBlock getSameBlock(IBlock block) throws BlockDefinitionException
      Gets the clone of the same block.
      Parameters:
      block - the block
      Returns:
      the opposite block
      Throws:
      BlockDefinitionException - the block definition exception
    • getOppositeBlockKey

      public static String getOppositeBlockKey(String blockKey)
      Gets the opposite block key.
      Parameters:
      blockKey - the block key
      Returns:
      the opposite block key
    • sortByOrder

      public static void sortByOrder(ExitMethod[] exitMethods)
      Sort by order.
      Parameters:
      exitMethods - the exit methods