public void SetUp() { try { MamaBridge mBridge = Mama.loadBridge("lbm"); Mama.open(); MamaDictionary mDictionary = new MamaDictionary(); mDictionary.create("dictionary.txt"); MamdaCommonFields.setDictionary(mDictionary, null); MamdaQuoteFields.reset(); MamdaQuoteFields.setDictionary(mDictionary, null); mSubscription = new MamdaSubscription(); mQuoteListener = new MamdaQuoteListener(); mSubscription.addMsgListener(mQuoteListener); ticker = new QuoteTicker(); mQuoteListener.addHandler(ticker); } catch (Exception ex) { throw new MamdaDataException(ex.Message, ex); } }
public void onQuoteRecap( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteRecap recap) { }
public void onQuoteRecap( MamdaSubscription subscription, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteRecap recap) { Console.WriteLine("Quote Recap ({0})", subscription.getSymbol()); }
public void onQuoteRecap( MamdaSubscription subscription, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteRecap recap) { prettyPrint("Quote Recap ({0})", subscription.getSymbol()); }
public void onQuoteUpdate( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteUpdate updateEvent, MamdaQuoteRecap recap) { }
public void onQuoteClosing( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteClosing closingEvent, MamdaQuoteRecap recap) { }
public void onQuoteClosing( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteClosing closingEvent, MamdaQuoteRecap recap) { Console.WriteLine("Quote Closing (" + sub.getSymbol() + "): "); }
public void onQuoteRecap( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteRecap recap) { Console.WriteLine("Quote Recap (" + msg.getString (MamdaCommonFields.ISSUE_SYMBOL) + "): "); }
public void onQuoteRecap( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteRecap recap) { // Refresh the "display" of this contract. myDisplay.printlnContract(myContract); }
public void onQuoteGap( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteGap gapEvent, MamdaQuoteRecap recap) { Console.WriteLine("Quote gap (" + gapEvent.getBeginGapSeqNum() + "-" + gapEvent.getEndGapSeqNum() + ")"); }
public void onQuoteUpdate( MamdaSubscription subscription, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteUpdate update, MamdaQuoteRecap recap) { myShortSaleCircuitBreaker = update.getShortSaleCircuitBreaker(); Console.WriteLine("myShortSaleCircuitBreaker: " + myShortSaleCircuitBreaker); }
public void onQuoteUpdate( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteUpdate update, MamdaQuoteRecap recap) { // Do something with a specific quote. myDisplay.printlnContract(myContract); }
public void onQuoteGap( MamdaSubscription subscription, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteGap gap, MamdaQuoteRecap recap) { Console.WriteLine("Quote gap ({0}-{1})", gap.getBeginGapSeqNum(), gap.getEndGapSeqNum()); }
public void onQuoteRecap( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteRecap recap) { // Refresh the "display" of this contract. if (myView.isVisible(myContract)) { myDisplay.printContract(myContract); } }
/* End Field State Accessors */ private void handleQuoteMsg( MamdaOptionContract contract, MamdaSubscription subscription, MamaMsg msg, mamaMsgType msgType) { MamdaQuoteListener quoteListener = contract.getQuoteListener(); if (quoteListener != null) { quoteListener.onMsg(subscription, msg, msgType); } }
public void onConsolidatedCreate( MamdaSubscription subscription, MamdaMultiParticipantManager manager) { MamdaTradeListener aTradeListener = new MamdaTradeListener(); MamdaQuoteListener aQuoteListener = new MamdaQuoteListener(); ComboTicker aTicker = new ComboTicker(); aTradeListener.addHandler(aTicker); aQuoteListener.addHandler(aTicker); manager.addConsolidatedListener(aTradeListener); manager.addConsolidatedListener(aQuoteListener); }
public void onSecurityCreate( MamdaSubscription subscription, MamdaMultiSecurityManager manager, string symbol) { MamdaTradeListener aTradeListener = new MamdaTradeListener(); MamdaQuoteListener aQuoteListener = new MamdaQuoteListener(); ComboTicker aTicker = new ComboTicker(); aTradeListener.addHandler(aTicker); aQuoteListener.addHandler(aTicker); manager.addListener(aTradeListener, symbol); manager.addListener(aQuoteListener, symbol); }
public void onParticipantCreate( MamdaSubscription subscription, MamdaMultiParticipantManager manager, string participantId, NullableBool isPrimary) { MamdaTradeListener aTradeListener = new MamdaTradeListener(); MamdaQuoteListener aQuoteListener = new MamdaQuoteListener(); ComboTicker aTicker = new ComboTicker(); aTradeListener.addHandler(aTicker); aQuoteListener.addHandler(aTicker); manager.addParticipantListener(aTradeListener, participantId); manager.addParticipantListener(aQuoteListener, participantId); }
public void onQuoteUpdate( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteUpdate update, MamdaQuoteRecap recap) { Console.WriteLine("Quote (" + msg.getString (MamdaCommonFields.ISSUE_SYMBOL) + ":" + recap.getQuoteCount() + "): " + update.getBidPrice() + " " + update.getBidSize() + " X " + update.getAskSize() + " " + update.getAskPrice() + " (seq#: " + update.getEventSeqNum() + "; time: " + update.getEventTime() + "; qual: " + update.getQuoteQual() + ")"); }
public void onQuoteUpdate( MamdaSubscription subscription, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteUpdate update, MamdaQuoteRecap recap) { string format = "Quote ({0}:{1}): {2} {3} X {4} {5} (seq#: {6}; time: {7}; qual: {8})"; Console.WriteLine(format, subscription.getSymbol(), recap.getQuoteCount(), update.getBidPrice(), update.getBidSize(), update.getAskSize(), update.getAskPrice(), update.getEventSeqNum(), update.getEventTime(), update.getQuoteQual()); }
public void onQuoteUpdate( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteUpdate quote, MamdaQuoteRecap recap) { Console.WriteLine( "Underlying quote: " + quote.getBidSize() + "x" + quote.getBidPrice() + " " + quote.getAskPrice() + "x" + quote.getAskSize() + " " + "mid=" + recap.getQuoteMidPrice()); if (myPrintStrikes) { double lowStrike = -1.0; double highStrike = -1.0; Console.WriteLine( " strikes within 15%: " + lowStrike + " " + highStrike); } }
public void onQuoteClosing( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteClosing quoteClosing, MamdaQuoteRecap recap) { }
/// <summary> /// Set the underlying quote listener information. /// MamdaOptionChain does not use this class itself, but related /// classes might (e.g., MamdaOptionChainView). /// </summary> /// <param name="quoteListener">The quote listener for the chain.</param> public void setUnderlyingQuoteListener(MamdaQuoteListener quoteListener) { mQuoteListener = quoteListener; }
public static void Main(string[] args) { MamaTransport transport = null; MamaQueue defaultQueue = null; MamaDictionary dictionary = null; CommandLineProcessor options = new CommandLineProcessor(args); myQuietModeLevel = options.getQuietModeLevel(); if (options.hasLogLevel()) { Mama.enableLogging(options.getLogLevel()); } try { // Initialize MAMDA myBridge = new MamaBridge(options.getMiddleware()); Mama.open(); transport = new MamaTransport(); transport.create(options.getTransport(), myBridge); defaultQueue = Mama.getDefaultEventQueue(myBridge); /*Get the data dictionary*/ MamaSource dictionarySource = new MamaSource(); dictionarySource.symbolNamespace = "WOMBAT"; dictionarySource.transport = transport; dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource); MamdaQuoteFields.setDictionary(dictionary, null); mamdaSubscriptions = new MamdaSubscription [options.getSymbolList().Count]; int i=0; foreach (string symbol in options.getSymbolList()) { mamdaSubscriptions[i] = new MamdaSubscription(); MamdaQuoteListener aQuoteListener = new MamdaQuoteListener(); QuoteTicker aTicker = new QuoteTicker(); aQuoteListener.addHandler(aTicker); mamdaSubscriptions[i].addMsgListener(aQuoteListener); mamdaSubscriptions[i].addStaleListener(aTicker); mamdaSubscriptions[i].addErrorListener(aTicker); mamdaSubscriptions[i].create(transport, defaultQueue, options.getSource (), symbol, null); i++; } Console.WriteLine("Hit Enter or Ctrl-C to exit."); Mama.start(myBridge); GC.KeepAlive(dictionary); Console.ReadLine(); } catch (Exception e) { Console.Error.WriteLine(e.ToString()); Environment.Exit(1); } }
public static void Main(string[] args) { MamaTransport transport = null; MamaQueue defaultQueue = null; MamaDictionary dictionary = null; CommandLineProcessor options = new CommandLineProcessor(args); myQuietModeLevel = options.getQuietModeLevel(); if (options.hasLogLevel()) { Mama.enableLogging(options.getLogLevel()); } try { // Initialize MAMDA myBridge = new MamaBridge(options.getMiddleware()); Mama.open(); transport = new MamaTransport(); transport.create(options.getTransport(), myBridge); defaultQueue = Mama.getDefaultEventQueue(myBridge); /*Get the data dictionary*/ MamaSource dictionarySource = new MamaSource(); dictionarySource.symbolNamespace = "WOMBAT"; dictionarySource.transport = transport; dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource); MamdaQuoteFields.setDictionary(dictionary, null); mamdaSubscriptions = new MamdaSubscription [options.getSymbolList().Count]; int i = 0; foreach (string symbol in options.getSymbolList()) { mamdaSubscriptions[i] = new MamdaSubscription(); MamdaQuoteListener aQuoteListener = new MamdaQuoteListener(); QuoteTicker aTicker = new QuoteTicker(); aQuoteListener.addHandler(aTicker); mamdaSubscriptions[i].addMsgListener(aQuoteListener); mamdaSubscriptions[i].addStaleListener(aTicker); mamdaSubscriptions[i].addErrorListener(aTicker); mamdaSubscriptions[i].create(transport, defaultQueue, options.getSource(), symbol, null); i++; } Console.WriteLine("Hit Enter or Ctrl-C to exit."); Mama.start(myBridge); GC.KeepAlive(dictionary); Console.ReadLine(); } catch (Exception e) { Console.Error.WriteLine(e.ToString()); Environment.Exit(1); } }
public void onQuoteGap( MamdaSubscription sub, MamdaQuoteListener listener, MamaMsg msg, MamdaQuoteGap gap, MamdaQuoteRecap recap) { }
public static void Main(string[] args) { MamaTransport baseTransport = null; MamaTransport optionTransport = null; MamaTransport dictTransport = null; string dictTransportName = null; MamaQueue defaultQueue = null; MamaDictionary dictionary = null; CommandLineProcessor options = new CommandLineProcessor(args); if (options.hasLogLevel()) { logLevel_ = options.getLogLevel(); Mama.enableLogging(logLevel_); } try { // Initialize MAMA myBridge = new MamaBridge(options.getMiddleware()); Mama.open(); // Initialize transports. We're assuming that options and // underlyings might be on different transports. Note: // some companies might use multiple transports for // underlyings (e.g., CTA and NASDAQ), which case it would // be necessary to create three transports here and be // sure to pass the correct transport later. baseTransport = new MamaTransport(); baseTransport.create(options.getTransport(), myBridge); optionTransport = baseTransport; defaultQueue = Mama.getDefaultEventQueue(myBridge); // Fetch and initialize the data dictionary MamaSource dictionarySource = new MamaSource(); dictionarySource.symbolNamespace = options.getDictSource(); dictTransportName = options.getDictTransport(); if (null != dictTransportName) { dictTransport = new MamaTransport(); dictTransport.create(dictTransportName, myBridge); } else { dictTransport = baseTransport; } dictionarySource.transport = dictTransport; dictionary = buildDataDictionary(dictTransport, defaultQueue, dictionarySource); MamdaQuoteFields.setDictionary(dictionary, null); MamdaTradeFields.setDictionary(dictionary, null); MamdaFundamentalFields.setDictionary(dictionary, null); MamdaOptionFields.setDictionary(dictionary, null); // Create listeners for each chain. Two subscriptions are // necessary. foreach (string symbol in options.getSymbolList()) { // Create chain and listener objects. MamdaTradeListener aBaseTradeListener = new MamdaTradeListener(); MamdaQuoteListener aBaseQuoteListener = new MamdaQuoteListener(); MamdaOptionChain anOptionChain = new MamdaOptionChain(symbol); anOptionChain.setUnderlyingQuoteListener(aBaseQuoteListener); anOptionChain.setUnderlyingTradeListener(aBaseTradeListener); MamdaOptionChainListener anOptionListener = new MamdaOptionChainListener(anOptionChain); // Create our handlers (the UnderlyingTicker and // OptionChainDisplay could be a single class). UnderlyingTicker aBaseTicker = new UnderlyingTicker(anOptionChain, true); OptionChainDisplay aDisplay = new OptionChainDisplay(anOptionChain); // Create subscriptions for underlying and option chain: MamdaSubscription aBaseSubscription = new MamdaSubscription(); MamdaSubscription anOptionSubscription = new MamdaSubscription(); // Register for underlying quote and trade events. aBaseTradeListener.addHandler(aBaseTicker); aBaseQuoteListener.addHandler(aBaseTicker); aBaseSubscription.addMsgListener(aBaseTradeListener); aBaseSubscription.addMsgListener(aBaseQuoteListener); aBaseSubscription.create( baseTransport, defaultQueue, options.getSource(), symbol, null); mamdaSubscriptions.Add(aBaseSubscription); // Register for underlying option events. anOptionListener.addHandler(aDisplay); // We set the timeout to 1 for this example because we // currently use the timeout feature to determine when // to say that we have received all of the initials. // There will be a separate time interval for this in // the future. anOptionSubscription.setTimeout(1); anOptionSubscription.addMsgListener(anOptionListener); anOptionSubscription.addStaleListener(aDisplay); anOptionSubscription.addErrorListener(aDisplay); anOptionSubscription.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_GROUP); anOptionSubscription.create( optionTransport, defaultQueue, options.getSource(), symbol, null); optionSubscriptions.Add(anOptionSubscription); } //Start dispatching on the default event queue Mama.start(myBridge); GC.KeepAlive(dictionary); Console.WriteLine("Press ENTER or Ctrl-C to quit..."); Console.ReadLine(); } catch (Exception e) { Console.WriteLine(e.ToString()); Environment.Exit(1); } }