How to get account balance

4 replies

clonex

Customer, bbp_participant, community, contributor, sq-ultimate, 263 replies.

Visit profile

5 years ago #114190

Hi ,

 

im trying to get account balance in moment of computing order in public void computeForOrder(SQStats stats, StatsTypeCombination combination, SQOrder order, SQSettings settings, SQStats statsLong, SQStats statsShort)

 

There is a field

 

order.AccountBalance where im recieving 0.0 value

 

There is another method

 

order.getBalance(java.lang.String plType)   where i dont know what is string plType

 

Yes there are another ways how to compute this value but can you please explain how to use theese approaches?

 

Thanks in advance

 

 

Clonex

0

Tamas

Customer, bbp_participant, community, sq-ultimate, 73 replies.

Visit profile

5 years ago #132621

Hello Clonex,

 

balance is not calculated in statvalues but you can calcute it right in your snippet.

 

private double balanceInMoney = 0;
private double balanceInPct = 0;
private double balanceInPips = 0;

 

@Override
public void computeForOrder(SQStats stats, StatsTypeCombination combination, SQOrder order, SQSettings settings, SQStats statsLong, SQStats statsShort) throws Exception {
if(!order.isBalanceOrder()) {
  balanceInMoney+=order.PL;
  balanceInPct+=order.PctPL;
  balanceInPips+=order.PipsPL;
 
/*or for the particular combination 
private double balance = 0; 
 
if(!order.isBalanceOrder()) {
double PL = getPLByStatsType(order, combination);
balance+=PL;
}
*/
}
 
 
//in this moment you already know the balance 🙂
 
}
 
Best regards,
Tomas

0

clonex

Customer, bbp_participant, community, contributor, sq-ultimate, 263 replies.

Visit profile

5 years ago #132623

Hi Tamas,

this is I was looking for. 😉 So in generaly  class statvalues do you not recommend for calculating this type of statisticcs right?

 

Clonex

0

Tamas

Customer, bbp_participant, community, sq-ultimate, 73 replies.

Visit profile

5 years ago #132624

StatValues is a right place to compute any type of stats.

If you need the balance just compute and use it.

 

In SQOrder atributes AccountBalance/PipsAccountBalance/PctAccountBalance are used in Equity control module which change them all the time according to the trade size.

 

Best regards,

Tomas

0

clonex

Customer, bbp_participant, community, contributor, sq-ultimate, 263 replies.

Visit profile

5 years ago #132627

Excellent Tamas. Thank You. 

0

Viewing 5 posts - 1 through 5 (of 5 total)