java.lang.Object
com.caplin.motif.fx.ret.fxtrading.submission.block.BlockHandler

public class BlockHandler extends Object
  • Constructor Details

    • BlockHandler

      public BlockHandler(com.caplin.generated.motif.fx.trading.rfs.RFSTrade blockTrade, BlockQuoteFactory quoteFactory, PrecisionFactory precisionFactory, org.slf4j.Logger logger)
  • Method Details

    • getTradeType

      public com.caplin.ret.trapi.fx.FXTradeType getTradeType()
      Returns the FXTradeType
      Returns:
      FXTradeType.BLOCK
    • getLegExecutionSides

      public List<Pair<String,com.caplin.ret.trapi.fx.Side>> getLegExecutionSides(List<Pair<String,com.caplin.motif.fx.trading.BuySell>> directions)
      Returns the list of Execution Sides based on the BuySell directions
      Parameters:
      directions - BuySell values
      Returns:
      a list of Sides
    • getLegCount

      public int getLegCount()
      Returns the number of legs
      Returns:
      the number of legs
    • getQuote

      public com.caplin.motif.datasource.Message getQuote(com.caplin.ret.trapi.fx.execution.QuoteEvent trapiQuote, boolean isSales, ProfitConversionRate profitConversionRate) throws QuoteCreationException
      Returns the quote from the trapiQuote coming from RET
      Parameters:
      trapiQuote - the quote coming from RET
      Returns:
      the FXQuote
      Throws:
      QuoteCreationException
    • addExtraFieldsFromTrade

      public void addExtraFieldsFromTrade(com.caplin.trading.TradeEvent backingEvent)
    • getTrade

      public com.caplin.generated.motif.fx.trading.rfs.RFSTrade getTrade()
      Returns the BlockTrade
      Returns:
      the BlockTrade
    • createTradeConfirmationEvent

      public com.caplin.motif.datasource.Message createTradeConfirmationEvent(String tradeID, com.caplin.ret.trapi.fx.execution.QuoteEvent quote, boolean isSales)
      Creates the trade confirmation Event
      Parameters:
      tradeID - the tradeID
      quote - RET quote
      Returns:
      the confirmation event
    • createWithdrawEvent

      public com.caplin.generated.motif.fx.trading.rfscore.events.server.WithdrawTradeEvent createWithdrawEvent(String tradeID)
      Creates a Withdraw Event based on the tradeID
      Parameters:
      tradeID - the tradeID
      Returns:
      the withdraw event
    • createExpiredEvent

      public com.caplin.generated.motif.fx.trading.rfscore.events.server.ExpireTradeEvent createExpiredEvent(String tradeID)
      Creates a Expired Event based on the tradeID
      Parameters:
      tradeID - the tradeID
      Returns:
      the expired event
    • createExecuteAckEvent

      public com.caplin.generated.motif.fx.trading.rfscore.events.server.ExecuteAckTradeEvent createExecuteAckEvent(String tradeID)
      Creates a Execute Ack Event based on the tradeID
      Parameters:
      tradeID - the tradeID
      Returns:
      the execute ack event
    • createQuoteEvent

      public com.caplin.motif.datasource.Message createQuoteEvent(String tradeID, long timePriceReceived, String receivedNanotime, MappedBlockQuote rfsQuote, int timeout)
      Creates the quote event
      Returns:
      the quote event
    • createQuoteEvent

      public com.caplin.motif.datasource.Message createQuoteEvent(String tradeID, long timePriceReceived, String receivedNanotime, MappedBlockQuote rfsQuote)
      Creates the quote event
      Returns:
      the quote event
    • createSubmitAckEvent

      public com.caplin.generated.motif.fx.trading.rfscore.events.server.SubmitAckTradeEvent createSubmitAckEvent(Map<String,String> fields)
      Creates a Execute Ack Event based on the tradeID
      Parameters:
      fields - the fields containing the data
      Returns:
      the submit ack event
    • createClientCloseAckEvent

      public com.caplin.generated.motif.fx.trading.rfscore.events.server.ClientCloseAckTradeEvent createClientCloseAckEvent(String tradeID)
      Creates a client close ack event
      Returns:
      the client close ack event
    • createPickUpEvent

      public com.caplin.generated.motif.fx.trading.rfscore.events.server.PickUpTradeEvent createPickUpEvent(String tradeID)
      Creates a pick up event
      Returns:
      the pick up event
    • createHeldEvent

      public com.caplin.generated.motif.fx.trading.rfscore.events.server.HoldTradeEvent createHeldEvent()
      Creates a held event
      Returns:
      the held event
    • getProfit

      public com.caplin.ret.trapi.common.Profit getProfit(com.caplin.ret.trapi.fx.FXOrderInstrument netOrderInstrumentInfo, ConfirmationQuote legQuote)
    • setSubmitWrapper

      public void setSubmitWrapper(BlockSubmitWrapper submitWrapper)