Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added verification for dict item #25

Merged
merged 1 commit into from
Jan 21, 2024
Merged

Conversation

davidatBGU
Copy link
Contributor

As well added verification for keys,
To avoid the following errors:

[DB] TUZA.TA (0508/0510/0539 [94.62%], Diff: 0000), time/left(hours)/avg [sec]: 1756/ 100(0.0)/3.44 -> Exception in TUZA.TA symbol.get_info(): 'TaxProvision' -> Traceback (most recent call last):
File "/home/opc/sss/sss.py", line 1854, in process_info
financials_yearly_yq[list_element_dict["asOfDate"]]['Income Tax Expense'] = list_element_dict["TaxProvision"]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'TaxProvision'

But I'm not sure if the formula is still correct when those values are absent , and having an exception in this case might be a better option?

@asafravid
Copy link
Owner

Great
To answer your (good) question about

"if the formula is still correct when those values are absent , and having an exception in this case might be a better option?"

So the approach in the code is to not have an exception but rather, for invalid values (say if some parameter in the core equation has for instance a division by 0):

  • If its a numerator parameter, yield it to be a very high (unattractive) value to raise the sss_value
  • If its a denominator parameter, yield it to be a very low (unattractive) value to raise the sss_value
    The lower sss_value is, the more attractive the stock is considered (compared with the other stocks scanned)

Since an exception will skip the other paramters further down and not calculate them its not the preferred option
but if the exception is over the value itself and gives an unattractive value for unexpected value-ed parameters - that is the way theings are handled in the code

Let me refer you to https://bit.ly/SssCoreEquation
image

I will merge your PR and then run again and after that I usually observe the .csv outputs and analyze the erroroneous values (the 1e50 sss_values of such stocks) to see what was wrong and if there's a bug in the code or if that value is expected

@asafravid asafravid merged commit 87e5db4 into asafravid:master Jan 21, 2024
10 checks passed
@asafravid
Copy link
Owner

I Ran the scan + multidim scan for TASE Jan 2024
I think your changes work very well
Thanks
I'll run for Nasdaq 100 + S&P500 + Russel 1000 later tonight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants