Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Live AlphaModel Return% After Re-Deploy or Live Error

Open fcnorman opened this issue 7 years ago • 1 comments

Expected Behavior

Live algorithm is running, based on the new AlphaModel framework. Equity is $1000, Unrealized is $1.50. Net profit is $3.00. Return% is 0.45%.

Live Error occurs: The maximum number of attempts for brokerage cash sync has been reached.

There is currently nothing the algo writer can do about the above live error, so he/she re-deploys the AlphaModel.

Live algorithm successfully re-deploys and shortly resumes reporting the following statistics: Equity is $1000, Unrealized is ~$1.50. Net profit is ~$3.00. Return% is ~0.45%. Where ~ means there is some allowance for market moves between the live error and the re-deploy.

Actual Behavior

Live algorithm is running, based on the new AlphaModel framework. Equity is $1000, Unrealized is $1.50. Net profit is $3.00. Return% is 0.45%.

Live Error occurs: The maximum number of attempts for brokerage cash sync has been reached.

There is currently nothing the algo writer can do about the above live error, so he/she re-deploys the AlphaModel.

Live algorithm successfully re-deploys 2 minutes after the live error and shortly resumes reporting the following statistics: Equity is $1000, Unrealized is ~$1.50. Net profit is $0.00. Return% is -34.00%. In the 2 minutes of downtime, there were no major market moves.

Potential Solution

Persist live algorithm state and use it for re-establishing statistics. This should be done by the platform, and not in the AlphaModel.

Reproducing the Problem

  1. Write down account details.
  2. Start a live AlphaModel.
  3. Stop and Re-deploy the Alpha Model.
  4. Wait 2 minutes.
  5. Upon successful re-deploy, the Return% will be off, and the Net Profit will be reset to 0.

System Information

Was just running Alphas on www.quantconnect.com. (This happened on a Server 2048 and a Server 1024.)

Checklist

  • [ x ] I have completely filled out this template
  • [ x] I have confirmed that this issue exists on the current master branch
  • [ x ] I have confirmed that this is not a duplicate issue by searching issues
  • [ x ] I have provided detailed steps to reproduce the issue

This is partially related to #1040, but #1040 was more about algo writers having a spot to persist their own statistics. This is more about core platform statistics, I think.

fcnorman avatar May 08 '19 13:05 fcnorman

Hi @fcnorman thank you for the issue but this relates to the QuantConnect.com web platform not LEAN. Github issues are for issues relating to the LEAN engine only.

jaredbroad avatar May 10 '19 14:05 jaredbroad