Hello,
I've set an BalanceBook to start with a balance of 10.00, as the example in the XML below.
<bean id="balanceBook" class="org.activequant.core.domainmodel.account.BalanceBook">
<property name="currentBalance" value="10000"/>
</bean>
<bean id="brokerAccount" class="org.activequant.core.domainmodel.account.BrokerAccount" >
<property name="balanceBook" ref="balanceBook"/>
</bean>
I've noticed that when a run a System without any order, the method Account.getBalanceBook creates a new instance of BalanceBook, copy all BalanceEntry from all acounts, but doesn't copy the currentBalance property.
It might sound weird a system without orders, but that is one of my use cases. I would like to see that my logic was not good and my balance remains untouched.
Am I doing something wrong?
If not, I would suggest the following change in the Account class.
public BalanceBook getBalanceBook() {
if (brokerAccounts.size() > 0) {
BalanceBook ret = new BalanceBook();
for(BrokerAccount brokerAccount : brokerAccounts){
for(BalanceEntry be : brokerAccount.getBalanceBook().getBalanceEntries()){
ret.addBalanceEntry(be.getValue(), be.getTimeStamp());
}
ret.setCurrentBalance(ret.getCurrentBalance() + brokerAccount.getBalanceBook().getCurrentBalance());
}
return ret;
}
return new BalanceBook();
}
Att,
Franklin Samir Dattein
_______________________________________________
ccapi mailing list
ccapi@...
http://activestocks.de/cgi-bin/mailman/listinfo/ccapi