Class BlockHandler


  • public class BlockHandler
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      BlockHandler​(com.caplin.generated.motif.fx.trading.rfs.RFSTrade blockTrade, BlockQuoteFactory quoteFactory, PrecisionFactory precisionFactory, org.slf4j.Logger logger)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addExtraFieldsFromTrade​(com.caplin.trading.TradeEvent backingEvent)  
      com.caplin.generated.motif.fx.trading.rfscore.events.server.ClientCloseAckTradeEvent createClientCloseAckEvent​(java.lang.String tradeID)
      Creates a client close ack event
      com.caplin.generated.motif.fx.trading.rfscore.events.server.ExecuteAckTradeEvent createExecuteAckEvent​(java.lang.String tradeID)
      Creates a Execute Ack Event based on the tradeID
      com.caplin.generated.motif.fx.trading.rfscore.events.server.ExpireTradeEvent createExpiredEvent​(java.lang.String tradeID)
      Creates a Expired Event based on the tradeID
      com.caplin.generated.motif.fx.trading.rfscore.events.server.HoldTradeEvent createHeldEvent()
      Creates a held event
      com.caplin.generated.motif.fx.trading.rfscore.events.server.PickUpTradeEvent createPickUpEvent​(java.lang.String tradeID)
      Creates a pick up event
      com.caplin.motif.datasource.Message createQuoteEvent​(java.lang.String tradeID, long timePriceReceived, java.lang.String receivedNanotime, MappedBlockQuote rfsQuote)
      Creates the quote event
      com.caplin.motif.datasource.Message createQuoteEvent​(java.lang.String tradeID, long timePriceReceived, java.lang.String receivedNanotime, MappedBlockQuote rfsQuote, int timeout)
      Creates the quote event
      com.caplin.generated.motif.fx.trading.rfscore.events.server.SubmitAckTradeEvent createSubmitAckEvent​(java.util.Map<java.lang.String,​java.lang.String> fields)
      Creates a Execute Ack Event based on the tradeID
      com.caplin.motif.datasource.Message createTradeConfirmationEvent​(java.lang.String tradeID, com.caplin.ret.trapi.fx.execution.QuoteEvent quote, boolean isSales)
      Creates the trade confirmation Event
      com.caplin.generated.motif.fx.trading.rfscore.events.server.WithdrawTradeEvent createWithdrawEvent​(java.lang.String tradeID)
      Creates a Withdraw Event based on the tradeID
      int getLegCount()
      Returns the number of legs
      java.util.List<Pair<java.lang.String,​com.caplin.ret.trapi.fx.Side>> getLegExecutionSides​(java.util.List<Pair<java.lang.String,​com.caplin.motif.fx.trading.BuySell>> directions)
      Returns the list of Execution Sides based on the BuySell directions
      com.caplin.ret.trapi.common.Profit getProfit​(com.caplin.ret.trapi.fx.FXOrderInstrument netOrderInstrumentInfo, ConfirmationQuote legQuote)  
      com.caplin.motif.datasource.Message getQuote​(com.caplin.ret.trapi.fx.execution.QuoteEvent trapiQuote, boolean isSales, ProfitConversionRate profitConversionRate)
      Returns the quote from the trapiQuote coming from RET
      com.caplin.generated.motif.fx.trading.rfs.RFSTrade getTrade()
      Returns the BlockTrade
      com.caplin.ret.trapi.fx.FXTradeType getTradeType()
      Returns the FXTradeType
      void setSubmitWrapper​(BlockSubmitWrapper submitWrapper)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BlockHandler

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

      • getTradeType

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

        public java.util.List<Pair<java.lang.String,​com.caplin.ret.trapi.fx.Side>> getLegExecutionSides​(java.util.List<Pair<java.lang.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​(java.lang.String tradeID,
                                                                                com.caplin.ret.trapi.fx.execution.QuoteEvent quote,
                                                                                boolean isSales)
                                                                         throws java.lang.Exception
        Creates the trade confirmation Event
        Parameters:
        tradeID - the tradeID
        quote - RET quote
        Returns:
        the confirmation event
        Throws:
        java.lang.Exception
      • createWithdrawEvent

        public com.caplin.generated.motif.fx.trading.rfscore.events.server.WithdrawTradeEvent createWithdrawEvent​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String tradeID,
                                                                    long timePriceReceived,
                                                                    java.lang.String receivedNanotime,
                                                                    MappedBlockQuote rfsQuote,
                                                                    int timeout)
        Creates the quote event
        Returns:
        the quote event
      • createQuoteEvent

        public com.caplin.motif.datasource.Message createQuoteEvent​(java.lang.String tradeID,
                                                                    long timePriceReceived,
                                                                    java.lang.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​(java.util.Map<java.lang.String,​java.lang.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​(java.lang.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​(java.lang.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)