org.marketcetera.strategy.ruby
Class Strategy

java.lang.Object
  extended by org.marketcetera.strategy.AbstractRunningStrategy
      extended by org.marketcetera.strategy.ruby.Strategy
All Implemented Interfaces:
RunningStrategy

public class Strategy
extends AbstractRunningStrategy

RunningStrategy implementation for Ruby strategies to extend.

Since:
1.0.0
Version:
$Id: Strategy.java 16154 2012-07-14 16:34:05Z colin $
Author:
Colin DuPlantis

Constructor Summary
Strategy()
           
 
Method Summary
 void cancel_all_data_requests()
          Cancels all data requests for this Strategy.
 int cancel_all_orders()
          Submits cancel requests for all OrderSingle open orders owned by the strategy's owner.
 void cancel_data_flow(DataFlowID inDataFlowID)
          Cancels a data flow identified by the supplied data flow ID.
 void cancel_data_request(int inRequestID)
          Cancels a given data request.
 OrderCancel cancel_order(OrderID inOrderID, boolean inSendOrder)
          Submits a request to cancel the OrderSingle with the given OrderID.
 OrderReplace cancel_replace(OrderID inOrderID, OrderSingle inNewOrder, boolean inSendOrder)
          Submits a cancel-replace order for the given OrderID with the given Order.
 DataFlowID create_data_flow(boolean inAppendDataSink, DataRequest[] inRequests)
          Initiates a data flow request.
 void debug(String inMessage)
          Emits the given debug message to the strategy log output.
 void error(String inMessage)
          Emits the given error message to the strategy log output.
 Map<PositionKey<Future>,BigDecimal> get_all_future_positions_as_of(Date inDate)
          Gets all open Future positions at the given point in time.
 Map<PositionKey<Option>,BigDecimal> get_all_option_positions_as_of(Date inDate)
          Gets all open Option positions at the given point in time.
 Map<PositionKey<Equity>,BigDecimal> get_all_positions_as_of(Date inDate)
          Gets all open Equity positions at the given point in time.
 BrokerStatus[] get_brokers()
          Returns the list of brokers known to the system.
 Deque<ReportBase> get_execution_reports(OrderID inOrderID)
          Gets the ReportBase values representing the order history of the given OrderID.
 BigDecimal get_future_position_as_of(Date inDate, String inUnderlyingSymbol, FutureExpirationMonth inExpirationMonth, int inExpirationYear)
          Gets the position in the given Future at the given point in time.
 Set<OrderID> get_open_order_ids()
          Returns the list of OrderID values for open orders created in this session in the order they were submitted.
 Collection<ExecutionReport> get_open_orders()
          Gets the collection of open orders represented by the most recent ExecutionReport.
 BigDecimal get_option_position_as_of(Date inDate, String inOptionRoot, String inExpiry, BigDecimal inStrikePrice, OptionType inType)
          Gets the position in the given Option at the given point in time.
 Map<PositionKey<Option>,BigDecimal> get_option_positions_as_of(Date inDate, String[] inOptionRoots)
          Gets open positions for the options specified by the given option roots at the given point in time.
 Collection<String> get_option_roots(String inUnderlying)
          Gets the set of of known option roots for the given underlying symbol.
 OrderStatus get_order_status(OrderID inOrderID)
          Gets the OrderStatus for the given OrderID.
 String get_parameter(String inName)
          Gets the parameter associated with the given name.
 BigDecimal get_position_as_of(Date inDate, String inSymbol)
          Gets the position in the given Equity at the given point in time.
 String get_property(String inName)
          Gets the property associated with the given name.
 Set<OrderID> get_submitted_order_ids()
          Returns the list of open order IDs created during this session in the order they were submitted.
 String get_underlying(String inOptionRoot)
          Gets the underlying symbol for the given option root, if available.
 ModuleURN get_urn()
          Gets the ModuleURN of this strategy.
 Properties get_user_data()
          Gets the user data associated with the current user.
 void info(String inMessage)
          Emits the given info message to the strategy log output.
 void notify_high(String inSubject, String inBody)
          Creates and issues a Notification at high priority.
 void notify_low(String inSubject, String inBody)
          Creates and issues a Notification at low priority.
 void notify_medium(String inSubject, String inBody)
          Creates and issues a Notification at medium priority.
