wahidsaleemi / finance

Stock scripts
MIT License
3 stars 0 forks source link

Earnings in $numOfDays Value Not Updating Per Symbol #4

Open SCCMAdmin opened 5 years ago

SCCMAdmin commented 5 years ago

Using latest ConvertTo-TWS with new earnings source (earningswhispers.com), the first symbol returns the earnings in number of days value. All subsequent symbols are repeating this value without writing new data. e.g. executed with no switch, with -checkearnings switch and with both switches:

PS C:\Temp\finance-master> .\ConvertTo-TWS.ps1 -CheckEarnings not specified. Skipping check of earnings dates. Converting to Interactive Brokers format... Done.

PS C:\Temp\finance-master> .\ConvertTo-TWS.ps1 -CheckEarnings -CheckEarnings switch specified. Running function MOH has earnings in 23 days CNC has earnings in 23 days CTB has earnings in 23 days SWKS has earnings in 23 days AAPL has earnings in 23 days CIEN has earnings in 23 days DAL has earnings in 23 days NVDA has earnings in 23 days … FTCH has earnings in 23 days Converting to Interactive Brokers format... Done.

PS C:\Temp\finance-master> .\ConvertTo-TWS.ps1 -CheckEarnings -UseLegacyEarningsSource -CheckEarnings and -UseLegacyEarningsSource switch specified. Running legacy function MOH has earnings in 36 days CNC has earnings in 30 days You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:34 char:25

CTB has earnings in 30 days SWKS has earnings in 29 days AAPL has earnings in 32 days CIEN has earnings in 58 days DAL has earnings less than 14 days, in 4. Removing from list. NVDA has earnings in 39 days … FTCH has earnings in 39 days Converting to Interactive Brokers format... Done.

PS C:\Temp\finance-master>

Please review and correct @wahidsaleemi . Whilst it is cracked open update line 56 to: Write-Verbose "Done accessing earningswhispers.com!"

Thanks. 👍

wahidsaleemi commented 5 years ago

Had the wrong variable in there, should be fixed now.

SCCMAdmin commented 5 years ago

It appears the data has now been corrected but there are some new issues. I will list them as they are fresh in console. Point 4 needs correction under this logged issue. The others I will log as new issues. I think stocksearnings.com has now proven to be unreliable in its data as I've discovered in the last 2 weeks. I know you kept it in your code, as there is no reason to delete code and erase past efforts, but my personal opinion is dump it. That said, Point 4 is a non point if you do. If it stays as a legacy reference/comparison until we discover better sources in future (all good with me), I think point 4 is very low priority considering the new data and more reliable data source is working.

Test run using new data attached (rename to .csv when you download it) vvsymbols.txt Results in (one fix and three issues - one is FYI only):

PS C:\Temp\finance-master> .\ConvertTo-TWS.ps1 -CheckEarnings -CheckEarnings switch specified. Running function DECK has earnings in 24 days FTNT has earnings in 30 days COG has earnings in 18 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

IEF has earnings in 18 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

IEI has earnings in 18 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

TFI has earnings in 18 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

VGIT has earnings in 18 days GPS has earnings in 43 days M has earnings in 37 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

NAC has earnings in 37 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

SCHO has earnings in 37 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

SHY has earnings in 37 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

VCSH has earnings in 37 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

BNDX has earnings in 37 days WARNING: One or more headers were not specified. Default names starting with "H" have been used in place of any missing headers. Exception calling "ParseExact" with "3" argument(s): "String reference not set to an instance of a String. Parameter name: s" At C:\Temp\finance-master\ConvertTo-TWS.ps1:60 char:17

You cannot call a method on a null-valued expression. At C:\Temp\finance-master\ConvertTo-TWS.ps1:63 char:17

UUP has earnings in 37 days RPM has earnings less than 14 days, in -2. Removing from list. FNV has earnings in 28 days BGS has earnings in 22 days GTX has earnings less than 14 days, in -61. Removing from list. ERJ has earnings in 22 days ADNT has earnings in 32 days ESPR has earnings in 24 days MNTA has earnings in 30 days Converting to Interactive Brokers format... Done.

  1. One fix: correct number of days appears for known symbols by the data source. Nice! This issue can be closed for new data source.

  2. One issue/enhancement (will log new issue for this): note RPM above. Shows earnings less than 14 days because the number is under 14. A negative number means the earnings have already past. -2 means 2 days ago. I will log a new issue to code around this scenario. Output suggestion might be "RPM had earnings -2 days ago, HV could be falling from elevated levels" and don't remove this from the list. The "-2" is the value/variable. Using Volatility Lab in TWS does actually show RPM with elevated HV coming down off the earnings peak - coming days should show a cooling per theory

  3. One issue FYI only / enhancement (will log new issue for 3.b.): see between COG and GPS, there are errors. The data does not know these symbols, IEF, IEI, TFI, VGIT. Confirmed by visiting https://www.earningswhispers.com/ and typing in IEF, the error page appears: https://www.earningswhispers.com/error?aspxerrorpath=/stocks.aspx. This is what the code is trying to parse and can't do it. 3.a. I found these symbols are all ETFs. Therefore there are no earnings announcements at the data source. These could be filtered out in VV prior to exporting as a workaround. Or better still, filter out ETFs in the UniSearch searches. 3.b. I would suggest coding for this error page when detected and outputting "IEF symbol was not found. Removing from list." *yellow text like other removals. Make a code comment to suggest ETFs are not hosted and therefore will be removed from the output file even though we have not stated ETF in the output comment. It could be erroneous to do that as a symbol which is not an ETF could be legitimately missing and the suggestion above is sufficient for stocks and ETFs which are missing symbols.

  4. I just used the -UseLegacyEarningsSource switch and found similar issues with the ETFs. That's logical. But I uncovered another issue. All known symbols are outputting like: MNTA has earnings today or tomorrow. Removing from list. (each symbol from the sample input file that is known). This issue needs to stay open for legacy data source.

I hope that is useful. :-) Please don't feel overwhelmed. We are making awesome progress! PS. I should have a chance tomorrow to log the new issues/enhancement requests (2 and 3.b).

SCCMAdmin commented 5 years ago

As above: Item 1 is closed. Item 2 is now logged as issue #5 Item 3 is now logged as issue #6

Item 4 requires work if legacy earnings source will be kept. (Very low priority)