org.marketcetera.ors.history
Interface ReportHistoryServices

All Known Implementing Classes:
AsyncSaveReportHistoryServices, BasicReportHistoryServices

public interface ReportHistoryServices

Provides services to save and query reports.

Since:
1.0.0
Version:
$Id: ReportHistoryServices.java 16154 2012-07-14 16:34:05Z colin $
Author:
anshul@marketcetera.com

Method Summary
 Map<PositionKey<Equity>,BigDecimal> getAllEquityPositionsAsOf(SimpleUser inUser, Date inDate)
          Returns the aggregate position of each (equity,account,actor) tuple based on all reports received for each tuple on or before the supplied date, and which are visible to the given user.
 Map<PositionKey<Future>,BigDecimal> getAllFuturePositionsAsOf(SimpleUser inUser, Date inDate)
          Returns the aggregate position of each future (future,account,actor) tuple based on all reports received for each future instrument on or before the supplied date, and which are visible to the given user.
 Map<PositionKey<Option>,BigDecimal> getAllOptionPositionsAsOf(SimpleUser inUser, Date inDate)
          Returns the aggregate position of each option (option,account,actor) tuple based on all reports received for each option instrument on or before the supplied date, and which are visible to the given user.
 BigDecimal getEquityPositionAsOf(SimpleUser inUser, Date inDate, Equity inEquity)
          Returns the position of the equity based on all reports received for it before or on the supplied date, and which are visible to the given user.
 BigDecimal getFuturePositionAsOf(SimpleUser inUser, Date inDate, Future inFuture)
          Gets the current aggregate position for the future instrument based on execution reports received before or on the supplied date, and which are visible to the given user.
 BigDecimal getOptionPositionAsOf(SimpleUser inUser, Date inDate, Option inOption)
          Gets the current aggregate position for the option instrument based on execution reports received before or on the supplied date, and which are visible to the given user.
 Map<PositionKey<Option>,BigDecimal> getOptionPositionsAsOf(SimpleUser inUser, Date inDate, String... inSymbols)
          Returns the aggregate position of each option (option,account,actor) tuple based on all reports received for each option instrument on or before the supplied date, and which are visible to the given user.
 Principals getPrincipals(OrderID orderID)
          Returns the principals associated with the report with given order ID.
 ReportBaseImpl[] getReportsSince(SimpleUser inUser, Date inDate)
          Returns all the reports received after the supplied date-time value, and which are visible to the given user.
 void init(IDFactory idFactory, JmsManager jmsManager, ReportSavedListener reportSavedListener)
          Initializes the receiver with the given system resources.
 void save(ReportBase report)
          Saves the supplied report to the database.
 

Method Detail

init

void init(IDFactory idFactory,
          JmsManager jmsManager,
          ReportSavedListener reportSavedListener)
          throws ReportPersistenceException
Initializes the receiver with the given system resources.

Parameters:
idFactory - The ID factory to be used for report ID generation.
jmsManager - The JMS manager used for asychronous persistence of reports. Null may be acceptable to certain implementations.
reportSavedListener - The listener notified after a report has been saved (successfully or not). It may be null if no notifications are needed.
Throws:
ReportPersistenceException - Thrown if initialization cannot complete.

getReportsSince

ReportBaseImpl[] getReportsSince(SimpleUser inUser,
                                 Date inDate)
                                 throws PersistenceException,
                                        ReportPersistenceException
Returns all the reports received after the supplied date-time value, and which are visible to the given user.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the date-time value. Cannot be null.
Returns:
the reports that were received after the date-time value, and which are visible to the given user.
Throws:
PersistenceException - if there were persistence errors fetching the reports.
ReportPersistenceException - if the data retrieved had unexpected errors.

getEquityPositionAsOf

BigDecimal getEquityPositionAsOf(SimpleUser inUser,
                                 Date inDate,
                                 Equity inEquity)
                                 throws PersistenceException
Returns the position of the equity based on all reports received for it before or on the supplied date, and which are visible to the given user.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the date to compare with all the reports. Only the reports that were received prior to or on this date will be used in this calculation. Cannot be null.
inEquity - the equity whose position is desired. Cannot be null.
Returns:
the equity position.
Throws:
PersistenceException - if there were errors retrieving the equity position

getAllEquityPositionsAsOf

