LMAX Architecture - Running 6 Million orders per second on Java

User avatar
Nonius
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LMAX Architecture - Running 6 Million orders per second on Java

Post by Nonius »

Now trying the Java API and am getting this error.



Exception in thread "main" java.lang.Error: Unresolved compilation problems:



ProductType cannot be resolved to a type



ProductType cannot be resolved



I note that ProductType in the C# framework is just an enum for Demo or Live versions and it's defined in a .cs file LoginRequest.cs.  The corrosponding file is not there in the Java version.  anyone checked this out?
Chiral is Tyler Durden
User avatar
WayconKidd
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LMAX Architecture - Running 6 Million orders per second on Java

Post by WayconKidd »

The Java compiler is probably not finding the LMAX library's .jar file. LMAX has packaged their stuff as an Eclipse project (but not an Eclipse workspace), which you can import into Netbeans by going to File->Import Project->Eclipse Project, then selecting Import Project ignoring Project Dependencies. Choose the "LmaxApiSample" directory under the root directory of their API .zip file that you extracted, specify a separate directory in which to work, and you should be set.



Otherwise, in Eclipse you can go to File->Import..., then under General choose "Existing Projects into Workspace" and select the "LmaxApiSample" directory.



To run the examples from Netbeans or Eclipse, you'll need to modify the editor's settings so that the correct command-line arguments get passed (URL, username, password, and mode).
User avatar
Nonius
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LMAX Architecture - Running 6 Million orders per second on Java

Post by Nonius »

thanks a lot WayconKidd.  That worked.
Chiral is Tyler Durden
User avatar
Nonius
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LMAX Architecture - Running 6 Million orders per second on Java

Post by Nonius »

was using their HistoricalMarketDataRequester in Java. It was reading the data and writing etc for some time...then, I got this message:



java.net.SocketException: Connection reset



when this happened, the txt file to which i was writing records becomes empty. wtp?
Chiral is Tyler Durden
User avatar
Nonius
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LMAX Architecture - Running 6 Million orders per second on Java

Post by Nonius »

thanks for the suggestions on the JavaShit thread.



I've another API question....maybe someone has played around with it.







since wagerlabs in the aforementioned thread mentioned LMAX, I do have a question on that.



I've got this Bot in which I pass in a model object, the model listens to tick prices using Esper. The model then sends to the Esper engine a "strategy" recommendation.



The Bot has StrategyListener that looks something like this.....not totally finished but.



Question 1. how to properly set the increment, ie, the variable in the body of the update function.



FixedPointNumber WTPincrement=FixedPointNumber.ONE;



apparently can get it from OrderBookInfo, but don't see how to retrieve that.



Question 2. What would be the best way to implement a ClosingOrderSpecification if what I want to close out the position if a) delta time has passed and b) (obviously) the stops weren't breached.







private class StrategyListener implements UpdateListener {





File theFile;

FileOutputStream fos;

PrintStream ps;

OrderTracker orderTracker;



StrategyListener(String Path, String SecurityId,OrderTracker anOrderTrack) throws FileNotFoundException{

String theFile1=new String(SecurityId);

String Slash=new String("/");

theFile=new File(Path+Slash+theFile1);

fos=new FileOutputStream(theFile);

ps=new PrintStream(fos);

orderTracker=anOrderTrack;



}



@Override

public void update(EventBean[] arg0, EventBean[] arg1) {

// TODO Auto-generated method stub

Strategy X=(Strategy) arg0[0].getUnderlying();



Long StrategyCreationTime=X.StrategyCreationTime;

Integer longOrShortInteger=X.LongOrShort;

Double SizeInPercentOfWealth=X.SizeInPercentOfWealth;

Boolean StopGain=X.StopGain;

Boolean StopLoss=X.StopLoss;

Double RelativeStopGain=X.RelativeStopGain;

Double RelativeStopLoss=X.RelativeStopLoss;

Long FinalTimeToExit=X.FinalTimeToExit;

FixedPointNumber stopProfitPriceOffset=null;

FixedPointNumber stopLossPriceOffset=null;



FixedPointNumber WTPincrement=FixedPointNumber.ONE;



double NumberOfSharesToTrade=longOrShortInteger==1?SizeInPercentOfWealth/BestAskD:-1.0*SizeInPercentOfWealth/BestBidD;

if(StopGain){

if(longOrShortInteger==0){

stopProfitPriceOffset=FixedPointNumbers.toFixedPointNumber(BestAskD*X.RelativeStopGain,WTPincrement);

}else{

stopProfitPriceOffset=FixedPointNumbers.toFixedPointNumber(BestBidD*X.RelativeStopGain,WTPincrement);

}

}



if(StopLoss){

if(longOrShortInteger==0){

stopLossPriceOffset=FixedPointNumbers.toFixedPointNumber(BestAskD*X.RelativeStopGain,WTPincrement);

}else{

stopLossPriceOffset=FixedPointNumbers.toFixedPointNumber(BestBidD*X.RelativeStopGain,WTPincrement);

}



}



FixedPointNumber quantity=FixedPointNumbers.toFixedPointNumber(NumberOfSharesToTrade, WTPincrement);





MarketOrderSpecification theOrder = new MarketOrderSpecification(instrumentId, quantity,TimeInForce.IMMEDIATE_OR_CANCEL,stopLossPriceOffset,

stopProfitPriceOffset);



session.placeMarketOrder(theOrder, new DefaultOrderCallback()

{

public void onSuccess(long instructionId)

{

System.out.println("Placed Order: " + instructionId);

orderTracker.setOrderState(OrderState.PENDING);

orderTracker.setInstructionId(instructionId);

}

});















System.setOut(ps);



System.out.println("Event received: " + arg0[0].getUnderlying());

System.setOut(System.out);



}

}
Chiral is Tyler Durden
User avatar
Nonius
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LMAX Architecture - Running 6 Million orders per second on Java

Post by Nonius »

I also can't see how to get the timestamp from the execution of an order!
Chiral is Tyler Durden
Post Reply