trendmanagement / Tmqr-framework-2

3 stars 0 forks source link

V2 index run() taking too long #61

Open spickering-git opened 6 years ago

spickering-git commented 6 years ago

@alexveden As a test we timed running the threaded script of the ES indexes and associated alphas. It took 3 minutes and 20 seconds. We tested the non-threaded script and it took 4 minutes.

alexveden commented 6 years ago

I think this has been fixed, example notebook: https://10.0.1.2:8889/notebooks/indexes/EXO%20Long%20call.ipynb

You haven't to change anything on your side, index.run() now updates the last position like alphas do

alexveden commented 6 years ago

But I still must implement a method for execution prices updates for positions of indexes and alphas.

spickering-git commented 6 years ago

@alexveden Can you address the issue of being able to update the last day of an index or alpha if run after the initial run on a day. So that if we need to correct an error. For example today, the ES ran the indexes and then alphas with the incorrect opt_codes filling today's data. we corrected the opt_codes then re-created the indexes and ran the alphas.

Is there a short term manual fix like deleting the positions field and re-running the alpha or would we need to delete the entire alpha (would rather avoid doing that)?

alexveden commented 6 years ago

Can you address the issue of being able to update the last day of an index or alpha if run after the initial run on a day.

Committed the code which handles alpha and index last day updates. You shouldn't change anything on your side, except current date conditions. Replace:

if datetime.now() <= <index/alpha last date calculated>: 
       continue

to

if datetime.now() < <index/alpha last date calculated>: 
       continue

So, calling index.run() or alpha.run() + save() you will get overwritten (updated) alpha/index position and stats for current date.

That means that you can use index.run() or alpha.run() to update alphas and indexes at the execution time moments!

However, you still will be getting an error if you try to run at the date prior the date of last index calculation.