This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void sendOrder(String orderSide, int parentOrderId) { | |
new Thread(() -> { | |
System.out.print("before getting ids, nextOrderID = " + nextOrderID + ", nextValidId_prev = " + nextValidId_prev); | |
while (nextOrderID == nextValidId_prev) { | |
System.out.print("waiting for next valid id..."); | |
client.reqIds(1); | |
System.out.print("waiting for next valid id done"); | |
try { | |
Thread.sleep(1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void updatePortfolio(Contract contract, double position, double marketPrice, double marketValue, double averageCost, double unrealizedPNL, double realizedPNL, String accountName) { | |
DecimalFormat df = new DecimalFormat("0.0000"); // TODO get digit according | |
df.setDecimalSeparatorAlwaysShown(true); | |
String formatedPosition = df.format(position); | |
formatedPosition = formatedPosition.replace(",", "."); | |
System.out.println("contract = " + contract.localSymbol() + ", contract.description() = " + contract.description() + ", unrealizedPNL = " + unrealizedPNL + ", formatedPosition = " + formatedPosition); | |
} |