Market Data - NYSE Openbook Imbalances Event
This method will be called whenever a NYSE or NYSE Mkt (aka AMEX) imbalance event occurs (from the openbook feed).
Interface: def on_nyse_imbalance(self,
event,
md,
order,
service,
account):
pass
Name | Type | Information |
---|---|---|
SSR_filling_price | float | This field contains the SSR Filing Price. This price is the price at which Sell Short interest will be filed in the matching in the event a Sell Short Restriction is in effect for the security. The SSR Filing price is based on the National Best Bid at 9:28am . This price remains static after the SSR Filing price has been determined. |
clearing_price | float | The indicative matching price, the price closest to Reference Price where imbalance is zero. If a continuous book clearing price is not reached, it is defaulted to 0. The Opening Clearing Price will begin publication at approximately 2 minutes (9.28am) and will continue to be published on with the next Opening Imbalance publication interval |
closing_only_clearing_price | float | The Closing Only Clearing Price is defined as the closing only interest where price closest to last sale where imbalance is zero. |
condition_indicator | string | "I" - Informational "R" - Regulatory |
exchange | string | "N" - NYSEexchange details |
imbalance_quantity | integer | The total imbalance quantity at the reference price point. '+' shares indicates buy imbalance '-' shares indicates a sell imbalance. |
paired_quantity | integer | This field contains the paired off quantity at the reference price point. Similar to Matched Shares from ARCA and NASDAQ. |
reference_price | float | The Imbalance reference price point. |
symbol | string | Event Symbol. In most cases symbol is obvious (self.symbol, md.symbol). If the script has subscribed to multiple symbols events, then event.symbol should be used to identify the symbol. |
timestamp | muts | Timestamp of the event |
type | string | "O" - Open "H" - Halt/IPO "C" - Close |
- Event Symbol. In most cases symbol is obvious (self.symbol, md.symbol). If the script has subscribed to multiple symbols events, then event.symbol should be used to identify the symbol.
Print the attributes of event when on_nyse_imbalance() is called.
from cloudquant.interfaces import Strategy
class OnNyseImbalanceExample(Strategy):
do_once = True
@classmethod
def is_symbol_qualified(cls, symbol, md, service, account):
return symbol == 'JNJ'
def on_start(self, md, order, service, account):
if self.__class__.do_once:
print service.time_to_string(service.system_time, '%Y-%m-%d')
self.__class__.do_once = False
print self.symbol
def on_nyse_imbalance( self, event, md, order, service, account ):
print '\nin on_nyse_imbalance()\n\t%s\n' % service.time_to_string(service.system_time, '%H:%M:%S.%f')
print 'event - NyseImbalanceEvent\n'
print ' event.clearing_price - ', event.clearing_price
print ' event.closing_only_clearing_price - ', event.closing_only_clearing_price
print ' event.condition_indicator - ', event.condition_indicator
print ' event.exchange - ', event.exchange
print ' event.imbalance_quantity - ', event.imbalance_quantity
print ' event.kind - ', event.kind
print ' event.paired_quantity - ', event.paired_quantity
print ' event.reference_price - ', event.reference_price
print ' event.symbol - ', event.symbol
print ' event.timestamp - ', event.timestamp
print ' event.type - ', event.type
service.terminate()
Console
2016-08-01 JNJ in on_nyse_imbalance() 09:28:00.040000 event - NyseImbalanceEvent event.clearing_price - 125.190002441 event.closing_only_clearing_price - 0.0 event.condition_indicator - 0 event.exchange - N event.imbalance_quantity - -1800 event.kind - 3 event.paired_quantity - 90100 event.reference_price - 125.230003357 event.symbol - JNJ event.timestamp - 1470058080040000 event.type - O