protected  void on_ask(AskEvent inAsk)
          Invoked when the Strategy receives an AskEvent.
protected  void on_bid(BidEvent inBid)
          Invoked when the Strategy receives a BidEvent.
protected  void on_callback(Object inData)
          Invoked when the Strategy receives a callback requested via request_callback_at(Date, Object) or request_callback_after(long, Object).
protected  void on_cancel_reject(OrderCancelReject inCancelReject)
          Invoked when the Strategy receives an OrderCancelReject.
protected  void on_dividend(DividendEvent inStatistics)
          Invoked when the Strategy receives a DividendEvent.
protected  void on_execution_report(ExecutionReport inExecutionReport)
          Invoked when the Strategy receives an ExecutionReport.
protected  void on_marketstat(MarketstatEvent inStatistics)
          Invoked when the Strategy receives a MarketstatEvent.
protected  void on_other(Object inEvent)
          Invoked when the Strategy receives an object that does not fit any of the other categories.
protected  void on_start()
          Called when a strategy is started.
protected  void on_stop()
          Called when a strategy is about to be stopped.
protected  void on_trade(TradeEvent inTrade)
          Invoked when the Strategy receives a TradeEvent.
 void onAsk(AskEvent inAsk)
          Indicates an AskEvent has been received.
 void onBid(BidEvent inBid)
          Indicates a BidEvent has been received.
 void onCallback(Object inData)
          Indicates a scheduled callback has been executed.
 void onCancelReject(OrderCancelReject inCancel)
          Indicates an OrderCancelReject has been received.
 void onDividend(DividendEvent inDividend)
          Indicates a DividendEvent has been received.
 void onExecutionReport(ExecutionReport inExecutionReport)
          Indicates an ExecutionReport has been received.
 void onMarketstat(MarketstatEvent inStatistics)
          Indicates a MarketstatEvent has been received.
 void onOther(Object inEvent)
          Indicates an object has been sent that does not fit any of the other callbacks.
 void onStart()
          Called when a strategy is started.
 void onStop()
          Called when a strategy is about to be stopped.
 void onTrade(TradeEvent inTrade)
          Indicates a TradeEvent has been received.
 void request_callback_after(long inDelay, Object inData)
          Requests a callback after a specified delay in milliseconds.
 void request_callback_at(Date inDate, Object inData)
          Requests a callback at a specific point in time.
 void request_callback_every(long inDelay, long inPeriod, Object inData)
          Requests a callback periodically after a specified period in milliseconds.
 int request_cep_data(String[] inStatements, String inSource)
          Creates a complex event processor request.
 int request_market_data(MarketDataRequest inRequest)
          Creates a market data request.
 int request_market_data(String inRequest)
          Creates a market data request.
 int request_processed_market_data(MarketDataRequest inRequest, String[] inStatements, String inCepSource)
          Requests market data processed by the given complex event processor from the given source.
 int request_processed_market_data(String inRequest, String[] inStatements, String inCepSource)
          Requests market data processed by the given complex event processor from the given source.
 void send_event_to_cep(Event inEvent, String inProvider)
          Sends the given event to the CEP module indicated by the provider.
 void send_event(Event inEvent)
          Sends the given event to the appropriate subscribers.
 void send_message(Message inMessage, BrokerID inBroker)
          Sends a FIX message to all subscribers to which orders are sent.
 boolean send(Object inData)
          Sends an order to order subscribers.
 void set_property(String inKey, String inValue)
          Sets the given key to the given value in the storage area common to all running strategies.
 void set_user_data(Properties inData)
          Sets the user data associated with the current user.
 void suggest_trade(OrderSingle inOrder, BigDecimal inScore, String inIdentifier)
          Suggests a trade.
 void warn(String inMessage)
          Emits the given warn message to the strategy log output.
 
