Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions administrator/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Wed Sep 20 23:33:32 AEST 2023
VERSION_BUILD=786
#Thu Sep 21 12:39:55 AEST 2023
VERSION_BUILD=802
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.alignmentsystems.library.AlignmentLogEncapsulation;
import com.alignmentsystems.library.AlignmentOrder;
import com.alignmentsystems.library.AlignmentPersistenceToFileClient;
import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.constants.Constants;
import com.alignmentsystems.library.enumerations.Encodings;
import com.alignmentsystems.library.enumerations.InstanceType;
Expand Down Expand Up @@ -329,7 +330,7 @@ public void onMessage(com.alignmentsystems.fix44.NewOrderSingle message, Session

try {
debugger.debug("Sending order to Kafka...");
AlignmentKafkaSender sender = ao.getBytesAsSBEInSender();
AlignmentKafkaSender sender = ao.getBytesForMemberAsSBEInSender();
this.send(sender);

log.infoFIXSession(sb.toString(), sessionID, MessageDirection.RECEIVED, METHOD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.alignmentsystems.library.AlignmentFunctions;
import com.alignmentsystems.library.AlignmentLogEncapsulation;
import com.alignmentsystems.library.AlignmentPersistenceToFileClient;
import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.enumerations.InstanceType;
import com.alignmentsystems.library.interfaces.InterfaceKafkaAbstractSimple;
import com.alignmentsystems.library.interfaces.InterfaceKafkaMessageHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import com.alignmentsystems.library.AlignmentKafkaSender;
import com.alignmentsystems.library.AlignmentLogEncapsulation;
import com.alignmentsystems.library.AlignmentPersistenceToFileClient;
import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.enumerations.InstanceType;
import com.alignmentsystems.library.interfaces.InterfaceKafkaProducer;
import com.alignmentsystems.library.interfaces.InterfaceOrderSender;
import com.alignmentsystems.matching.AlignmentUEH;

public class AlignmentFIXEngineKafkaProducer implements InterfaceKafkaProducer, Runnable , InterfaceOrderSender {
public final static String CLASSNAME = AlignmentFIXEngineKafkaProducer.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.alignmentsystems.library.AlignmentKafkaSender;
import com.alignmentsystems.library.AlignmentFunctions;
import com.alignmentsystems.library.AlignmentLogEncapsulation;
import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.constants.Constants;
import com.alignmentsystems.library.enumerations.InstanceType;
import com.alignmentsystems.library.interfaces.InterfaceFIXToBinaryProcessor;
Expand Down Expand Up @@ -80,7 +81,7 @@ public void run() {

if (inSeq != null) {

AlignmentKafkaSender sender = inSeq.getBytesAsSBEInSender();
AlignmentKafkaSender sender = inSeq.getBytesForMemberAsSBEInSender();
this.send(sender.getTopic(), sender.getKey(), sender.getBinaryMessage());
sender = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
import com.alignmentsystems.library.AlignmentFunctions;
import com.alignmentsystems.library.AlignmentLogEncapsulation;
import com.alignmentsystems.library.AlignmentPersistenceToFileClient;
import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.constants.Constants;
import com.alignmentsystems.library.constants.FailureConditionConstants;
import com.alignmentsystems.library.constants.KafkaMessageTopology;
import com.alignmentsystems.library.enumerations.InstanceType;
import com.alignmentsystems.library.interfaces.InterfaceInstanceWrapper;

Expand Down Expand Up @@ -132,11 +135,12 @@ private Boolean initialiseOrderBook(InstanceType instanceType) {

private Boolean initialiseFIXMessagingInfrastructure(InstanceType instanceType) {
final String METHOD = "initialiseFIXMessagingInfrastructure";
final String ID = CLASSNAME + Constants.FULLSTOP + METHOD;

AlignmentPersistenceToFileClient debugger = new AlignmentPersistenceToFileClient();
try {
debugger.initialise(this.getClass().getClassLoader() , InstanceType.FIXMESSAGINGINFRA.getProperties());
debugger.info(CLASSNAME + "." + METHOD);
debugger.info(ID);
} catch (IllegalThreadStateException | IOException e) {
log.error(e.getMessage(), e);
return false;
Expand All @@ -161,13 +165,13 @@ private Boolean initialiseFIXMessagingInfrastructure(InstanceType instanceType)
if (names.isEmpty())
{
// case: if no topic found.
log.error("No Topics Found");
log.error(ID + ":No Topics Found");
return false;
}
}
catch (Exception e){
// Kafka is not available
log.error("Kafka is not available".toUpperCase());
log.error(ID + ":Kafka is not available".toUpperCase());
log.error(e.getMessage() , e);
System.err.println(e.getMessage());
System.exit(FailureConditionConstants.KAFKA_NOT_RUNNING);
Expand Down Expand Up @@ -234,7 +238,7 @@ private Boolean initialiseFIXMessagingInfrastructure(InstanceType instanceType)


try {
debugger.debug("Start threads");
debugger.debug(ID + ":Start threads...");
Thread.currentThread().setName(instanceType.type );

threadFixToBinaryProcessor.start();
Expand All @@ -251,7 +255,7 @@ private Boolean initialiseFIXMessagingInfrastructure(InstanceType instanceType)

AlignmentFIXEngineExchange engineExchange = new AlignmentFIXEngineExchange();
try {
debugger.debug("Initialise FIX engine");
debugger.debug(ID + ":Initialise FIX engine");
engineExchange.initialise(log , debugger , instanceType );
engines.add(engineExchange);
} catch (FileNotFoundException | NullPointerException e) {
Expand All @@ -262,24 +266,24 @@ private Boolean initialiseFIXMessagingInfrastructure(InstanceType instanceType)
final String[] acceptors = { InstanceType.EXCHANGEFIXACCEPTOR.getProperties() };


debugger.debug("get" + acceptors[0]);
debugger.debug(ID + ":Get" + acceptors[0]);


Acceptor exchange = null;

try {
debugger.debug("Request start FIX engine");
debugger.debug(ID + ":Request start FIX engine");
exchange = getExchangeEnvironment(acceptors[0], engineExchange);
exchange.start();
debugger.debug("Requested start FIX engine");
debugger.debug(ID + ":Requested start FIX engine");
} catch (NullPointerException | RuntimeError | ConfigError e) {
log.error(e.getMessage(), e);
System.err.println(e.getMessage());
System.exit(FailureConditionConstants.ERROR_EXCHANGE_FIX_PROPERTIES_FILE);
}


debugger.debug("Request list threads");
debugger.debug(ID + ":Request list threads");
Set<Thread> threadSet = Thread.getAllStackTraces().keySet();


Expand All @@ -288,13 +292,12 @@ private Boolean initialiseFIXMessagingInfrastructure(InstanceType instanceType)
AlignmentFunctions.threadStatusCheck(namesIterator.next(), debugger);
}

final List<String> messagesToBeReceivedByFIXEngine = List.of("fill","ack","rej");



try {
debugger.debug("Start KafkaConsumer");
fixEngineKafkaConsumer.runAlways(messagesToBeReceivedByFIXEngine, engineExchange);
debugger.debug("Started KafkaConsumer");
debugger.debug(ID + ":Start KafkaConsumer");
fixEngineKafkaConsumer.runAlways(KafkaMessageTopology.MESSAGESTOBERECEIVEDBYEXCHANGEFIXENGINEFROMMATCHINGENGINE, engineExchange);
debugger.debug(ID + ":Started KafkaConsumer");
} catch (Exception e) {
log.error(e.getMessage(), e);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,11 @@ public String getThisOrderBookSymbol() {

@NotYetImplemented
private boolean cancelOrder(InterfaceOrder nos) {
// TODO Auto-generated method stub
return false;
}

@NotYetImplemented
private boolean cancelOrder(String orderId) {
// TODO Auto-generated method stub
return false;
}

Expand Down Expand Up @@ -203,6 +201,8 @@ private void runMatch() {
case BUY:
tradedPrice = Math.min(topOfBuyBookPrice, topOfSellBookPrice);
break;
default:
break;
}
OffsetDateTime executionTimestamp = OffsetDateTime.now(Constants.HERE);

Expand Down Expand Up @@ -255,15 +255,11 @@ private void runMatch() {
@NotYetImplemented
@Override
public void upsertTopOfBook(InterfaceOrder nos) {
// TODO Auto-generated method stub

}

@NotYetImplemented
@Override
public void updateLevelsOfDepth() {
// TODO Auto-generated method stub

}

@Override
Expand Down Expand Up @@ -321,7 +317,6 @@ public int getOrderCountBySide(OrderBookSide orderBookSide) {
@Override
@NotYetImplemented
public List<String> getOrderBookVisualisation() {
// TODO Auto-generated method stub
return null;
}

Expand All @@ -343,7 +338,6 @@ public void matchHappened(InterfaceMatch match) {

@Override
public void processMessage(String topicName, ConsumerRecord<String, byte[]> message) throws Exception {
// TODO Auto-generated method stub

InterfaceOrder io = new AlignmentOrder();
io.getAlignmentOrderFromBuffer(message.value());
Expand Down Expand Up @@ -390,6 +384,7 @@ private static InterfaceExecutionReport getExecutionReportAcknowledgementForOrd
null
, nos.getClOrdID()
, nos.getOrderId()
, null
, nos.getSender()
, nos.getTarget()
, null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ public AlignmentOrderBookKafkaConsumer() throws Exception {
public boolean initialise(AlignmentLogEncapsulation log, AlignmentPersistenceToFileClient debugger) throws FileNotFoundException , NullPointerException{
final String METHOD = "initialise";


this.log = log;
this.debugger = debugger;

log.info(CLASSNAME + "." + METHOD);
this.debugger.info(CLASSNAME + "." + METHOD);


try {
Expand All @@ -69,6 +68,7 @@ public boolean initialise(AlignmentLogEncapsulation log, AlignmentPersistenceToF
return Boolean.TRUE;

}

public void setKafkaConsumer(KafkaConsumer<String, byte[]> kafkaConsumer) {
this.kafkaConsumer = kafkaConsumer;
}
Expand Down Expand Up @@ -186,8 +186,6 @@ public void runAlways(List<String> topicNames, InterfaceKafkaMessageHandler call
// Ignore exception if closing
if (!closed.get())
throw e;
}

}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.alignmentsystems.library.AlignmentFunctions;
import com.alignmentsystems.library.AlignmentLogEncapsulation;
import com.alignmentsystems.library.AlignmentPersistenceToFileClient;
import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.constants.KafkaMessageTopology;
import com.alignmentsystems.library.enumerations.InstanceType;
import com.alignmentsystems.library.enumerations.OperationEventType;
import com.alignmentsystems.library.interfaces.InterfaceAddedOrderToOrderBook;
Expand All @@ -33,6 +35,7 @@
import com.alignmentsystems.library.interfaces.InterfaceOrderBookEvents;

public class AlignmentOrderBookKafkaProducer implements InterfaceKafkaProducer, InterfaceMatchEvent, InterfaceAddedOrderToOrderBook, InterfaceOrderBookEvents, Runnable {
public final static String CLASSNAME = AlignmentOrderBookKafkaProducer.class.getSimpleName();
private KafkaProducer<String, byte[]> kafkaProducerB = null;
private AlignmentLogEncapsulation log = null;
private AlignmentPersistenceToFileClient debugger = null;
Expand Down Expand Up @@ -90,50 +93,55 @@ public void run() {
public void matchHappened(InterfaceMatch match) {
@SuppressWarnings("unused")
final String methodName = "matchHappened";
final String TOPIC = "FILL";

log.infoMatchingEvent(OperationEventType.MATCHEVENT, match);

AlignmentKafkaSender senderBuy = match.getBuyReport().getSenderForTopic(TOPIC);
AlignmentKafkaSender senderSell = match.getSellReport().getSenderForTopic(TOPIC);

AlignmentKafkaSender senderBuy = match.getBuyReport().getMemberExecRptAsSBEInSender();
AlignmentKafkaSender senderSell = match.getSellReport().getMemberExecRptAsSBEInSender();
AlignmentKafkaSender marketDataOut = match.getMarketDataBytesAsSBEInSender();

this.send(senderBuy.getTopic() , senderBuy.getKey(), senderBuy.getBinaryMessage());
this.send(senderSell.getTopic() , senderSell.getKey(), senderSell.getBinaryMessage());
this.send(marketDataOut.getTopic(), marketDataOut.getKey(), marketDataOut.getBinaryMessage());


}

@Override
public void addedOrderToOrderBook(InterfaceExecutionReport er) {
@SuppressWarnings("unused")
final String methodName = "addedOrderToOrderBook";
final String TOPIC = "ACK";

//log.infoMatchingEvent(OperationEventType.NEWORDEREVENT, er);
AlignmentKafkaSender senderAck= er.getSenderForTopic(TOPIC);
log.infoMatchingEvent(OperationEventType.NEWORDEREVENT, er);
AlignmentKafkaSender senderAck= er.getMemberExecRptAsSBEInSender();

this.send(senderAck.getTopic(), senderAck.getKey(), senderAck.getBinaryMessage());
}

@Override
public boolean initialise(AlignmentLogEncapsulation log, AlignmentPersistenceToFileClient debugger)
throws FileNotFoundException, NullPointerException {
public boolean initialise(AlignmentLogEncapsulation log, AlignmentPersistenceToFileClient debugger) throws FileNotFoundException, NullPointerException {
final String METHOD = "initialise";

this.log = log;
this.debugger = debugger;

AlignmentUEH ueh = new AlignmentUEH(this.debugger);

Thread.setDefaultUncaughtExceptionHandler(ueh);


debugger.info(CLASSNAME + "." + METHOD);


if (this.kafkaProducerB == null) {
Properties props;
try {
props = AlignmentFunctions.getProperties(AlignmentFIXToBinaryProcessor.class.getClassLoader(), InstanceType.KAFKA.getProperties());
props = AlignmentFunctions.getProperties(AlignmentOrderBookKafkaProducer.class.getClassLoader(), InstanceType.KAFKA.getProperties());
} catch (FileNotFoundException | NullPointerException e) {
this.log.error(e.getMessage() , e);
throw e;
}
this.kafkaProducerB = new KafkaProducer<>(props);
}
return true;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.concurrent.atomic.AtomicBoolean;

import com.alignmentsystems.library.AlignmentLogEncapsulation;
import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.constants.Constants;
import com.alignmentsystems.library.interfaces.InterfaceOrder;
import com.alignmentsystems.library.interfaces.InterfaceQueueNonSequenced;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;

import com.alignmentsystems.library.AlignmentUEH;
import com.alignmentsystems.library.constants.Constants;
import com.alignmentsystems.library.interfaces.InterfaceOrder;
import com.alignmentsystems.library.interfaces.InterfaceQueueSequencedDeduplicated;
Expand Down
4 changes: 2 additions & 2 deletions exchange/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Wed Sep 20 23:33:32 AEST 2023
VERSION_BUILD=784
#Thu Sep 21 12:39:56 AEST 2023
VERSION_BUILD=800
4 changes: 2 additions & 2 deletions fixclient/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Wed Sep 20 23:33:32 AEST 2023
VERSION_BUILD=786
#Thu Sep 21 12:39:56 AEST 2023
VERSION_BUILD=802
Loading