Closed SCCMAdmin closed 5 years ago
This was due to a change in the "class" name in the HTML so I've updated the script for the new name. It would be better to find a web API so we don't need to parse HTML. There are several non-free ones but I haven't found one that's free: https://stackoverflow.com/questions/4945626/free-api-or-similar-to-get-next-earnings-date-for-stocks
Hi @wahidsaleemi , Happy New Year!
I can confirm the updated script now works with or without the -CheckEarnings switch.
Here is an example of my first run: .\ConvertTo-TWS.ps1 -CheckEarnings -CheckEarnings switch specified. Running function MOH has earnings in 38 days CNC has earnings in 32 days You cannot call a method on a null-valued expression. At C:\Users\x\OneDrive\Investing\VectorVest\The Options Paycheck\DIY Process\Script Test Run\ConvertTo-TWS.ps1:33 char:25
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
CTB has earnings in 32 days SWKS has earnings in 31 days AAPL has earnings in 34 days CIEN has earnings in 60 days DAL has earnings less than 14 days, in 6. Removing from list. NVDA has earnings in 41 days DELL has earnings in 69 days ALGN has earnings in 25 days INOV has earnings in 46 days VFC has earnings in 42 days KMT has earnings in 34 days WUBA has earnings in 61 days ESL has earnings in 34 days APH has earnings in 19 days LH has earnings in 32 days CERN has earnings in 32 days DGX has earnings in 34 days EVH has earnings in 53 days FNSR has earnings in 69 days VCEL has earnings in 59 days PRAH has earnings in 47 days RGEN has earnings in 55 days You cannot call a method on a null-valued expression. At C:\Users\x\OneDrive\Investing\VectorVest\The Options Paycheck\DIY Process\Script Test Run\ConvertTo-TWS.ps1:25 char:17
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
FXH has earnings in 55 days HA has earnings in 31 days IBN has earnings in 26 days NTES has earnings in 33 days You cannot call a method on a null-valued expression. At C:\Users\x\OneDrive\Investing\VectorVest\The Options Paycheck\DIY Process\Script Test Run\ConvertTo-TWS.ps1:25 char:17
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
ABX has earnings in 33 days AER has earnings in 40 days RL has earnings in 34 days AAL has earnings in 20 days You cannot call a method on a null-valued expression. At C:\Users\x\OneDrive\Investing\VectorVest\The Options Paycheck\DIY Process\Script Test Run\ConvertTo-TWS.ps1:25 char:17
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
HQY has earnings in 20 days MD has earnings in 41 days CDAY has earnings in 31 days DCI has earnings in 60 days NEWR has earnings in 32 days OKTA has earnings in 61 days TTD has earnings in 55 days TRI has earnings in 41 days CRUS has earnings in 31 days DXCM has earnings in 53 days WTW has earnings in 53 days QRVO has earnings in 26 days ZG has earnings in 41 days FEYE has earnings in 41 days SAIL has earnings in 47 days You cannot call a method on a null-valued expression. At C:\Users\x\OneDrive\Investing\VectorVest\The Options Paycheck\DIY Process\Script Test Run\ConvertTo-TWS.ps1:25 char:17
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
BFB has earnings in 47 days EGHT has earnings in 20 days You cannot call a method on a null-valued expression. At C:\Users\x\OneDrive\Investing\VectorVest\The Options Paycheck\DIY Process\Script Test Run\ConvertTo-TWS.ps1:25 char:17
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
MDB has earnings in 20 days You cannot call a method on a null-valued expression. At C:\Users\x\OneDrive\Investing\VectorVest\The Options Paycheck\DIY Process\Script Test Run\ConvertTo-TWS.ps1:25 char:17
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
SOXL has earnings in 20 days WING has earnings in 55 days YELP has earnings in 33 days CDNA has earnings in 83 days COUP has earnings in 66 days RAMP has earnings in 32 days VST has earnings in 52 days GDDY has earnings in 55 days NTNX has earnings in 62 days MXL has earnings in 39 days ANGI has earnings in 33 days RPD has earnings in 38 days YUMC has earnings in 27 days PSTG has earnings in 62 days TNDM has earnings in 62 days ALKS has earnings in 40 days CARG has earnings in 62 days BGNE has earnings in 54 days SOHU has earnings in 31 days GBT has earnings in 53 days PLAN has earnings in 54 days ONCE has earnings in 46 days SGMO has earnings in 55 days NVCR has earnings in 55 days DOCU has earnings in 62 days SMAR has earnings in 59 days HALO has earnings in 46 days W has earnings in 55 days PTLA has earnings in 54 days CVNA has earnings in 60 days FGEN has earnings in 53 days VEDL has earnings in 34 days AMRN has earnings in 53 days TDOC has earnings in 53 days CLDR has earnings in 88 days ATRA has earnings in 53 days SE has earnings in 53 days SPOT has earnings in 34 days GTT has earnings in 62 days NKTR has earnings in 62 days RARE has earnings in 46 days CBLK has earnings in 20 days NTRA has earnings in 67 days NVRO has earnings in 55 days GDS has earnings in 67 days MDCO has earnings in 47 days FTCH has earnings in 41 days Converting to Interactive Brokers format... Done.
Only symbol DAL has earnings under 14 days and was removed from the output file, confirmed QA PASS.
Notice there are some small errors appearing every now and then. There is nothing wrong in the input CSV or output CSV when viewed in Excel. Whatever happened there, when importing into TWS, the same error count appears as an error with a line and you need to click OK to continue and eventually all verified no earnings under 14 days symbols are in TWS.
Logging new issue for API discussion so it is easier to resolve this issue once this is rounded out.
What do you think of these small error lines?
Thanks.
Those errors are from parsing the HTML and it could be multiple "errors" such as the symbol being invalid, the HTML page renderings slightly differently, foreign stocks, etc. This is why an API would be much better. Will close this and continue discussion about API on https://github.com/wahidsaleemi/finance/issues/3
Hi @wahidsaleemi. Firstly, thanks for your work. It looks interesting indeed.
I've successfully used ConvertTo-TWS to change vvsymbols.csv to twssymbols.csv. The output file is also good for import into TWS. Very smooth actually. π
PS C:\Temp\Script Test Run> .\ConvertTo-TWS.ps1 -CheckEarnings not specified. Skipping check of earnings dates. Converting to Interactive Brokers format... Done.
When I attempt to use this command: .\ConvertTo-TWS.ps1 -CheckEarnings the screen output is not so good and it has output file consequences too:
PS C:\Temp\Script Test Run> .\ConvertTo-TWS.ps1 -CheckEarnings You cannot call a method on a null-valued expression. At C:\Temp\Script Test Run\ConvertTo-TWS.ps1:20 char:17
You cannot call a method on a null-valued expression. At C:\Temp\Script Test Run\ConvertTo-TWS.ps1:27 char:25
You cannot call a method on a null-valued expression. At C:\Temp\Script Test Run\ConvertTo-TWS.ps1:28 char:25
AON has earnings less than 14 days, in . Removing from list. Converting to Interactive Brokers format... Done.
In this example, AON is the one symbol in the input file. https://stocksearning.com/stocks/aon/earnings-date shows next earnings are Earnings Date : Fri 1 Feb (In 61 Days).
So at this juncture something is broken. Connectivity to the source web site I assume (or the data has moved there). Another tip that may assist working out this issue is that when I've got multiple symbols in the input file, all of them are returning the above errors on the host, each and every symbol. Consequently, the output file includes them all too because processing has had an issue.
Here is the current source folder I'm using locally:
Mode LastWriteTime Length Name
-a---- 3/12/2018 11:59 AM 2485 ConvertTo-TWS.ps1
-a---- 3/12/2018 1:45 PM 20 twssymbols.csv
-a---- 3/12/2018 12:02 PM 13 vvsymbols.csv
Do any of your other scripts need to be in this folder? (If yes, please list which ones)
Are you still using these scripts actively? Perhaps the ones on this site aren't the latest copies.
Thanks!
PS. As there is little information here, a short description of each script in the readme would be great (or in the Wiki). I'm happy to assist that side.