Methods inherited from class org.marketcetera.strategy.AbstractRunningStrategy
cancelAllDataRequests, cancelAllOrders, cancelDataFlow, cancelDataRequest, cancelOrder, cancelReplace, createDataFlow, getAllFuturePositionsAsOf, getAllOptionPositionsAsOf, getAllPositionsAsOf, getBrokers, getExecutionReports, getFuturePositionAsOf, getOpenOrderIDs, getOpenOrders, getOptionPositionAsOf, getOptionPositionsAsOf, getOptionRoots, getOrderStatus, getParameter, getPositionAsOf, getProperty, getReportHistoryOriginDate, getSubmittedOrderIDs, getUnderlying, getURN, getUserData, initializeReportHistoryManager, requestCallbackAfter, requestCallbackAt, requestCallbackEvery, requestCEPData, requestMarketData, requestMarketData, requestProcessedMarketData, requestProcessedMarketData, sendEvent, sendEventToCEP, sendMessage, sendNotification, setProperty, setUserData, suggestTrade, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Strategy

public Strategy()
Method Detail

onAsk

public final void onAsk(AskEvent inAsk)
Description copied from interface: RunningStrategy
Indicates an AskEvent has been received.

Parameters:
inAsk - an AskEvent value

onBid

public final void onBid(BidEvent inBid)
Description copied from interface: RunningStrategy
Indicates a BidEvent has been received.

Parameters:
inBid - a BidEvent value

onMarketstat

public void onMarketstat(MarketstatEvent inStatistics)
Description copied from interface: RunningStrategy
Indicates a MarketstatEvent has been received.

Parameters:
inStatistics - a MarketstatEvent value

onDividend

public void onDividend(DividendEvent inDividend)
Description copied from interface: RunningStrategy
Indicates a DividendEvent has been received.

Parameters:
inDividend - a DividendEvent value

onCallback

public final void onCallback(Object inData)
Description copied from interface: RunningStrategy
Indicates a scheduled callback has been executed.

Parameters:
inData - an Object value passed to the request for callback method

onExecutionReport

public final void onExecutionReport(ExecutionReport inExecutionReport)
Description copied from interface: RunningStrategy
Indicates an ExecutionReport has been received.

Parameters:
inExecutionReport - an ExecutionReport value

onCancelReject

public final void onCancelReject(OrderCancelReject inCancel)
Description copied from interface: RunningStrategy
Indicates an OrderCancelReject has been received.

Parameters:
inCancel - an OrderCancelReject value

onTrade

public final void onTrade(TradeEvent inTrade)
Description copied from interface: RunningStrategy
Indicates a TradeEvent has been received.

Parameters:
inTrade - a TradeEvent value

onOther

public final void onOther(Object inEvent)
Description copied from interface: RunningStrategy
Indicates an object has been sent that does not fit any of the other callbacks.

Parameters:
inEvent - an Object value

onStart

public final void onStart()
Description copied from interface: RunningStrategy
Called when a strategy is started.


onStop

public final void onStop()
Description copied from interface: RunningStrategy
Called when a strategy is about to be stopped.


on_ask

protected void on_ask(AskEvent inAsk)
Invoked when the Strategy receives an AskEvent.

Parameters:
inAsk - an AskEvent value

on_bid

protected void on_bid(BidEvent inBid)
Invoked when the Strategy receives a BidEvent.

Parameters:
inBid - a BidEvent value

on_marketstat

protected void on_marketstat(MarketstatEvent inStatistics)
Invoked when the Strategy receives a MarketstatEvent.

Parameters:
inStatistics - a MarketstatEvent value

on_dividend

protected void on_dividend(DividendEvent inStatistics)
Invoked when the Strategy receives a DividendEvent.

Parameters:
inStatistics - a DividendEvent value

on_execution_report

protected void on_execution_report(ExecutionReport inExecutionReport)
Invoked when the Strategy receives an ExecutionReport.

Parameters:
inExecutionReport - an ExecutionReport value

on_cancel_reject

protected void on_cancel_reject(OrderCancelReject inCancelReject)
Invoked when the Strategy receives an OrderCancelReject.

Parameters:
inCancelReject - an OrderCancelReject value

on_trade

protected void on_trade(TradeEvent inTrade)
Invoked when the Strategy receives a TradeEvent.

Parameters:
inTrade - a TradeEvent value

on_other

protected void on_other(Object inEvent)
Invoked when the Strategy receives an object that does not fit any of the other categories.

Parameters:
inEvent - an Object value

on_callback

protected void on_callback(Object inData)
Invoked when the Strategy receives a callback requested via request_callback_at(Date, Object) or request_callback_after(long, Object).

Parameters:
inData - an Object value which was passed to the request, may be null

on_start

protected void on_start()
Called when a strategy is started.


on_stop

