simple script error

1 message Options
Embed this post
Permalink
xingguochen

simple script error

Reply Threaded More More options
Print post
Permalink
I installed Marketcetera 0.05 with window-installer version. After changed senderID, I can get market quote using FIX.4.4://exchange.marketcetera.com:7004 but it seems the quote is not right at all. I tried simple photon script but I got error message ( please see below). Is anything I missed.?

Thanks

-- Greg

require 'java'

#Marketcetera Classes
module Marketcetera
  include_class "org.marketcetera.photon.scripting.Strategy"
end

#Quick Fix Classes
module QF
  include_class "quickfix.Message"
  include_class "quickfix.field.MDEntryPx"
  include_class "quickfix.field.MDEntryType"
  include_class "quickfix.field.Symbol"
end

# the maximum width that is interesting to the user
WIDTH_SPREAD = 0.1

# each object that is interested in receiving market data
# must be a class that implements on_message(message)
class SimpleStrategy < Marketcetera::Strategy
  def on_market_data_snapshot(message)
    symbol = message.getString(QF::Symbol::FIELD)
    bid = BigDecimal.new(extractMD(message, QF::MDEntryType::BID, QF::MDEntryPx::FIELD).to_s)
    ask = BigDecimal.new(extractMD(message, QF::MDEntryType::OFFER, QF::MDEntryPx::FIELD).to_s)
    if((ask-bid) < WIDTH_SPREAD)
      puts "Market below minimum width #{WIDTH_SPREAD}: #{symbol} [#{bid} - #{ask}] at "+Time.now.to_s
    end
  end
end



11:01:02,997 ERROR - uninitialized constant Photon::MarketWith
11:01:02,997 ERROR - from (eval):2:in `new_instance'
        from <script>:1:in `eval'
        from C:/work/Marketcetera/photon/configuration/org.eclipse.osgi/bundles/74/1/.cp/src/main/resources/photon.rb:12:in `new_instance'
        from <script>:1

11:01:02,997 ERROR - Error registering script market_with.rb
11:01:02,997 ERROR - uninitialized constant Photon::MarketWith
11:01:03,012 ERROR - from (eval):2:in `new_instance'
        from <script>:1:in `eval'
        from C:/work/Marketcetera/photon/configuration/org.eclipse.osgi/bundles/74/1/.cp/src/main/resources/photon.rb:12:in `new_instance'
        from <script>:1

11:01:03,012 ERROR - Unregistering script market_with.rb due to the previous error
11:01:04,606 ERROR - uninitialized constant Photon::MarketWith
11:01:04,606 ERROR - from (eval):2:in `new_instance'
        from <script>:1:in `eval'
        from C:/work/Marketcetera/photon/configuration/org.eclipse.osgi/bundles/74/1/.cp/src/main/resources/photon.rb:12:in `new_instance'
        from <script>:1

11:01:04,606 ERROR - Error registering script market_with.rb
11:01:04,606 ERROR - uninitialized constant Photon::MarketWith
11:01:04,606 ERROR - from (eval):2:in `new_instance'
        from <script>:1:in `eval'
        from C:/work/Marketcetera/photon/configuration/org.eclipse.osgi/bundles/74/1/.cp/src/main/resources/photon.rb:12:in `new_instance'
        from <script>:1

11:01:04,622 ERROR - Unregistering script market_with.rb due to the previous error