Map<PositionKey<Equity>,BigDecimal> getAllEquityPositionsAsOf(SimpleUser inUser,
                                                              Date inDate)
                                                              throws PersistenceException
Returns the aggregate position of each (equity,account,actor) tuple based on all reports received for each tuple on or before the supplied date, and which are visible to the given user.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the date to compare with all the reports. Only the reports that were received on or prior to this date will be used in this calculation. Cannot be null.
Returns:
the position map.
Throws:
PersistenceException - if there were errors retrieving the position map.

getOptionPositionAsOf

BigDecimal getOptionPositionAsOf(SimpleUser inUser,
                                 Date inDate,
                                 Option inOption)
                                 throws PersistenceException
Gets the current aggregate position for the option instrument based on execution reports received before or on the supplied date, and which are visible to the given user.

Buy trades result in positive positions. All other kinds of trades result in negative positions.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the time. execution reports with sending time values less than or equal to this time are included in this calculation.
inOption - The option instrument
Returns:
the aggregate position for the symbol.
Throws:
PersistenceException - if there were errors retrieving the position.

getAllOptionPositionsAsOf

Map<PositionKey<Option>,BigDecimal> getAllOptionPositionsAsOf(SimpleUser inUser,
                                                              Date inDate)
                                                              throws PersistenceException
Returns the aggregate position of each option (option,account,actor) tuple based on all reports received for each option instrument on or before the supplied date, and which are visible to the given user.

Buy trades result in positive positions. All other kinds of trades result in negative positions.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the date to compare with all the reports. Only the reports that were received on or prior to this date will be used in this calculation. Cannot be null.
Returns:
the position map.
Throws:
PersistenceException - if there were errors retrieving the position map.

getFuturePositionAsOf

BigDecimal getFuturePositionAsOf(SimpleUser inUser,
                                 Date inDate,
                                 Future inFuture)
                                 throws PersistenceException
Gets the current aggregate position for the future instrument based on execution reports received before or on the supplied date, and which are visible to the given user.

Buy trades result in positive positions. All other kinds of trades result in negative positions.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the time. execution reports with sending time values less than or equal to this time are included in this calculation.
inFuture - The future instrument
Returns:
the aggregate position for the symbol.
Throws:
PersistenceException - if there were errors retrieving the position.

getAllFuturePositionsAsOf

Map<PositionKey<Future>,BigDecimal> getAllFuturePositionsAsOf(SimpleUser inUser,
                                                              Date inDate)
                                                              throws PersistenceException
Returns the aggregate position of each future (future,account,actor) tuple based on all reports received for each future instrument on or before the supplied date, and which are visible to the given user.

Buy trades result in positive positions. All other kinds of trades result in negative positions.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the date to compare with all the reports. Only the reports that were received on or prior to this date will be used in this calculation. Cannot be null.
Returns:
the position map.
Throws:
PersistenceException - if there were errors retrieving the position map.

getOptionPositionsAsOf

Map<PositionKey<Option>,BigDecimal> getOptionPositionsAsOf(SimpleUser inUser,
                                                           Date inDate,
                                                           String... inSymbols)
                                                           throws PersistenceException
Returns the aggregate position of each option (option,account,actor) tuple based on all reports received for each option instrument on or before the supplied date, and which are visible to the given user.

Buy trades result in positive positions. All other kinds of trades result in negative positions.

Parameters:
inUser - the user making the query. Cannot be null.
inDate - the date to compare with all the reports. Only the reports that were received on or prior to this date will be used in this calculation. Cannot be null.
inSymbols - the list of option roots.
Returns:
the position map.
Throws:
PersistenceException - if there were errors retrieving the position map.

save

void save(ReportBase report)
          throws PersistenceException
Saves the supplied report to the database. Saving may be immediate or delayed; in either case the report ID is set before this method returns.

Parameters:
report - the report to be saved. Cannot be null.
Throws:
PersistenceException - if there were errors saving the report.

getPrincipals

Principals getPrincipals(OrderID orderID)
                         throws PersistenceException
Returns the principals associated with the report with given order ID.

Parameters:
orderID - The order ID.
Returns:
The principals. If no report with the given order ID exists, Principals.UNKNOWN is returned, and no exception is thrown.
Throws:
PersistenceException - Thrown if there were errors accessing the report.


Copyright © 2012. All Rights Reserved.