protected void on_stop()
Called when a strategy is about to be stopped.


set_property

public final void set_property(String inKey,
                               String inValue)
Sets the given key to the given value in the storage area common to all running strategies.

Parameters:
inKey - a String value
inValue - a String value

get_parameter

public final String get_parameter(String inName)
Gets the parameter associated with the given name.

Parameters:
inName - a String value containing the key of a parameter key/value value
Returns:
a String value or null if no parameter is associated with the given name

get_property

public final String get_property(String inName)
Gets the property associated with the given name.

Parameters:
inName - a String value containing the key of a property key/value value
Returns:
a String value or null if no property is associated with the given name

request_callback_after

public final void request_callback_after(long inDelay,
                                         Object inData)
Requests a callback after a specified delay in milliseconds.

The callback will be executed as close to the specified millisecond as possible. There is no guarantee that the timing will be exact. If more than one callback is requested by the same RunningStrategy for the same millisecond, the requests will be processed serially in FIFO order. This implies that a long-running callback request may delay other callbacks from the same RunningStrategy unless the caller takes steps to mitigate the bottleneck.

Parameters:
inDelay - a long value indicating how many milliseconds to wait before executing the callback. A value <= 0 will be interpreted as a request for an immediate callback.
inData - an Object value to deliver along with the callback, may be null

request_callback_every

public final void request_callback_every(long inDelay,
                                         long inPeriod,
                                         Object inData)
Requests a callback periodically after a specified period in milliseconds.

The callback will be executed as close to the specified millisecond as possible. There is no guarantee that the timing will be exact. If more than one callback is requested by the same RunningStrategy for the same millisecond, the requests will be processed serially in FIFO order. This implies that a long-running callback request may delay other callbacks from the same RunningStrategy unless the caller takes steps to mitigate the bottleneck.

Parameters:
inDelay - a long value indicating how many milliseconds to wait before executing the first callback. A value <= 0 will be interpreted as a request for an immediate callback.
inPeriod - a long value indicating how many milliseconds to wait before executing the second callback, and thereafter repeatedly The value must be > 0.
inData - an Object value to deliver along with the callback, may be null

request_callback_at

public final void request_callback_at(Date inDate,
                                      Object inData)
Requests a callback at a specific point in time.

The callback will be executed as close to the specified millisecond as possible. There is no guarantee that the timing will be exact. If more than one callback is requested by the same RunningStrategy for the same millisecond, the requests will be processed serially in FIFO order. This implies that a long-running callback request may delay other callbacks from the same RunningStrategy unless the caller takes steps to mitigate the bottleneck.

Parameters:
inDate - a Date value at which to execute the callback. A date value earlier than the present will be interpreted as a request for an immediate callback.
inData - an Object value to deliver with the callback or null

request_market_data

public final int request_market_data(MarketDataRequest inRequest)
Creates a market data request.

The inRequest object must refer to a started market data provider module.

Parameters:
inRequest - a MarketDataRequest value containing the request to execute
Returns:
an int value containing an identifier corresponding to this market data request or 0 if the request failed

request_market_data

public final int request_market_data(String inRequest)
Creates a market data request.

The inRequest object must refer to a started market data provider module.

Parameters:
inRequest - a String value containing the representation of a MarketDataRequest to execute
Returns:
an int value containing an identifier corresponding to this market data request or 0 if the request failed

request_processed_market_data

public final int request_processed_market_data(MarketDataRequest inRequest,
                                               String[] inStatements,
                                               String inCepSource)
Requests market data processed by the given complex event processor from the given source.

Parameters:
inRequest - a MarketDataRequest value containing the request to execute
inStatements - a String[] value containing the statements to pass to the complex event processor. The meaning of the statements varies according to the actual event processor that handles them.
inCepSource - a String value containing the name of the complex event processor to which to send the query request
Returns:
an int value containing the handle of the request or 0 if the request failed

request_processed_market_data

public final int request_processed_market_data(String inRequest,
                                               String[] inStatements,
                                               String inCepSource)
Requests market data processed by the given complex event processor from the given source.

Parameters:
inRequest - a String value containing the representation of a MarketDataRequest to execute
inStatements - a String[] value containing the statements to pass to the complex event processor. The meaning of the statements varies according to the actual event processor that handles them.
inCepSource - a String value containing the name of the complex event processor to which to send the query request
Returns:
an int value containing the handle of the request or 0 if the request failed

