tag:infinitekind.tenderapp.com,2009-01-14:/discussions/investments/4357-accessing-security-fields-in-python-scriptsInfinite Kind: Discussion 2019-08-29T01:30:23Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/471599842019-04-11T17:59:26Z2019-04-11T17:59:26ZAccessing security fields in Python Scripts<div><p>Something like this</p>
<pre>
<code>from com.infinitekind.moneydance.model import AccountUtil, CurrencyType
book = moneydance.getCurrentAccountBook()
currencies = book.getCurrencies();
for c in currencies:
if (c.getCurrencyType() != CurrencyType.Type.SECURITY):
continue
print("s=%s, n=%s, ur=%d" % (c.getTickerSymbol(), c.getName(), c.getUserRate()))</code>
</pre>
<p>You might also want to take a look at Mike Bray codes on the security priceloader which can provide some hints on various "fields" that you can access via getter</p>
<p><a href="https://bitbucket.org/mikerb/moneydance-2015/src/master/src/">https://bitbucket.org/mikerb/moneydance-2015/src/master/src/</a></p>
<p>For example, see <a href="https://bitbucket.org/mikerb/moneydance-2015/src/master/src/com/moneydance/modules/features/securitypriceload/MyTableModel.java">https://bitbucket.org/mikerb/moneydance-2015/src/master/src/com/mon...</a><br>
and look for getUserRate()</p>
<p>Best,</p></div>hleofxquotestag:infinitekind.tenderapp.com,2009-01-14:Comment/471599842019-04-11T18:49:34Z2019-04-11T18:49:34ZAccessing security fields in Python Scripts<div><p>The best source for fields is the Javadoc documentation in the developer's toolkit. For MD 2019 look at version 5.1 at <a href="https://infinitekind.com/developer">https://infinitekind.com/developer</a>.</p>
<p>I have attached the toolkit for MD 2015/17 (version 4.0)</p></div>Mike Bray (Quote Loader Author)tag:infinitekind.tenderapp.com,2009-01-14:Comment/471599842019-05-30T01:28:57Z2019-05-30T01:28:57ZAccessing security fields in Python Scripts<div><p>Hi Mike</p>
<p>Thanks for the tips, one particular field that I am struggling to access is the Security's Currency.</p>
<p>When I run your File Display utility on my account book I can see in the Security entry an item that you title Security Currency which contains the correct currency code for the item. The only MD method that I can find that seems to relate is "getCurrencyChoice" however this returns null.</p>
<p>Can you point me in the right direction please.</p>
<p>Regards</p>
<p>Peter</p></div>priggall