Page 1 of 1

How to call and get the "Net Liquidation Value" or "Cash Value" or "Available Funds" of an account??

Posted: Wed Mar 14, 2018 4:50 am
by Rocket130713
Hello,

I'm trying to call and get the "Net Liquidation Value" of our 5 sub-accounts combined, how do I do this? This is is code I'm using in our TradeStation EasyLanguage Script but it only returns the "Buying Power" of all accounts combined, instead, I need to get the "Net Liquidation Value" of all accounts combined:

NetLiq = GET_ACC_VAL(12,"","",0);

Is the above line of code correct? If I can't get the "Net Liquidation Value" of all 5 sub-accounts combined, I would like to get the "Cash Value" or "Current Available funds" of all 5 sub-accounts combined instead? Is this possible to do via TWS-Link? What am I doing wrong?

For example, assume I have 5 sub-accounts with $1,000 USD in each sub-account (where all 5 sub-accounts are put into a TWS "Account Group" called "Group1"), I then want to call and get the "Net Liquidation Value" of all 5 accounts "combined" which should return a value of $5,000 USD, to do this I tried using this line of code (but it did not work): NetLiq = GET_ACC_VAL(12,"USD","Group1",0);

The above GET_ACC_VAL code did not work for me, it looks like I'm coding it wrong? Could you please let me know the correct way to code this?

Reason I ask this question is that getting the combined Buying Power of all 5 sub-accounts is not "reliable" as it changes by a large amount at night. For example, during the day buying power is 4 times the account cash value but at night it is only 2 times the account cash value (which is a big difference), so buying power can't be used to set position size (as it changes during the day/night by a very large amount), instead we need to use total combined "Net Liquidation Value" or "Cash Value" or "Current Available funds" of the 5 sub-accounts to set the correct position size i.e. our trading strategy sets position size equal to 1% of account "Net Liquidation Value".

Many thanks in advance.

Regards,

Rod

Re: How to call and get the "Net Liquidation Value" or "Cash Value" or "Available Funds" of an account??

Posted: Wed Mar 14, 2018 11:51 am
by board_admin
I can recommend that batchtester tool to find out such things. Changes are quickly made and tried.

Code: Select all

GET_ACC_VAL(12,"USD","Group1",0);
can't work as Group1 is not evaluated. What happens, when you pass a comma separated string of accounts ?

Code: Select all

GET_ACC_VAL(12,"USD","acc1,acc2,..,accn",0);

Re: How to call and get the "Net Liquidation Value" or "Cash Value" or "Available Funds" of an account??

Posted: Thu Mar 15, 2018 1:46 am
by Rocket130713
Thanks for such a quick response and help. I tried your suggestion: Ret_Acc_Val = GET_ACC_VAL(12,"USD","acc1,acc2,..,accn",0); but it did not work, when I called this function I got a strange Account value returned like $140 million whereas it should be around $6 million.

Please note that calling Net Liq Value for a single account actually worked fine i.e. GET_ACC_VAL(12,"USD","DU886754",0);

I thought if i called GET_ACC_VAL(12,"USD","",0); i should get value of all accounts combined? Is this true? To solve this problem I tried calling REQ_ACC_UPDATE("",1,1000) first and GET_ACC_VAL(12,"USD","",0); second, but it did not work either. Do you know how to solve this problem?

I tried using the Batch Tester but did not understand it very well.

Thank you in advance.

Regards,

Rod