cancel_data_request

public final void cancel_data_request(int inRequestID)
Cancels a given data request.

If the given inRequestID identifier does not correspond to an active data request, this method does nothing.

Parameters:
inRequestID - an int value identifying the data request to cancel

cancel_all_data_requests

public final void cancel_all_data_requests()
Cancels all data requests for this Strategy.

If there are no active data requests for this Strategy, this method does nothing.


request_cep_data

public final int request_cep_data(String[] inStatements,
                                  String inSource)
Creates a complex event processor request.

Parameters:
inStatements - a String[] value containing an array of statements that comprises the request
inSource - a String value indicating what market data provider from which to request the data
Returns:
an int value containing an identifier corresponding to this market data request or 0 if the request failed

suggest_trade

public final void suggest_trade(OrderSingle inOrder,
                                BigDecimal inScore,
                                String inIdentifier)
Suggests a trade.

Parameters:
inOrder - an OrderSingle value containing the trade to suggest
inScore - a BigDecimal value containing the score of this suggestion. this value is determined by the user but is recommended to fit in the interval [0..1]
inIdentifier - a String value containing a user-specified string to identify the suggestion

send_message

public final void send_message(Message inMessage,
                               BrokerID inBroker)
Sends a FIX message to all subscribers to which orders are sent.

Parameters:
inMessage - a Message value
inBroker - a BrokerID value

send_event_to_cep

public final void send_event_to_cep(Event inEvent,
                                    String inProvider)
Sends the given event to the CEP module indicated by the provider.

The corresponding CEP module must already exist or the message will not be sent.

Parameters:
inEvent - an Event value containing the event to be sent
inProvider - a String value containing the name of a CEP provider

send_event

public final void send_event(Event inEvent)
Sends the given event to the appropriate subscribers.

Parameters:
inEvent - an Event value

send

public final boolean send(Object inData)
Sends an order to order subscribers.

OrderSingle objects passed to this method will be added to the list of submitted orders but other object types will not. In order to track, for example, OrderReplace and OrderCancel objects, they must have first been created via cancel_replace(OrderID, OrderSingle, boolean) and cancel_order(OrderID, boolean) respectively.

Overrides:
send in class AbstractRunningStrategy
Parameters:
inData - an Object value
Returns:
a boolean value indicating whether the object was successfully transmitted or not

cancel_order

public final OrderCancel cancel_order(OrderID inOrderID,
                                      boolean inSendOrder)
Submits a request to cancel the OrderSingle with the given OrderID.

The order must currently be open or this operation will fail. Note that the strategy's concept of open orders is based on its report history origin date as specified.

Parameters:
inOrderID - an OrderID value containing the ID of the open order to cancel
inSendOrder - a boolean value indicating whether the OrderCancel should be submitted or just returned to the caller If false, it is the caller's responsibility to submit the OrderCancel with send(Object).
Returns:
an OrderCancel value containing the cancel order or null if the OrderCancel could not be constructed

cancel_replace

public final OrderReplace cancel_replace(OrderID inOrderID,
                                         OrderSingle inNewOrder,
                                         boolean inSendOrder)
Submits a cancel-replace order for the given OrderID with the given Order.

The order must be open or this call will have no effect.

If inSendOrder is false, it is the caller's responsibility to submit the OrderReplace.

Parameters:
inOrderID - an OrderID value containing the order to cancel
inNewOrder - an OrderSingle value containing the order with which to replace the existing order
inSendOrder - a boolean value indicating whether the OrderReplace should be submitted or just returned to the caller. If false, it is the caller's responsibility to submit the OrderReplace with send(Object).
Returns:
an OrderReplace value containing the new order or null if the old order could not be canceled and the new one could not be sent

cancel_all_orders

public final int cancel_all_orders()
Submits cancel requests for all OrderSingle open orders owned by the strategy's owner.

This method will make a best-effort attempt to cancel all orders. If an attempt to cancel one order fails, that order will be skipped and the others will still be attempted in their turn.

Returns:
an int value containing the number of orders for which cancels were submitted

get_order_status

public final OrderStatus get_order_status(OrderID inOrderID)
Gets the OrderStatus for the given OrderID.

