amer_imb
md. Overview:An interface to the NYSE Mkt (aka AMEX) imbalance data for the current symbol.
Data Attributes:Sample - Access data attribute
md.amer_imb.abs_price_diff_bid_ask
Name | Type | Special | Information |
---|---|---|---|
SSR_filling_price | float | NaN |
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. |
abs_price_diff_bid_ask | float | NaN | calculated:
abs(price_diff_bid_ask) |
abs_price_diff_from_pc | float | 0 | calculated:
if clearing_price > 0 and stat.prev_close > 0: return abs(stat.prev_close - clearing_price) else: return float('NaN') |
abs_price_diff_from_pc_percent_atr | float | NaN | calculated:
if stat.atr > 0: return abs_price_diff_from_pc / stat.atr * 100 else: return float('NaN') |
clearing_price | float | NaN |
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 | NaN | 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 | ||
exchange | string | None |
|
flip_count | integer | 0 | Number of times an imbalance flips from buy to sell or sell to buy. If this number goes from 0 to 1, it is the first time it has flipped. Odd numbers indicate it has flipped away from it's initial imbalance side. Even numbers indicate it has flipped back |
high_imbalance | integer | 0 | The highest value for Imbalance Shares. '+' shares indicates buy imbalance '-' shares indicates a sell imbalance. |
high_imbalance_time | muts | 0 | Time of Imbalance Shares High. |
imbalance_quantity | integer | 0 | The total imbalance quantity at the reference price point. '+' shares indicates buy imbalance '-' shares indicates a sell imbalance. |
indicative_match_price | float | NaN |
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 |
is_regulatory | boolean | False | This field defaults to false, and is set to True when declared as 'Regulatory' in the initial NYSE Imbalance broadcast (not to be confused to NYSE Continuous Feed) |
last_flip_time | muts | 0 | Time of the latest imbalance flip. |
paired_quantity | integer | 0 | This field contains the paired off quantity at the reference price point. Similar to Matched Shares from ARCA and NASDAQ. |
price_diff_bid_ask | float | NaN | calculated:
if clearing_price > 0: if imbalance_quantity 0 and clearing_price > L1.ask: return clearing_price - L1.ask return float('NaN') |
price_diff_from_last | float | NaN | calculated:
clearing_price - L1.last |
price_percent_diff_last | float | NaN | calculated:
if L1.last > 0: return price_diff_from_last / L1.last * 100 else: return float('NaN') |
price_percent_pc | float | NaN | calculated:
if clearing_price > 0 and stat.prev_close > 0: return clearing_price / stat.prev_close * 100 else: return float('NaN') |
reference_price | float | NaN | The Imbalance reference price point. |
regulatory_quantity | integer | 0 | Initial imbalance shares: if the imbalance was a 'REGULATORY' imbalance, else 0. '+' shares indicates BUY imbalance '-' shares indicates a SELL imbalance. |
shares_percent_primary_vol | float | NaN | calculated:
if L1.primary_acc_volume > 0: return imbalance_quantity / L1.primary_acc_volume * 100 else: return float('NaN') |
shares_percent_vol | float | NaN | calculated:
if L1.acc_volume > 0: return imbalance_quantity / L1.acc_volume * 100 else: return float('NaN') |
symbol | string | ||
timestamp | muts | 0 | Timestamp of the event |
type | string | 0 |
|
- There are two AMER Imbalance feeds (NYSE Broadcast?, and NYSE Continuous)
- Broadcast? is 15 minutes before the close. Broadcast sets the is_regulatory
- Continuous feed - ?
- Keep in mind, md.amer_imb has is_regulatory while AMERImbalanceEvent has condition_indicator.
- is_regulatory maintains the state of the Broadcast? event. There is a possible race condition when the first message on the continuous feed call on_amer_imbalance while set to is_regulatory is set to False. Immediately after, on_amer_imbalance is called from the Broadcast? event which sets is_regulatory to True.
Print attributes of md.amer_imb when on_amer_imbalance() is called.
from cloudquant.interfaces import Strategy
class AmerImbalanceExample(Strategy):
@classmethod
def on_strategy_start(cls, md, service, account):
print service.time_to_string(service.system_time, '%Y-%m-%d')
@classmethod
def is_symbol_qualified(cls, symbol, md, service, account):
return symbol == "XXII"
def on_start(self, md, order, service, account):
print self.symbol
def on_amer_imbalance(self, event, md, order, service, account):
print '\nin on_amer_imbalance\n\t%s\n' % service.time_to_string(service.system_time, '%H:%M:%S.%f')
print '\n\nmd.amer_imb\n'
print ' md.amer_imb.imbalance_quantity - ', md.amer_imb.imbalance_quantity
print ' md.amer_imb.SSR_filling_price - ', md.amer_imb.SSR_filling_price
print ' md.amer_imb.abs_price_diff_bid_ask - ', md.amer_imb.abs_price_diff_bid_ask
print ' md.amer_imb.abs_price_diff_from_pc - ', md.amer_imb.abs_price_diff_from_pc
print ' md.amer_imb.abs_price_diff_from_pc_percent_atr - ', md.amer_imb.abs_price_diff_from_pc_percent_atr
print ' md.amer_imb.clearing_price - ', md.amer_imb.clearing_price
print ' md.amer_imb.closing_only_clearing_price - ', md.amer_imb.closing_only_clearing_price
print ' md.amer_imb.exchange - ', md.amer_imb.exchange
print ' md.amer_imb.flip_count - ', md.amer_imb.flip_count
print ' md.amer_imb.high_imbalance - ', md.amer_imb.high_imbalance
print ' md.amer_imb.high_imbalance_time - ', md.amer_imb.high_imbalance_time
print ' md.amer_imb.is_regulatory - ', md.amer_imb.is_regulatory
print ' md.amer_imb.last_flip_time - ', md.amer_imb.last_flip_time
print ' md.amer_imb.paired_quantity - ', md.amer_imb.paired_quantity
print ' md.amer_imb.price_diff_bid_ask - ', md.amer_imb.price_diff_bid_ask
print ' md.amer_imb.price_diff_from_last - ', md.amer_imb.price_diff_from_last
print ' md.amer_imb.price_percent_diff_last - ', md.amer_imb.price_percent_diff_last
print ' md.amer_imb.price_percent_pc - ', md.amer_imb.price_percent_pc
print ' md.amer_imb.reference_price - ', md.amer_imb.reference_price
print ' md.amer_imb.regulatory_quantity - ', md.amer_imb.regulatory_quantity
print ' md.amer_imb.shares_percent_primary_vol - ', md.amer_imb.shares_percent_primary_vol
print ' md.amer_imb.shares_percent_vol - ', md.amer_imb.shares_percent_vol
print ' md.amer_imb.timestamp - ', md.amer_imb.timestamp
print ' md.amer_imb.type - ', md.amer_imb.type
service.terminate()
Console
2018-01-02 XXII in on_amer_imbalance 09:25:01.677000 md.amer_imb md.amer_imb.imbalance_quantity - 9244 md.amer_imb.SSR_filling_price - 0.0 md.amer_imb.abs_price_diff_bid_ask - 0.0199999809265 md.amer_imb.abs_price_diff_from_pc - 0.100000143051 md.amer_imb.abs_price_diff_from_pc_percent_atr - 52.529362028 md.amer_imb.clearing_price - 2.90000009537 md.amer_imb.closing_only_clearing_price - 2.90000009537 md.amer_imb.exchange - A md.amer_imb.flip_count - 13 md.amer_imb.high_imbalance - 17004 md.amer_imb.high_imbalance_time - 1514898914941000 md.amer_imb.is_regulatory - False md.amer_imb.last_flip_time - 1514900428845000 md.amer_imb.paired_quantity - 48367 md.amer_imb.price_diff_bid_ask - 0.0199999809265 md.amer_imb.price_diff_from_last - 0.00999999046326 md.amer_imb.price_percent_diff_last - 0.344827246014 md.amer_imb.price_percent_pc - 103.571433741 md.amer_imb.reference_price - 2.91000008583 md.amer_imb.regulatory_quantity - 0 md.amer_imb.shares_percent_primary_vol - nan md.amer_imb.shares_percent_vol - 63.5413802585 md.amer_imb.timestamp - 1514903101672000 md.amer_imb.type - O