private static void fetchLotSizeStep(String apiKey) throws Exception {
SessionSettings settings = new SessionSettings("fix-config.cfg");
Application application = new FIXApplication();
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new ScreenLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
Initiator initiator = new SocketInitiator(application, storeFactory, settings, logFactory, messageFactory);
try {
initiator.start();
if (!Session.lookupSession(settings).isLoggedOn()) {
throw new RuntimeException("FIX session not logged in");
}
SecurityDefinitionRequest request = new SecurityDefinitionRequest();
request.set(new SecurityReqID("1"));
request.set(new SecurityRequestType(SecurityRequestType.SYMBOL));
request.set(new Symbol(SYMBOL));
Session.sendToTarget(request, settings);
application.waitForResponse();
SecurityDefinition response = application.getSecurityDefinition();
Group lotSizeFilter = response.getGroup(1, NoLotTypeRules.FIELD);
for (int i = 1; i <= lotSizeFilter.size(); i++) {
if (lotSizeFilter.getFieldTag(i) == MinLotSize.FIELD) {
lotSizeStep = lotSizeFilter.getDouble(MinLotSize.FIELD);
break;
}
}
} catch (Exception e) {
throw new RuntimeException("Error using FIX API to fetch LOT_SIZE step", e);
} finally {
initiator.stop();
}
}
this is my attempt to use FIX api to make this method work the same as it did while using the REST api or in short with the same functionality and i have errors here where it is not working, i think there is something wrong here but i dont know where so pls help quickly
Please do not double post. Thank you.