Open nikolas-joyce opened 6 years ago
If the Dollar ATR concept is unclear here is a notebook where i have a reference to it... https://10.0.1.2:8888/notebooks/campaign_management/Campaign_Bidirectional_CL_ContFut_Money_Management.ipynb#Campaign-members-equities
I know you had mentioned that you did not want express directions on how to complete a task .. this sheet is just meant to give an example my requested functionality. Dollar ATR MM.xlsx
If the Dollar ATR concept is unclear here is a notebook where i have a reference to it
If I clearly understand the Dollar ATR is related to alpha equity ATR, but not to risks of underlying option position of alpha?
That is correct the max risk of the option position is likely larger but this easy to calculate measure which can be standardized across products and allows for us to define the current risk.
Sent from my iPhone
On Oct 21, 2017, at 8:02 PM, alexveden notifications@github.com<mailto:notifications@github.com> wrote:
If the Dollar ATR concept is unclear here is a notebook where i have a reference to it
If I clearly understand the Dollar ATR is related to alpha equity ATR, but not to risks of underlying option position of alpha?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftrendmanagement%2FTmqr-framework-2%2Fissues%2F74%23issuecomment-338447500&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7C847ab5c1e83045fe3e1a08d518f947b2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636442381273949435&sdata=t7GBQGWAJdNWajyvgA5guIXPPEQHwRRg9Ky6sUudNu0%3D&reserved=0, or mute the threadhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARobLEXljRB5ty2s5-PiOaFw_zKmUda-ks5surAugaJpZM4QBtba&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7C847ab5c1e83045fe3e1a08d518f947b2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636442381273949435&sdata=Imc5DIGRL01t92q%2B37jZmSBi157%2FmWNPIXFdoa4Qflg%3D&reserved=0.
I've implemented the initial version of the ATR Campaign notebook: https://10.0.1.2:8888/notebooks/campaign_management/Campaign_ATR_MoneyManagement.ipynb
But I have found some issues to discuss:
"Max dollar ATR per alpha" and "Max total dollar ATR" concepts are mutually exclusive. In fact, I need to arrange each alpha risks, but it doesn't matter which risk values to use because this numbers will be adjusted at the next step.
ATR adjustments probably don't reflect true risks of the campaign, for example: This is ATR adjusted campaign, but it has MaxDD around -80k (!) and average ATR around 2500.
I think that a frequency of the position size adjustments should be weekly. Since we have to do alpha rebalancing every Sunday and execute it on Monday, it could be wise to stack campaign risk adjustments with other planned executions.
Also, we have a potential problem of fractional size, and I'm going to add checks to the notebook to monitor these cases.
I can implement other types of the campaign risk adjustment like MaxDD based / AverageDD based / 99% MaxDD quantile-based, to compare them with ATR.
Could you clarify, do you need the implementation of capital reinvestment, when the risk will be estimated based on current account capital and expressed in % of equity?
@alexveden Task by Monday Oct 30 2017 12pm PST please answer the following questions
https://10.0.1.2:8888/notebooks/campaign_management/Campaign_ATR_MoneyManagement-TESTING_Oct_27_2017-Copy3.ipynb line # 98 What is the significance of $1000 constant? With $1000 we see the number of units to be too high, especially if the alpha ATRs are in the range of $50 -> $200. We modified to use the max_dollar_atr_per_alpha and initial capital here. Can you please give us an idea on what value should be used here? Is there a reason we should NOT use the max_dollar_atr_per_alpha and initial capital here?
Regarding the rounding of the alpha's units should we use floor() instead of round
Is there a mechanical way to establish the implied minimum functioning account size for an amount of dollar risk? This configuration results in
if we increase the capital base, we get a lower result.
What is the significance of $1000 constant? With $1000 we see the number of units to be too high, especially if the alpha ATRs are in the range of $50 -> $200. We modified to use the max_dollar_atr_per_alpha and initial capital here. Can you please give us an idea on what value should be used here? Is there a reason we should NOT use the max_dollar_atr_per_alpha and initial capital here?
The value of this constant doesn't matters because on the next step we performing adjustments based on overall campaign risk, which reduces individual alpha risk if it is too high.
should we use floor() instead of round
Is this a question or fix request? :) Floor is acceptable of course, probably makes more sense.
Is there a mechanical way to establish the implied minimum functioning account size for an amount of dollar risk?
This is doable, using some optimization tool like optunity.
Could you please write a basic description of the 5 risk metrics and when to use them
'atr' - ATR(RISK_PERIOD) of alpha/campaign equity risk metric 'atrmax' - Highest(ATR(RISK_PERIOD)) of alpha/campaign equity risk metric 'ddavg' - rolling mean (RISK_PERIOD) of drawdown of alpha/campaign equity 'ddmax' - rolling maximum (RISK_PERIOD) of drawdown of alpha/campaign equity 'ddq95' - rolling 95% quantile (RISK_PERIOD) of drawdown of alpha/campaign equity
Generally, we have 2 approaches to alpha/campaign risk estimation:
The first approach allows you to set risk per single day. ATR approach allows you to set daily target, but you still don't have control of the cumulative loss risks, this can lead to the following situation:
When the ATR is relatively small, but the cumulative risk is very significant. Because of this, I've added Maximum drawdown risk metrics.
For ATR risk type you have 2 options:
For Maximum Draw down:
Note to calculate all of these metrics the max_total_dollar_atr
is used, probably I have to rename this variable to reflect its concept.
What are the to dos to bring this money management logic into production?
Sent from my iPhone
On Oct 28, 2017, at 2:15 AM, alexveden notifications@github.com<mailto:notifications@github.com> wrote:
1
What is the significance of $1000 constant? With $1000 we see the number of units to be too high, especially if the alpha ATRs are in the range of $50 -> $200. We modified to use the max_dollar_atr_per_alpha and initial capital here. Can you please give us an idea on what value should be used here? Is there a reason we should NOT use the max_dollar_atr_per_alpha and initial capital here?
The value of this constant doesn't matters because on the next step we performing adjustments based on overall campaign risk, which reduces individual alpha risk if it is too high.
2
should we use floor() instead of round Is this a question or fix request? :) Floor is acceptable of course, probably makes more sense.
3
Is there a mechanical way to establish the implied minimum functioning account size for an amount of dollar risk?
This is doable, using some optimization tool like optunity.
4
Could you please write a basic description of the 5 risk metrics and when to use them
'atr' - ATR(RISK_PERIOD) of alpha/campaign equity risk metric 'atrmax' - Highest(ATR(RISK_PERIOD)) of alpha/campaign equity risk metric 'ddavg' - rolling mean (RISK_PERIOD) of drawdown of alpha/campaign equity 'ddmax' - rolling maximum (RISK_PERIOD) of drawdown of alpha/campaign equity 'ddq95' - rolling 95% quantile (RISK_PERIOD) of drawdown of alpha/campaign equity
Generally, we have 2 approaches to alpha/campaign risk estimation:
The first approach allows you to set risk per single day. ATR approach allows you to set daily target, but you still don't have control of the cumulative loss risks, this can lead to the following situation: [image]https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F18488560%2F32133027-91ad0220-bbe0-11e7-840d-1508d2c9c4f6.png&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7Ce28c808c4ced45f2509d08d51de46055%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636447789058021299&sdata=jq3Wf7RgSPj5NNrUxEiSI1xllFoJnQIcllI2fmlBMuk%3D&reserved=0
When the ATR is relatively small, but the cumulative risk is very significant. Because of this, I've added Maximum drawdown risk metrics.
For ATR risk type you have 2 options:
For Maximum Draw down:
Note to calculate all of these metrics the max_total_dollar_atr is used, probably I have to rename this variable to reflect its concept.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftrendmanagement%2FTmqr-framework-2%2Fissues%2F74%23issuecomment-340163610&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7Ce28c808c4ced45f2509d08d51de46055%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636447789058021299&sdata=qeSWX2WdHdkwQi%2BcOYynIRKWpOQxz8k34PkMUSH56rQ%3D&reserved=0, or mute the threadhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARobLK-4vjQjBs9vP3gGUuSfVOBUtkyjks5swvCXgaJpZM4QBtba&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7Ce28c808c4ced45f2509d08d51de46055%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636447789058021299&sdata=jjOsvg8pWv6w0v1giPl0bzK54%2B5H%2FheETuxgGQsOiTs%3D&reserved=0.
Отправлено из Mail.Ru для Android суббота, 28 октября 2017г., 16:55 +04:00 от NikolasJoyce notifications@github.com :
What are the to dos to bring this money management logic into production?
Sent from my iPhone
On Oct 28, 2017, at 2:15 AM, alexveden <notifications@github.com<mailto: notifications@github.com >> wrote:
1
What is the significance of $1000 constant? With $1000 we see the number of units to be too high, especially if the alpha ATRs are in the range of $50 -> $200. We modified to use the max_dollar_atr_per_alpha and initial capital here. Can you please give us an idea on what value should be used here? Is there a reason we should NOT use the max_dollar_atr_per_alpha and initial capital here?
The value of this constant doesn't matters because on the next step we performing adjustments based on overall campaign risk, which reduces individual alpha risk if it is too high.
2
should we use floor() instead of round Is this a question or fix request? :) Floor is acceptable of course, probably makes more sense.
3
Is there a mechanical way to establish the implied minimum functioning account size for an amount of dollar risk?
This is doable, using some optimization tool like optunity.
4
Could you please write a basic description of the 5 risk metrics and when to use them
'atr' - ATR(RISK_PERIOD) of alpha/campaign equity risk metric 'atrmax' - Highest(ATR(RISK_PERIOD)) of alpha/campaign equity risk metric 'ddavg' - rolling mean (RISK_PERIOD) of drawdown of alpha/campaign equity 'ddmax' - rolling maximum (RISK_PERIOD) of drawdown of alpha/campaign equity 'ddq95' - rolling 95% quantile (RISK_PERIOD) of drawdown of alpha/campaign equity
Generally, we have 2 approaches to alpha/campaign risk estimation:
- Daily equity volatility - estimated average day-to-day equity volatility (ATR)
- Cumulative maximum risk - i.e. max drawdown
The first approach allows you to set risk per single day. ATR approach allows you to set daily target, but you still don't have control of the cumulative loss risks, this can lead to the following situation: [image]< https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F18488560%2F32133027-91ad0220-bbe0-11e7-840d-1508d2c9c4f6.png&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7Ce28c808c4ced45f2509d08d51de46055%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636447789058021299&sdata=jq3Wf7RgSPj5NNrUxEiSI1xllFoJnQIcllI2fmlBMuk%3D&reserved=0 >
When the ATR is relatively small, but the cumulative risk is very significant. Because of this, I've added Maximum drawdown risk metrics.
For ATR risk type you have 2 options:
- 'atr' - simple ATR - average volatility within RISK_PERIOD
- 'atrmax' - maximum of simple ATR within RISK_PERIOD
For Maximum Draw down:
- 'ddavg' - average of MaxDD series within RISK_PERIOD
- 'ddmax' - maximal of MaxDD series within RISK_PERIOD
- 'ddq95' - 95% percentile of lowest MaxDD series within RISK_PERIOD (compared to 'ddmax', 'ddq95' will ignore MaxDD spikes and will estimate relatively frequent drawdowns)
Note to calculate all of these metrics the max_total_dollar_atr is used, probably I have to rename this variable to reflect its concept.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftrendmanagement%2FTmqr-framework-2%2Fissues%2F74%23issuecomment-340163610&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7Ce28c808c4ced45f2509d08d51de46055%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636447789058021299&sdata=qeSWX2WdHdkwQi%2BcOYynIRKWpOQxz8k34PkMUSH56rQ%3D&reserved=0 >, or mute the thread< https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARobLK-4vjQjBs9vP3gGUuSfVOBUtkyjks5swvCXgaJpZM4QBtba&data=02%7C01%7Cnikolasjoyce%40hotmail.com%7Ce28c808c4ced45f2509d08d51de46055%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636447789058021299&sdata=jjOsvg8pWv6w0v1giPl0bzK54%2B5H%2FheETuxgGQsOiTs%3D&reserved=0 >. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .
@alexveden here is the notebook where the larger starting capital does not seem to lead to a greater terminal value. https://10.0.1.2:8888/notebooks/campaign_management/Campaign_ATR_MoneyManagement-TESTING_Oct_27_2017-45_cap.ipynb for 45000 starting capital -->
when i change the starting capital to 75000 i get this. !
here is the notebook where the larger starting capital does not seem to lead to a greater terminal value. https://10.0.1.2:8888/notebooks/campaign_management/Campaign_ATR_MoneyManagement-TESTING_Oct_27_2017-45_cap.ipynb
I've found the bug and fixed it.
Now it works as expected:
Also, I've changed this block, to ignore initial campaign exposure:
Task @alexveden could you explain or debug these 2 examples below and build example portfolios that display the expected behavior from the available put and call spreads in each notebook. required completion date: 1 November 9:00am PST.thx
am getting some odd results and i think something is still not behaving as i would expect. [(https://10.0.1.2:8888/notebooks/campaign_management/Campaign_ATR_MoneyManagement-ZN.ipynb)] i made a notebook that uses the ZN put and call spreads... i don't think would get up to a 40 lot of the put spreads so quickly and secondly i don't thing that would lead to only ~a gain of $8000.
here is another example with the ES. https://10.0.1.2:8888/notebooks/campaign_management/Campaign_ATR_MoneyManagement-ES.ipynb i have only 3 futures alphas enabled...
1 long and 2 shorts... it looks like the position sizing is jumping without a increase in PNL.
am i doing something wrong here? i can explain the low alpha units after the large increase in units in late 2013 but not the dramatic jump.
I am thinking about how we would start to implement a portfolio with the Money Management logic... to test this concept i have moved the starting date closer to the current date. https://10.0.1.2:8888/notebooks/campaign_management/Campaign_ATR_MoneyManagement-MultiAsset_Moving_Start_date.ipynb
as i move the start date closer to the current time fewer trades are generated. Is this because there is not enough capital or the current ATR is too high or some other reason? task @alexveden could you address this question by 2 November at 9:00 am PST thx
I have created this notebook if you want to try some alphas with a drawdown. It also seem to highlight an issue where the atr of some alphas may be too low based on the measured look back period. Maybe we should have a minimum atr like $100-$75 instead of the true atr if the measured value is <$75. As the atr gets smaller we do more units but probably there needs to be some lower limit. If we are risking $800 across the portfolio and an alpha has a atr of 10 we are going to do 80. Probably all values below $100 should be treated the same. In this case we would do 8 instead of 80 units.
@alexveden Task could you implement or comment on the need for this tweak before 5 November @ 9:30 am PST. thx
@alexveden Task could you implement or comment on the need for this tweak before 5 November @ 9:30 am PST. thx
This is implemented in SmartCampaign framework
@alexveden TASK : by Friday 10 November..thx could you give me the ability to extract stats on the other lines in the notebook eqty adj plain eqty adj no reinv equity simple sum
also could you show me how to play with the settings for the relative strength logic. thx
Task: could you high-light where the parameters that limit the minimum dollar atr of a component so that we don't use a dollar ATR less than $100 and therefore overweight an alpha if the dollar atr of a compnent is like $30.....
task: where is the campaign % atr defined in the smart campaign. i see target risk but not a campaign wide control like in previous notebooks.
Task: could you high-light where the parameters that limit the minimum dollar atr of a component so that we don't use a dollar ATR less than $100 and therefore overweight an alpha if the dollar atr of a compnent is like $30.....
These settings are located in global CAMPAIGN_DICT = {}
task: where is the campaign % atr defined in the smart campaign. i see target risk but not a campaign wide control like in previous notebooks.
The % atr or total campaign risk set in BACKTESTER_SETTINGS = {}, however this setting depends on 'campaign_risk_type': 'atrmax',
in CAMPAIGN_DICT it it's set to 'atr' the SmartCampaign targets the risk % based on ATR, otherwize is the value is the 'dd' the SmartCampaign % risk estimation is based on total risk (i.e. on different metrics of drawdown series).
Also, the BACKTESTER_SETTINGS = {} settings are only related to the smart campaign report in the notebook. In the future, these settings will be ported to individual account settings.
TASK : by Friday 10 November..thx could you give me the ability to extract stats on the other lines in the notebook eqty adj plain eqty adj no reinv equity simple sum DONE
Alex i have a task for you on the topic of Money Management of the alphas within a campaign.
I need this by Tuesday 24, October 2017, 10:00 am PST.
I want to be able to:
1) to define an amount of capital to be assigned to a set of alphas, set a risk budget and enforce a group control for the total ATR dollars at risk. for example the user would define $100,000 capital
2) Max dollar ATR per alpha : .5% of capital
3)Max total dollar ATR : 4.0% of capital
4)date of initial money management : 01/01/2014
'!NEW_AlphaV1Exposure_HedgedBy_V2_IndexEXOLongEnhance_DT_PutSpread_DSP_InstaTrendline__Bullish_Aug_7_33': 1.0,
'!NEW_AlphaV1Exposure_HedgedBy_V2_US_CL_EXO_PutSpread_DynKel_longs_LP_DSP_InstaTrendline__Bullish_Aug_7_18': 1.0,
'!NEW_AlphaV1Exposure_HedgedBy_V2_US_CL_EXOSemiFuture_DynKel_20_60_longs_for_DSP_LowPass__Bullish_Aug_29_33': 1.0,
'!NEW_AlphaV1Exposure_HedgedBy_V2_IndexEXOLongEnhance_DT_PutSpread_DSP_LowPass__Bullish_Aug_29_33': 1.0, '!NEW_AlphaV1Exposure_HedgedBy_V2_US_CL_EXO_PutSpread_DynKel_longs_LP_DSP_LowPass__Bullish_Aug_29_18':1.0,
5) i need to be able to back test this process
6) send the required orders to the real time if needed.
So that : I hope this will allow the reinforcement of strongly performing alphas as over time their capital base should increase. Poorly performing alphas will have smaller capital base over time. Increases in volatility should reduce the number of units deployed.