The given OrderID may be any part of the order chain. For example, if an order is replaced, either the original OrderID or the current OrderID will return the same value, although only the current OrderID is open.

Parameters:
inOrderID - an OrderID value or null if the given order cannot be found
Returns:
an OrderStatus value

get_open_orders

public final Collection<ExecutionReport> get_open_orders()
Gets the collection of open orders represented by the most recent ExecutionReport.

Returns:
a Collection<ExecutionReport> value

get_submitted_order_ids

public final Set<OrderID> get_submitted_order_ids()
Returns the list of open order IDs created during this session in the order they were submitted.

Returns all order IDs regardless of their state.

Returns:
a Set<OrderID> value

get_open_order_ids

public final Set<OrderID> get_open_order_ids()
Returns the list of OrderID values for open orders created in this session in the order they were submitted.

Returns IDs of open orders only. Orders that were canceled, replaced, filled, or otherwise are no longer open will not be returned. For orders submitted via AbstractRunningStrategy.cancelReplace(OrderID, OrderSingle, boolean), the ID of the OrderReplace value sent to the broker is returned, not the OrderSingle value used to create the OrderReplace.

Returns:
a Set<OrderID> value

create_data_flow

public final DataFlowID create_data_flow(boolean inAppendDataSink,
                                         DataRequest[] inRequests)
Initiates a data flow request.

See DataFlowSupport.createDataFlow(DataRequest[], boolean).

Parameters:
inAppendDataSink - a boolean value indicating if the sink module should be appended to the data pipeline, if it's not already requested as the last module and the last module is capable of emitting data.
inRequests - a DataRequest[] value containing the ordered list of requests. Each instance identifies a stage of the data pipeline. The data from the first stage is piped to the next.
Returns:
a DataFlowID value containing a unique ID identifying the data flow. The ID can be used to cancel the data flow request and get more details on it. Returns null if the request could not be created.

cancel_data_flow

public final void cancel_data_flow(DataFlowID inDataFlowID)
Cancels a data flow identified by the supplied data flow ID.

See DataFlowSupport.cancel(DataFlowID).

Parameters:
inDataFlowID - a DataFlowID value containing the request handle that was returned from a prior call to create_data_flow(boolean, DataRequest[])

get_execution_reports

public final Deque<ReportBase> get_execution_reports(OrderID inOrderID)
Gets the ReportBase values representing the order history of the given OrderID.

The ReportBase objects returned by this call represent the history of the order represented by the given OrderID. if there is no order history for the given OrderID, this operation will return an empty collection.

The values returned by this operation are sorted from newest to oldest: the order's current status is represented by the first element in the collection.

The collection returned by this operation will be updated as the underlying report history changes. The collection itself may not be modified.

The contents of the returned collection are limited by the value returned by AbstractRunningStrategy.getReportHistoryOriginDate(). The default value is all reports. No reports with a sending time before the origin date will be returned.

Parameters:
inOrderID - an OrderID value corresponding to an existing order, either open or closed
Returns:
a Deque<ReportBase> value containing the ReportBase objects

notify_low

public final void notify_low(String inSubject,
                             String inBody)
Creates and issues a Notification at low priority.

Parameters:
inSubject - a String value
inBody - a String value

notify_medium

public final void notify_medium(String inSubject,
                                String inBody)
Creates and issues a Notification at medium priority.

Parameters:
inSubject - a String value
inBody - a String value

notify_high

public final void notify_high(String inSubject,
                              String inBody)
Creates and issues a Notification at high priority.

Parameters:
inSubject - a String value
inBody - a String value

debug

public final void debug(String inMessage)
Emits the given debug message to the strategy log output.

Overrides:
debug in class AbstractRunningStrategy
Parameters:
inMessage - a String value

info

public final void info(String inMessage)
Emits the given info message to the strategy log output.

Overrides:
info in class AbstractRunningStrategy
Parameters:
inMessage - a String value

warn

public final void warn(String inMessage)
Emits the given warn message to the strategy log output.

Overrides:
warn in class AbstractRunningStrategy
Parameters:
inMessage - a String value

error

public final void error(String inMessage)
Emits the given error message to the strategy log output.

Overrides:
error in class AbstractRunningStrategy
Parameters:
inMessage - a String value

get_brokers

public final BrokerStatus[] get_brokers()
Returns the list of brokers known to the system.

