preloader
blog-post

Order FIX API Class Basic Components

author image

These are the basic components for FIX API Order class.

It includes:

  • Member variables
private boolean resetReq;

private String userName;
private String userPassword;
private String accountId;

private SessionID sessionID;

resetReq is used to configure whether to reset sequence number once reconnected.

  • Construction method
public Order(SessionSettings settings, boolean resetReq) {
  this.resetReq = resetReq;

  try {
    userName = settings.getString("Username");
    userPassword = settings.getString("Password");
    accountId = settings.getString("AccountId");

  } catch (Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage());
  }
}
  • Callback to receive administrative message, and then do some extra validations
public void fromAdmin(Message message, SessionID sessionID) {
  try {
    crack(message, sessionID);
  } catch (Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage());
  }
}
  • Callback to receive application-level message, and then do some extra validations
public void fromApp(Message message, SessionID sessionID) {
  try {
    crack(message, sessionID);
  } catch (Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage());
  }
}
  • Callback to add some extra tag fields before sending an administrative message
public void toAdmin(Message message, SessionID sessionID) {
  try {
    if (message instanceof Logon) {
      logger.info("Order via toAdmin login begun for " + this.userName);

      message.setString(Username.FIELD, userName);
      message.setString(Password.FIELD, userPassword);
      if (resetReq) {
        message.setBoolean(ResetSeqNumFlag.FIELD, ResetSeqNumFlag.YES_RESET_SEQUENCE_NUMBERS);
      }
      message.setInt(EncryptMethod.FIELD, EncryptMethod.NONE_OTHER);
    } else if (message instanceof Logout) {
      logger.info("Order logged out via toAdmin " + this.userName);
    }
  } catch (Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage());
  }
}
  • Callback to add some extra tag fields before sending an application-level message
public void toApp(Message message, SessionID sessionID) {
}
  • Callback to notify you when a new session is established
public void onCreate(SessionID sessionID) {
  this.sessionID = sessionID;
}
  • Interface for the client side to logout the current session
public void logout() {
  Logout mdr = new Logout();
  send(mdr);
}
  • Callback to notify you when a new valid logon is established
public void onLogon(SessionID sessionID) {
  logger.warn("Order via onLogon login begun" + (userName == null ? "" : " for " + userName) );
}
  • Callback to notify you when a new valid logout is established
public void onLogout(SessionID sessionID) {
  logger.warn("Order logged out via onLogout" + (userName == null ? "" : " for " + userName) );
}
  • Method to send request messages via the FIX API data session
private void send(Message message) {
  try {
    Session.sendToTarget(message, sessionID);
  } catch (Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage());
  }
}

Relevant Articles

Fintechee Online FIX API Parser

The received messages will output to the “orderlog” 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.

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
*