Live Trading Algo Performance Skewed by Cash Transfer

I am live trading an algo using my IB account, and when I transferred additional cash into my IB account [1], it showed up as a big spike in the returns on my live trading algo. This is not correct - the algo isn't performing any better, I just transferred extra cash in but it thinks it's just had a windfall.

I plan to be injecting new capital every month (my algo rebalances new capital each month into its positions), but I don't want that to skew the overall performance of my algo. How can I achieve this?

[1] The log line from when it happened - after this point, my algo performance incorrectly jumped by 20% 2015-10-17 00:31 SYSTEMINFO(IB) Updating cash in minute performance tracker from 580.58 to 2924.93

10 responses

Bump. Any ideas?

This sounds like it can be fixed using a time weighted account balance calculation. Probably something you'll need to wait for Quantopian devs to fix.

Ok, thanks Gary. That's frustrating.

Unfortunate. There's a solution though.

The returns calculation is (portfolio_value - starting_capital) / starting_capital.
In that equation, portfolio_value jumped with added cash while starting_capital remained the same, so the returns jumped upward also.

A way to address that: (POSITIONS_value - amount_risked) / amount_risked
...where amount_risked is the amount exchanged for stocks (plus commissions). It is the maximum drawdown on the starting_capital.

Example:
Starting cash in IB: $10,000 Amount spent in exchanging cash for stocks:$10,000 (the entire amount)
Portfolio after some time, hypothetically: $11,000 (made$1,000)
Current returns:
($11,000 -$10,000) / $10,000 = 10% Later add an additional$5,000 to the current $11,000 in the account. Returns by current calculation: (portfolio_value - starting_capital) / starting_capital ... ($16,000 - $10,000) /$10,000 = 60% -- wrong

Returns by this suggested new calculation:
(POSITIONS_value - amount_risked) / amount_risked ... ($11,000 -$10,000) / \$10,000 = 10% -- correct

(POSITIONS_value - amount_risked) is profit.

Profit / amount_risked is always the returns value we're interested in.
A certain amount of money was put to work by transferring it into something other than cash, how well did it do.
The problem is, when we transfer money into a broker account, we immediately have a "portfolio" value, even though none of it has yet been put to work, it has not yet really been invested until a transaction is made.

Shorting adds an element to sort out, possibly its risk is any value beyond cash to cover, I'm not sure about that part.

Thanks Gary, that's really helpful. I have a long-only algo, so it should be relatively straight-forward to setup a custom report using the approach you've outlined above. I'll give it a try and post results.

Marcus, I agree this behavior is less than ideal. The IB algorithm can't differentiate between a cash deposit and an increase in portfolio returns. To the algo, these are identical. On our radar is to differentiate cash deposit/withdrawals, though this isn't currently being worked on.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Ok, thank you for the transparency, Alisa.

Hi, Is there any updated on this issue? On Robinhood I started live trading, then the transfer of funds completed about 5 days after live trading began. Now my dashboard has a huge spike in profits. I'm new to all of this type of trading, but help with this topic would make things a littler clearer.

As a loosely related topic, I would like to request putting a total liquid value to the dashboard. I know I can add things up to get this, but a total would be a quick way to see how I'm looking profit-wise. Since the above issue make the profit numbers erroneous.

I would like to say overall this is an amazing platform and a great win-win business plan for company & crowd/users.

Thank you,
-David

+1 for this. I have been using Robinhood live trading for a while. With cash deposits the performance result become uninterpretable.

An idea for keeping numbers intact when adding and withdrawing cash in real money trading: Somewhere around the process of assigning a broker from the full backtest page, a checkbox to say we want the backtest money field to be used by the algo as its initial portfolio value (our initial cash plus any adds minus any withdrawals, where we would need to keep track of that total and enter it into that backtest field), and then Dollar P/L, context.portfolio.pnl and any others should be as expected. For now, I use the manual_cash setting here.