tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/3063-stockglance2020-python-script-to-display-and-extract-the-totals-of-stockfund-unit-qty-balances-by-securityInfinite Kind: Discussion 2021-02-15T22:41:40Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-22T09:43:01Z2021-01-02T10:19:02ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>.</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-22T09:54:44Z2020-10-22T09:54:44ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Hi Stuart</p>
<p>I still get.</p>
<p>SyntaxError: Non-ASCII character in file 'C:\Users\derek\OneDrive\MONEYDANCE\Script to display and CSV Export Security Totals\StockGlance2020.py', but no encoding declared; see <a href="http://www.python.org/peps/pep-0263.html">http://www.python.org/peps/pep-0263.html</a> for details</p></div>derekkent23tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-22T10:29:59Z2020-10-22T10:29:59ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Hi, I can’t find any dodgy characters…? Sorry to ask. I wonder if the script copied properly for you? How did you get from GitHub? You should click RAW and then select all and copy/paste; or download that raw file…<br>
By all means send it back to me so I can look inside the file?</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-22T13:00:29Z2020-10-22T13:00:29ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Resolved: FYI - in GitHub you either need to right click the file link and save link as, or click RAW and then copy/paste the script. (If you just save what GitHub displays then you are just saving an HTML web page and not the actual script).</p>
<p>Regards Stuart</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T07:35:19Z2020-10-23T07:35:21ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>The display works fine (I understand you will add the cost & gain at a<br>
later stage).<br>
However the filing seems to have problems, no file being filed ... Pls see<br>
below ...</p>
<p>Beginning file C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py at Fri<br>
Oct 23 09:31:59 CEST 2020<br>
StuWareSoftSystems...<br>
StockGlance2020.py....... Version: 4d<br>
Parameters...<br>
Hiding Hidden Securities...<br>
Hiding Inactive Accounts...<br>
Hiding Hidden Accounts...<br>
Selecting ALL Currencies...<br>
Selecting ALL Securities...<br>
Selecting ALL Accounts...<br>
Including Cash Balances - WARNING - this is per account!<br>
Splitting Securities by account - WARNING, this will disable sorting....<br>
Will strip non-ASCII characters - e.g. Currency symbols from output<br>
file... Using Delimiter: ,<br>
Will display Stock balances and then extract to file:<br>
C:\CC_DATA\MONEYDANCE\extract_stock_balances.csv (NOTE: Should drop non utf8 characters...)<br>
!!!FILE WILL BE GENERATED AFTER YOU CLOSE THE TABLE VIEW WINDOW!!! Error running script: Traceback (most recent call last):<br>
File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1904, in<br>
ExportDataToFile() File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1845, in ExportDataToFile<br>
if debug: print "Opening file and writing ", len(rawDataTable), "records" IOError: (13, 'Permission denied',<br>
'C:\CC_DATA\MONEYDANCE\extract_stock_balances.csv') Traceback (most recent call last):<br>
File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1904, in<br>
ExportDataToFile() File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1845, in ExportDataToFile<br>
if debug: print "Opening file and writing ", len(rawDataTable), "records" IOError: [Errno 13] Permission denied:<br>
'C:\CC_DATA\MONEYDANCE\extract_stock_balances.csv'</p>
<hr>
<p>Cyril COUTEN<br>
Mobile : +33 6 18 40 80 65</p></div>Cyril Coutentag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T07:41:48Z2020-10-23T07:41:48ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Very strange. It’s a permission denied issue.. :<br>
- Do you have permissions to the folder? - Was the file already open somewhere else? - Can you try again, choose a different file? - can you run in debug and send me that output?</p>
<p>Thanks</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T07:54:38Z2020-10-23T07:54:38ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Here is the debug narratives ... I have deleted all the details which is<br>
not relevant ...</p>
<p>Beginning file C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py at Fri<br>
Oct 23 09:47:42 CEST 2020<br>
StuWareSoftSystems...<br>
StockGlance2020.py....... Version: 4d<br>
DEBUG turned on<br>
Parameters...<br>
Hiding Hidden Securities...<br>
Hiding Inactive Accounts...<br>
Hiding Hidden Accounts...<br>
Selecting ALL Currencies...<br>
Selecting ALL Securities...<br>
Selecting ALL Accounts...<br>
Including Cash Balances - WARNING - this is per account!<br>
Splitting Securities by account - WARNING, this will disable sorting....<br>
Will strip non-ASCII characters - e.g. Currency symbols from output<br>
file... Using Delimiter: ,<br>
In grabTheFile ()<br>
Scriptpath: C:\Users\cycou.moneydance\Documents<br>
Non Mac platform detected: Therefore I will run JFileChooser() to get<br>
filename....<br>
Will display Stock balances and then extract to file:<br>
C:\CC_DATA\PP\extract_stock_balances retry 948.csv (NOTE: Should drop non utf8 characters...)<br>
In StockGlance2020 ()<br>
In myJTable ()<br>
!!!FILE WILL BE GENERATED AFTER YOU CLOSE THE TABLE VIEW WINDOW!!! In createAndShowGUI ()<br>
In getTableModel ()<br>
MD Book: CCFinances<br>
Base Currency: EUR : Euro<br>
getAllCurrencies(): [EDENRED, MONCEY, Israeli New Shekel, INTERPARFUMS,<br>
WENDEL, FAIVELEY TRANSPORT, ALSTOM, TIEPOLO RDT, Icelandic Krona, Egyption<br>
Pound, BARCLAYS<br>
...............deleted..............</p>
<p>Skipping Security with 0 shares..: CARREFOUR Curr: EUR Price: 47.83<br>
Qty: 0 In getFooterModel ()<br>
Generating the footer table data....<br>
getFooterModel: was not allOneCurrency..<br>
Hiding unused Currency Column...<br>
ScreenSize: java.awt.Dimension[width=1920,height=1080]<br>
Main JTable heights....<br>
Row Count: 372<br>
RowHeight: 16<br>
Intercell spacing: 1<br>
Header height: 20<br>
Insets, Top/Bot: java.awt.Insets[top=0,left=0,bottom=1,right=0] 0 1<br>
Total scrollpane height: 980<br>
Scrollbar height: java.awt.Dimension[width=0,height=0] 0<br>
Footer JTable heights....<br>
Row Count: 19<br>
RowHeight: 16<br>
Intercell spacing: 1<br>
Header height: 0<br>
Insets, Top/Bot: java.awt.Insets[top=0,left=0,bottom=1,right=0] 0 1<br>
Total scrollpane height: 335<br>
Scrollbar height: java.awt.Dimension[width=48,height=10] 10<br>
Total frame height required: 980 + 335 + Intercells: 0 1 = 1317<br>
Waiting for JFrame() to close... Wait number...: 1<br>
Waiting for JFrame() to close... Wait number...: 2<br>
Waiting for JFrame() to close... Wait number...: 3<br>
Waiting for JFrame() to close... Wait number...: 4<br>
Waiting for JFrame() to close... Wait number...: 5<br>
Waiting for JFrame() to close... Wait number...: 6<br>
Waiting for JFrame() to close... Wait number...: 7<br>
Waiting for JFrame() to close... Wait number...: 8<br>
Waiting for JFrame() to close... Wait number...: 9<br>
Waiting for JFrame() to close... Wait number...: 10<br>
Waiting for JFrame() to close... Wait number...: 11<br>
Waiting for JFrame() to close... Wait number...: 12<br>
Waiting for JFrame() to close... Wait number...: 13<br>
In windowClosing ()<br>
Waiting for JFrame() to close... Wait number...: 14<br>
No longer waiting....<br>
In ExportDataToFile ()<br>
Opening file and writing 392 records<br>
Error running script: Traceback (most recent call last):<br>
File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1904, in<br>
ExportDataToFile() File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1845, in ExportDataToFile<br>
if debug: print "Opening file and writing ", len(rawDataTable), "records" IOError: (13, 'Permission denied', 'C:\CC_DATA\PP\extract_stock_balances<br>
retry 948.csv')<br>
Traceback (most recent call last):<br>
File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1904, in<br>
ExportDataToFile() File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1845, in ExportDataToFile<br>
if debug: print "Opening file and writing ", len(rawDataTable), "records" IOError: [Errno 13] Permission denied:<br>
'C:\CC_DATA\PP\extract_stock_balances retry 948.csv'</p>
<hr>
<p>Cyril COUTEN<br>
Mobile : +33 6 18 40 80 65</p></div>Cyril Coutentag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T07:59:30Z2020-10-23T07:59:30ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Can you try a directory that’s not C:\CC_DATA\MONEYDANCE\ ? And or the previous version of script? I’ve not changed anything here….</p>
<p>Thanks</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T08:10:39Z2020-10-23T08:10:40ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Same ... This time filing on c:\ ...<br>
To be honest, apart from the 1st time where it worked, I have skipped<br>
checking the real filing ... So you must have changed something between the<br>
very first version and the subsequent ones ?</p>
<p>No longer waiting....<br>
In ExportDataToFile ()<br>
Opening file and writing 392 records<br>
Error running script: Traceback (most recent call last):<br>
File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1904, in<br>
ExportDataToFile() File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1845, in ExportDataToFile<br>
if debug: print "Opening file and writing ", len(rawDataTable), "records" IOError: (13, 'Permission denied', 'C:\extract_stock_balances.csv')<br>
Traceback (most recent call last):<br>
File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1904, in<br>
ExportDataToFile() File "C:\CC_DATA\MONEYDANCE\StockGlance2020_v21oct_4d.py", line 1845, in ExportDataToFile<br>
if debug: print "Opening file and writing ", len(rawDataTable), "records" IOError: [Errno 13] Permission denied: 'C:\extract_stock_balances.csv'</p>
<hr>
<p>Cyril COUTEN<br>
Mobile : +33 6 18 40 80 65</p></div>Cyril Coutentag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T08:17:45Z2020-10-23T08:17:45ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>OK… Hang fire, I will send you a new script soon and we will see what that does… If you send me your email I can email you directly? (You will have to write it as email space at space domain)</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T08:22:58Z2020-10-23T08:22:58ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>sure : <a href="mailto:cycouten@gmail.com">cycouten@gmail.com</a></p>
<hr>
<p>Cyril COUTEN<br>
Mobile : +33 6 18 40 80 65</p></div>Cyril Coutentag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-23T17:07:45Z2020-10-23T17:07:45ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>V4e (beta) of script with many enhancements</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-26T09:41:09Z2021-01-02T10:18:37ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>For completeness version 5 of this script released - attached. The latest can always be found here:<br>
<a href="https://yogi1967.github.io/MoneydancePythonScripts/">https://yogi1967.github.io/MoneydancePythonScripts/</a></p>
<p>Rollup of v4a to v4h enhancements. Key changes: enhanced filters; enhanced parameters; Parameters now persist between sessions; better rounding; New option to split Securities by Account; Enhanced display, sort, highlighting, formatting, scrolling etc; added cost basis, gain and % fields; enhanced CSV creation, including ability to exclude totals (for Pivot tables). By Stuart Beesley - StuWareSoftSystems - October 2020.</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-26T18:31:21Z2020-10-26T18:31:21ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>The display is fine ; if it was possible to sort stocks when display the<br>
detail by account ... or by total amount ...<br>
The file saving is still the same problem : to a folder of my choice, does<br>
not do it ; if to the user directory, as yesterday, it works ....<br>
In the end, it works well ; now I can have the % by stock ober my total<br>
portfolio irrespective of the accounts where they are held ... Great<br>
progress.<br>
Tks !</p>
<p><em>Debug when it does not work ... interestingly the detail of the csv lines appear in the debug report ...</em><br>
Generating the footer table data....<br>
getFooterModel: was not allOneCurrency..<br>
Hiding unused Currency Column...<br>
ScreenSize: java.awt.Dimension[width=1920,height=1080]<br>
Main JTable heights....<br>
Row Count: 372<br>
RowHeight: 16<br>
Intercell spacing: 1<br>
Header height: 20<br>
Insets, Top/Bot: java.awt.Insets[top=0,left=0,bottom=1,right=0] 0 1<br>
Total scrollpane height: 780<br>
Scrollbar height: java.awt.Dimension[width=0,height=0] 0<br>
Footer JTable heights....<br>
Row Count: 19<br>
RowHeight: 16<br>
Intercell spacing: 1<br>
Header height: 0<br>
Insets, Top/Bot: java.awt.Insets[top=0,left=0,bottom=1,right=0] 0 1<br>
Total scrollpane height: 220<br>
Scrollbar height: java.awt.Dimension[width=48,height=10] 10<br>
Total frame height required: 780 + 220 + Intercells: 0 1 = 1002<br>
Waiting for JFrame() to close... Wait number...: 1<br>
Waiting for JFrame() to close... Wait number...: 2<br>
In windowClosing ()<br>
Waiting for JFrame() to close... Wait number...: 3<br>
No longer waiting....<br>
In ExportDataToFile ()<br>
Opening file and writing 392 records<br>
Oh no - File IO Error!<br>
[Errno 13] Permission denied: 'C:\CC_DATA\PP\extract_stock_balances2.csv'<br>
Path: C:\CC_DATA\PP\extract_stock_balances2.csv<br>
!!! ERROR - NO FILE WRITTEN - SORRY! (WAS FILE OPEN, PERMISSIONS ETC?) As file write failed, writing to console.....:</p>
<p>*Debut when it works * Main JTable heights....<br>
Row Count: 372<br>
RowHeight: 16<br>
Intercell spacing: 1<br>
Header height: 20<br>
Insets, Top/Bot: java.awt.Insets[top=0,left=0,bottom=1,right=0] 0 1<br>
Total scrollpane height: 780<br>
Scrollbar height: java.awt.Dimension[width=0,height=0] 0<br>
Footer JTable heights....<br>
Row Count: 19<br>
RowHeight: 16<br>
Intercell spacing: 1<br>
Header height: 0<br>
Insets, Top/Bot: java.awt.Insets[top=0,left=0,bottom=1,right=0] 0 1<br>
Total scrollpane height: 220<br>
Scrollbar height: java.awt.Dimension[width=48,height=10] 10<br>
Total frame height required: 780 + 220 + Intercells: 0 1 = 1002<br>
Waiting for JFrame() to close... Wait number...: 1<br>
Waiting for JFrame() to close... Wait number...: 2<br>
In windowClosing ()<br>
Waiting for JFrame() to close... Wait number...: 3<br>
No longer waiting....<br>
In ExportDataToFile ()<br>
Opening file and writing 392 records<br>
CSV file C:\Users\cycou\extract_stock_balances2.csv created, records<br>
written, and file closed..<br>
In saveParameters ()<br>
Will try to save parameter file: ..\StuWareSoftSystems.dict<br>
myParameters now contains...:</p>
<hr>
<p>Cyril COUTEN<br>
Mobile : +33 6 18 40 80 65</p></div>Cyril Coutentag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-10-31T12:46:19Z2020-10-31T12:46:19ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>StockGlance2020 version 5a. Finally found and fixed issue where it fails to create file on some Windows 10 installations (due to system folder access restrictions) .. Attached</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-11-01T08:35:34Z2020-11-01T08:35:34ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>It works but ... if overwrite the previous csv file, for any reason it will<br>
not file it.<br>
Just tried to run it on a new file, and re-run it : the new file was not<br>
created.</p>
<hr>
<p>Cyril COUTEN<br>
Mobile : +33 6 18 40 80 65</p></div>Cyril Coutentag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-11-02T20:24:56Z2020-11-02T20:24:56ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>As discussed with Cyril, that problem is not reproducible, so we are assuming all good for now.</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-11-05T16:09:57Z2020-11-05T16:09:57ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>StockGlance2020 version 5c - hopefully the final version. Added parameter to allow user not to round prices... (optional)</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-11-11T17:43:34Z2020-11-11T17:43:34ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Latest update (v5e)</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-11-27T10:31:14Z2020-11-27T10:31:14ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>All, if you use my StockGlance2020 script or others from me, please update them all to the latest version. ZIP of all attached.</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422020-12-14T17:44:37Z2020-12-14T17:44:37ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Now updated to both a script and/or an Extension version. Extension version only works from MD2021.2012 onwards. Attached.</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422021-01-02T10:20:01Z2021-01-02T10:20:01ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>Latest scripts always here:<br>
<a href="https://yogi1967.github.io/MoneydancePythonScripts/">https://yogi1967.github.io/MoneydancePythonScripts/</a></p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/486610422021-02-15T22:41:35Z2021-02-15T22:41:35ZStockGlance2020 - Python script to display and extract the totals of stock/fund unit qty balances by security <div><p>To StockGlance2020 users. All my extract scripts have now been consolidated into a single script/extension called extract_data. The old individual scripts have been decommissioned.</p>
<p><a href="https://yogi1967.github.io/MoneydancePythonScripts/">https://yogi1967.github.io/MoneydancePythonScripts/</a></p></div>Stuart Beesley (Mr Toolbox)