preloader
blog-post

DATA FIX API ~ Market Data Snapshot Full Refresh

author image

This is a callback function to receive streaming quote messages once the market movements change.

It can be triggered after a subscription request message for the streaming quotes is sent.

Usually, it’s a notification when a message describing the full refresh(the market data’ updates) arrives.

The message type (MsgType, Tag ID: 35) is “W”. Actually, this tag field is encapsulated, only useful when you check the log file.

We will get these tag fields from the message:

  • Sending Time (SendingTime, Tag ID: 52)
SendingTime sendingTime = new SendingTime();
((Message) snapshot).getHeader().getField(sendingTime);
LocalDateTime localDateTime = sendingTime.getValue();
long time = localDateTime.toEpochSecond(ZoneOffset.UTC);
  • Instrument Name (Symbol, Tag ID: 55)
String symbolName = null;

quickfix.field.Symbol symbol = new quickfix.field.Symbol();
snapshot.get(symbol);

symbolName = symbol.getValue();
  • Group of Market Data Full Refresh (NoMDEntries, Tag ID: 268)

It just has one symbol’s quote. So, in this group field, there is only one element.

NoMDEntries noMDEntries = new NoMDEntries();
snapshot.get(noMDEntries);

MarketDataSnapshotFullRefresh.NoMDEntries types = new MarketDataSnapshotFullRefresh.NoMDEntries();
snapshot.getGroup(1, types);

// ...
  • Market Data Entry Type (MDEntryType, Tag ID: 269)

This is an enumeration variable to describe that the tick quote stands for Ask(Offer) or Bid.

  • Market Data Entry Price (MDEntryPx, Tag ID: 270)

This variable stands for the current tick quote.

MDEntryType mdEntryType = new MDEntryType();
MDEntryPx mdEntryPx = new MDEntryPx();

types.get(mdEntryType);

double bid = 0.0;
if (mdEntryType.getValue() == MDEntryType.BID) {
  types.get(mdEntryPx);
  bid = mdEntryPx.getValue();
}

double ask = 0.0;
if (mdEntryType.getValue() == MDEntryType.OFFER) {
  types.get(mdEntryPx);
  ask = mdEntryPx.getValue();
}

Difference from MarketDataIncrementalRefresh

MarketDataIncrementalRefresh is a message including all the updates of multiple symbols.

MarketDataSnapshotFullRefresh is a message to receive one symbol’s quotes(including the bid price and the ask price).

Relevant Articles

Fintechee Online FIX API Parser

The received messages will output to the “datalog” folder.

If you want to parse them, please use Fintechee Online FIX Parser.

Fintechee FIX API Trading Platform Individual Version

If you want to trade via FIX API, please use Fintechee FIX API Trading Platform Individual Version(Paid Version).

If you have a Github / Youtube account, you can get a free license for the paid version(No Charge)!

If you have no Github / Youtube account, you can still use Fintechee FIX API Trading Platform Bridge Version(Free Forever)!

If you are working for financial institutions, you can choose Fintechee FIX API Trading Platform Institution Version(White Label License).

Github Repository

Please access our Github repository to get the latest source codes.

The Entire Source Codes to MarketDataSnapshotFullRefresh

public void onMessage(MarketDataSnapshotFullRefresh snapshot, SessionID sessionID) {
  try {
    SendingTime sendingTime = new SendingTime();
    ((Message) snapshot).getHeader().getField(sendingTime);
    LocalDateTime localDateTime = sendingTime.getValue();
    long time = localDateTime.toEpochSecond(ZoneOffset.UTC);

    String symbolName = null;

    quickfix.field.Symbol symbol = new quickfix.field.Symbol();
    snapshot.get(symbol);

    symbolName = symbol.getValue();

    NoMDEntries noMDEntries = new NoMDEntries();
    snapshot.get(noMDEntries);

    MarketDataSnapshotFullRefresh.NoMDEntries types = new MarketDataSnapshotFullRefresh.NoMDEntries();
    MDEntryType mdEntryType = new MDEntryType();
    MDEntryPx mdEntryPx = new MDEntryPx();

    snapshot.getGroup(1, types);
    types.get(mdEntryType);

    double bid = 0.0;
    if (mdEntryType.getValue() == MDEntryType.BID) {
      types.get(mdEntryPx);
      bid = mdEntryPx.getValue();
    }

    snapshot.getGroup(2, types);
    types.get(mdEntryType);

    double ask = 0.0;
    if (mdEntryType.getValue() == MDEntryType.OFFER) {
      types.get(mdEntryPx);
      ask = mdEntryPx.getValue();
    }

    System.out.println(time + " " + symbolName + ": Ask " + ask + ", Bid " + bid);
  } catch (Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage());
  }
}

Recent Articles

blog-post

FIX API Starter Application Class

This is the FIX API Starter Application Class. It includes: A method to be called to start FIX API Data session A method …

Paid Consulting Service

We offer professional FIX API consulting services, including self-service options for establishing a broker business. There are no additional fees, and all resources can be utilized without any associated costs.

Book One
*