These values can be used to create and send orders with send_message(Message, BrokerID) or send(Object).

Returns:
a BrokerStatus[] value

get_position_as_of

public final BigDecimal get_position_as_of(Date inDate,
                                           String inSymbol)
Gets the position in the given Equity at the given point in time.

Note that this method will not retrieve Option positions. To retrieve Option positions, use get_option_position_as_of(Date, String, String, BigDecimal, OptionType).

Parameters:
inDate - a Date value indicating the point in time for which to search
inSymbol - a String value containing the Equity symbol
Returns:
a BigDecimal value or null if no position could be found

get_all_positions_as_of

public final Map<PositionKey<Equity>,BigDecimal> get_all_positions_as_of(Date inDate)
Gets all open Equity positions at the given point in time.

Parameters:
inDate - a Date value indicating the point in time for which to search
Returns:
a Map<PositionKey<Equity>,BigDecimal> value

get_option_position_as_of

public final BigDecimal get_option_position_as_of(Date inDate,
                                                  String inOptionRoot,
                                                  String inExpiry,
                                                  BigDecimal inStrikePrice,
                                                  OptionType inType)
Gets the position in the given Option at the given point in time.

Parameters:
inDate - a Date value indicating the point in time for which to search
inOptionRoot - a String value
inExpiry - a String value
inStrikePrice - a BigDecimal value
inType - an OptionType value
Returns:
a BigDecimal value or null if no position could be found

get_all_option_positions_as_of

public final Map<PositionKey<Option>,BigDecimal> get_all_option_positions_as_of(Date inDate)
Gets all open Option positions at the given point in time.

Parameters:
inDate - a Date value indicating the point in time for which to search
Returns:
a Map<PositionKey<Option>,BigDecimal> value

get_option_positions_as_of

public final Map<PositionKey<Option>,BigDecimal> get_option_positions_as_of(Date inDate,
                                                                            String[] inOptionRoots)
Gets open positions for the options specified by the given option roots at the given point in time.

Parameters:
inDate - a Date value indicating the point in time for which to search
inOptionRoots - a String[] value containing the specific option roots for which to search
Returns:
a Map<PositionKey<Option>,BigDecimal> value

get_underlying

public final String get_underlying(String inOptionRoot)
Gets the underlying symbol for the given option root, if available.

Parameters:
inOptionRoot - a String value containing an option root
Returns:
a String value containing the symbol for the underlying instrument or null if no underlying instrument could be found

get_option_roots

public final Collection<String> get_option_roots(String inUnderlying)
Gets the set of of known option roots for the given underlying symbol.

Parameters:
inUnderlying - a String value containing the symbol of an underlying instrument
Returns:
a Collection<String> value sorted lexicographically by option root or null if no option roots could be found

get_all_future_positions_as_of

public final Map<PositionKey<Future>,BigDecimal> get_all_future_positions_as_of(Date inDate)
Gets all open Future positions at the given point in time.

Parameters:
inDate - a Date value indicating the point in time for which to search
Returns:
a Map<PositionKey<Option>,BigDecimal> value

get_future_position_as_of

public final BigDecimal get_future_position_as_of(Date inDate,
                                                  String inUnderlyingSymbol,
                                                  FutureExpirationMonth inExpirationMonth,
                                                  int inExpirationYear)
Gets the position in the given Future at the given point in time.

Note that this method will not retrieve Option or Equity positions. To retrieve Option positions, use AbstractRunningStrategy.getOptionPositionAsOf(Date, String, String, BigDecimal, OptionType). To retrieve Equity positions, use AbstractRunningStrategy.getPositionAsOf(Date, String).

Parameters:
inDate - a Date value indicating the point in time for which to search
inUnderlyingSymbol - a String value containing the underlying Future symbol
inExpirationMonth - a FutureExpirationMonth value
inExpirationYear - an int value
Returns:
a BigDecimal value or null if no position could be found

get_urn

public final ModuleURN get_urn()
Gets the ModuleURN of this strategy.

Returns:
a ModuleURN value

get_user_data

public final Properties get_user_data()
Gets the user data associated with the current user.

Returns:
a Properties value

set_user_data

public final void set_user_data(Properties inData)
Sets the user data associated with the current user.

Parameters:
inData - a Properties value


Copyright © 2012. All Rights Reserved.