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 @@
#Mon Sep 18 19:15:13 AEST 2023
VERSION_BUILD=704
#Mon Sep 18 20:08:14 AEST 2023
VERSION_BUILD=711
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.alignmentsystems.library.interfaces.InterfaceMatchEvent;
import com.alignmentsystems.library.interfaces.InterfaceOrder;
import com.alignmentsystems.library.interfaces.InterfaceOrderBook;
import com.alignmentsystems.library.interfaces.InterfaceOrderBookEvents;

import quickfix.FieldNotFound;

Expand All @@ -47,7 +48,7 @@
*
*/
public class OrderBook
implements KafkaMessageHandler, InterfaceOrderBook, InterfaceMatchEvent, InterfaceAddedOrderToOrderBook, Runnable {
implements KafkaMessageHandler, InterfaceOrderBook, InterfaceMatchEvent, InterfaceAddedOrderToOrderBook, InterfaceOrderBookEvents, Runnable {
private final static String CLASSNAME = OrderBook.class.getSimpleName();

private final static int buyPriorityQueueSize = 100;
Expand All @@ -57,9 +58,9 @@ public class OrderBook
private PriorityQueue<InterfaceOrder> buy = new PriorityQueue<InterfaceOrder>(buyPriorityQueueSize, aboc);
private PriorityQueue<InterfaceOrder> sell = new PriorityQueue<InterfaceOrder>(sellPriorityQueueSize, asoc);

private List<InterfaceMatchEvent> listenersMatchEvent = new ArrayList<InterfaceMatchEvent>();
private PersistenceToFileClient debugger = null;

private List<InterfaceMatchEvent> listenersMatchEvent = new ArrayList<InterfaceMatchEvent>();
private List<InterfaceAddedOrderToOrderBook> listenersAddedOrderToOrderBook = new ArrayList<InterfaceAddedOrderToOrderBook>();
private AtomicBoolean running = new AtomicBoolean(false);
private AtomicBoolean initialised = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*****************************************************************************/

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;

Expand All @@ -26,15 +28,25 @@
import com.alignmentsystems.library.interfaces.InterfaceExecutionReport;
import com.alignmentsystems.library.interfaces.InterfaceMatch;
import com.alignmentsystems.library.interfaces.InterfaceMatchEvent;
import com.alignmentsystems.library.interfaces.InterfaceOrderBookEvents;

public class OrderBookKafkaProducer implements InterfaceMatchEvent, InterfaceAddedOrderToOrderBook, Runnable {
public class OrderBookKafkaProducer implements InterfaceMatchEvent, InterfaceAddedOrderToOrderBook, InterfaceOrderBookEvents, Runnable {
private KafkaProducer<String, byte[]> kafkaProducerB = null;
private LogEncapsulation log = null;
private static BinaryFromToCanonical binaryFromToCanonical = new BinaryFromToCanonical();
private List<InterfaceMatchEvent> listenersMatchEvent = new ArrayList<InterfaceMatchEvent>();
private List<InterfaceAddedOrderToOrderBook> listenersAddedOrderToOrderBook = new ArrayList<InterfaceAddedOrderToOrderBook>();




@Override
public void addAddedOrderToOrderBookListener(InterfaceAddedOrderToOrderBook toAdd) {
this.listenersAddedOrderToOrderBook.add(toAdd);
}

@Override
public void addMatchEventListener(InterfaceMatchEvent toAdd) {
this.listenersMatchEvent.add(toAdd);
}

public OrderBookKafkaProducer() {
// TODO Auto-generated constructor stub
Expand Down Expand Up @@ -119,4 +131,5 @@ public void addedOrderToOrderBook(InterfaceExecutionReport er) {
byte[] ack = binaryFromToCanonical.getBufferFromExecutionReport(er);
this.send(TOPIC, er.getExecID().toString(), ack);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@
import com.alignmentsystems.library.interfaces.InterfaceMatchEvent;
import com.alignmentsystems.library.interfaces.InterfaceOrderBook;
import com.alignmentsystems.library.interfaces.InterfaceOrderBookWrapper;
import com.alignmentsystems.matching.udp.MulticastServer;

/**
* @author <a href="mailto:sales@alignment-systems.com">John Greenan</a>
*
*/
public class OrderBookWrapper implements InterfaceOrderBookWrapper{
@SuppressWarnings("unused")
private final static String CLASSNAME = OrderBookWrapper.class.getSimpleName();

private Map<String, InterfaceOrderBook> orderBooks = new HashMap<String, InterfaceOrderBook>();
private LogEncapsulation log = null;
private PersistenceToFileClient debugger = null;
private List<InterfaceMatchEvent> listenersMatchEvent = new ArrayList<InterfaceMatchEvent>();
//private List<InterfaceMatchEvent> listenersMatchEvent = new ArrayList<InterfaceMatchEvent>();
// private List<InterfaceAddedOrderToOrderBook> listenersAddedOrderToOrderBook =
// new ArrayList<InterfaceAddedOrderToOrderBook>();

Expand All @@ -56,7 +58,7 @@ public boolean initialise(LogEncapsulation log, PersistenceToFileClient debugger

OrderBook orderBook = new OrderBook();

OrderBookKafkaProducer obkp = null;
OrderBookKafkaProducer obkp = new OrderBookKafkaProducer();

obkp.initialise(log);

Expand All @@ -65,6 +67,18 @@ public boolean initialise(LogEncapsulation log, PersistenceToFileClient debugger
}else{
return false;
};

MulticastServer multicast = new MulticastServer();


Thread multiCastServerThread = new Thread(null , multicast, MulticastServer.CLASSNAME);

multiCastServerThread.start();


obkp.addAddedOrderToOrderBookListener(multicast);
obkp.addMatchEventListener(multicast);


Thread obThread = new Thread(orderBook);

Expand All @@ -82,6 +96,11 @@ public boolean initialise(LogEncapsulation log, PersistenceToFileClient debugger
throw e;
}

//orderBook.addAddedOrderToOrderBookListener(multicast);
//orderBook.addMatchEventListener(multicast);




try {
obkc.runAlways(symbol, orderBook);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@
import com.alignmentsystems.library.constants.Constants;
import com.alignmentsystems.library.enumerations.ConfigurationProperties;
import com.alignmentsystems.library.enumerations.InstanceType;
import com.alignmentsystems.library.interfaces.InterfaceAddedOrderToOrderBook;
import com.alignmentsystems.library.interfaces.InterfaceExecutionReport;
import com.alignmentsystems.library.interfaces.InterfaceMatch;
import com.alignmentsystems.library.interfaces.InterfaceMatchEvent;
import com.alignmentsystems.library.interfaces.InterfaceMulticastServer;

/**
* @author <a href="mailto:sales@alignment-systems.com">John Greenan</a>
*
*/
public class MulticastServer implements Runnable, InterfaceMulticastServer {
private final static String CLASSNAME = MulticastServer.class.getSimpleName().toString();
public class MulticastServer implements InterfaceMulticastServer , InterfaceMatchEvent, InterfaceAddedOrderToOrderBook, Runnable{
public final static String CLASSNAME = MulticastServer.class.getSimpleName().toString();
private DatagramSocket socket;
private InetAddress group;
private LogEncapsulation log = null;
private ConcurrentLinkedQueue<InterfaceMatch> marketDataToPublishQueue = null;
private PersistenceToFileClient debugger = null;
private String host = null;
private int port = 0;
Expand Down Expand Up @@ -99,10 +101,9 @@ private boolean innerInitialise() {
}

@Override
public boolean initialise(LogEncapsulation log, ConcurrentLinkedQueue<InterfaceMatch> marketDataToPublishQueue,
PersistenceToFileClient debugger, String host, int port) {
public boolean initialise(LogEncapsulation log, PersistenceToFileClient debugger, String host, int port) {
this.log = log;
this.marketDataToPublishQueue = marketDataToPublishQueue;

this.debugger = debugger;
this.host = host;
this.port = port;
Expand All @@ -111,54 +112,10 @@ public boolean initialise(LogEncapsulation log, ConcurrentLinkedQueue<InterfaceM
}

@Override
public void run() {
running.set(true);

debugger.info(CLASSNAME);

while (running.get()) {

InterfaceMatch inMarketDataToPublish = marketDataToPublishQueue.poll();

if (inMarketDataToPublish != null) {
try {

//inMarketDataToPublish.getSBERepresentation(this.getCurrentSequenceNumber());
// debugger.info(inMarketDataToPublish.toString());
//ByteBuffer bb = ByteBuffer.wrap(inMarketDataToPublish.getSOFHRepresentation());
ByteBuffer bb = null;
String payload = Constants.CHARSET.decode(bb).toString();
debugger.info(inMarketDataToPublish.toString() + "SBE payload==> " + payload);

this.multicastThis(bb.array());

} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
try {
Thread.currentThread();
Thread.sleep(MILLISLEEP);

} catch (InterruptedException e) {

running.set(false);

Thread.currentThread().interrupt();

System.err.println(e.getMessage());

System.err.println(new StringBuilder().append(CLASSNAME).append(Constants.SPACE).append(e.getMessage())
.toString());
}
}
}

@Override
public boolean initialise(LogEncapsulation log, ConcurrentLinkedQueue<InterfaceMatch> marketDataToPublishQueue,
PersistenceToFileClient debugger) throws Exception{
public boolean initialise(
LogEncapsulation log
, PersistenceToFileClient debugger) throws Exception{
this.log = log;
this.marketDataToPublishQueue = marketDataToPublishQueue;
this.debugger = debugger;
try {
this.host = LibraryFunctions.getProperty(MulticastServer.class.getClassLoader() , InstanceType.MULTICASTSERVER.getProperties(), ConfigurationProperties.MULTICASTHOST);
Expand All @@ -167,18 +124,36 @@ public boolean initialise(LogEncapsulation log, ConcurrentLinkedQueue<InterfaceM
log.error(e.getMessage() , e);
throw e;
}
return innerInitialise();
}

@Override
public Long getCurrentSequenceNumber() {
return ++sequenceNumber;
}

return innerInitialise();
@Override
public void addedOrderToOrderBook(InterfaceExecutionReport arg0) {
// TODO Auto-generated method stub

}

@Override
public ConcurrentLinkedQueue<InterfaceMatch> getMarketDataQueue() {
return this.marketDataToPublishQueue;
public void matchHappened(InterfaceMatch arg0) {
// TODO Auto-generated method stub

}

@Override
public Long getCurrentSequenceNumber() {
return ++sequenceNumber;
public void run() {
AtomicBoolean run = new AtomicBoolean(true);
while (run.get()) {
try {
wait(2000);
} catch (InterruptedException e) {
log.error(e.getMessage() , e );
}
}

}
}
4 changes: 2 additions & 2 deletions exchange/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Mon Sep 18 19:15:14 AEST 2023
VERSION_BUILD=702
#Mon Sep 18 20:08:14 AEST 2023
VERSION_BUILD=709
4 changes: 2 additions & 2 deletions fixclient/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Mon Sep 18 19:15:14 AEST 2023
VERSION_BUILD=704
#Mon Sep 18 20:08:14 AEST 2023
VERSION_BUILD=711
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
package com.alignmentsystems.library.interfaces;
import java.io.IOException;
/******************************************************************************
*
* Author : John Greenan
* Contact : sales@alignment-systems.com
* Date : 24th August 2023
* Copyright : Alignment Systems Ltd 2023
* Project : Alignment Matching Toy
* Artefact : InterfaceMulticastServer
* Description :
*****************************************************************************/
import java.util.concurrent.ConcurrentLinkedQueue;

import com.alignmentsystems.library.LogEncapsulation;
import com.alignmentsystems.library.PersistenceToFileClient;
Expand All @@ -19,9 +8,8 @@
*
*/
public interface InterfaceMulticastServer {
public boolean initialise(LogEncapsulation log, ConcurrentLinkedQueue<InterfaceMatch> marketDataToPublishQueue, PersistenceToFileClient debugger, String host, int port) throws Exception;
public boolean initialise(LogEncapsulation log, ConcurrentLinkedQueue<InterfaceMatch> marketDataToPublishQueue, PersistenceToFileClient debugger) throws Exception;
public boolean initialise(LogEncapsulation log, PersistenceToFileClient debugger, String host, int port) throws Exception;
public boolean initialise(LogEncapsulation log, PersistenceToFileClient debugger) throws Exception;
public void multicastThis(byte[] multicastBytes) throws IOException;
public ConcurrentLinkedQueue<InterfaceMatch> getMarketDataQueue();
public Long getCurrentSequenceNumber();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public Boolean initialise(
public OffsetDateTime getOrderBookCreationTime();
public OffsetDateTime getOrderBookLastUpdateTime();
public int getOrderCountBySide(OrderBookSide orderBookSide );
public void addMatchEventListener(InterfaceMatchEvent toAdd);
public void addAddedOrderToOrderBookListener(InterfaceAddedOrderToOrderBook toAdd);
public void upsertTopOfBook(InterfaceOrder nos);
public void updateLevelsOfDepth();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.alignmentsystems.library.interfaces;

public interface InterfaceOrderBookEvents {
public void addMatchEventListener(InterfaceMatchEvent toAdd);
public void addAddedOrderToOrderBookListener(InterfaceAddedOrderToOrderBook toAdd);

}
4 changes: 2 additions & 2 deletions sharedlibrary/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Mon Sep 18 19:15:14 AEST 2023
VERSION_BUILD=702
#Mon Sep 18 20:08:14 AEST 2023
VERSION_BUILD=709