trendmanagement / Tmqr-framework-2

3 stars 0 forks source link

problem with opt_codes saving #62

Closed spickering-git closed 7 years ago

spickering-git commented 7 years ago

@alexveden When creating several of the indexes on the instruments we pass in the opt_codes in the INDEX_CONTEXT. Lets look at ES, we pass ['EW','EW1','EW2','EW3','EW4','']

INDEX_CONTEXT = {
    'instrument': "US.ES",
    'context':{'costs_futures': 3.0,
    'costs_options': 3.0}
}
INDEX_CONTEXT['opt_codes'] = ['EW','EW1','EW2','EW3','EW4','']
index = EXODeltaTargetGeneric(dm, **INDEX_CONTEXT)

The problem arises when we make a call to calculate the index after it is already created

dm = DataManager(date_start=datetime(2011, 1, 1))
instrument = 'US.ES'
index = IndexBase.load(dm, instrument + '_EXOLongEnhance_DT')

index.opt_codes returns [] We believe this is causing the problem that we are seeing where there are Wednesday ES options. See this test notebook I set up for you to help debug. https://10.0.1.2:8889/notebooks/indexes/index_deployment_samples/deploy_index_not_saving_opt_code.ipynb

alexveden commented 7 years ago

If you want to save custom data you should use the 'context' sub-dictionary:

INDEX_CONTEXT['context']['opt_codes'] = ['EW','EW1','EW2','EW3','EW4','']

spickering-git commented 7 years ago

fixed