tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/6771-currencysnaphot-how-to-convert-getrate-to-a-priceInfinite Kind: Discussion 2022-03-27T20:29:10Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/495797642022-01-04T03:48:02Z2022-01-04T04:01:42ZCurrencySnaphot how to convert getRate() to a price<div><p>I'm trying to get all the recorded prices for a security (CurrencyType). I iterate through all the snapshots from security.getSnapshots(). I can't figure out how to get the value that snapshot.getRate() returns converted to a dollars and cents value. I know I'm missing something fundamental but I don't know what it is.</p>
<p>Once I have that value, how do I adjust it for any splits so the price is shown relative to today's date once splits are accounted for.</p>
<p>Thanks for your help.</p>
<p>UPDATE: I figured it out, you have to divide 1 by the rate.</p>
<p>I'm using the following to get the split adjusted rate. Is this the best way to get it from a snap rate?<br></p>
<pre>
<code>adjustedPrice = 1/security.adjustRateForSplitsInt(snap.getDateInt(), snap.getRate());</code>
</pre></div>Bob Btag:infinitekind.tenderapp.com,2009-01-14:Comment/495797642022-01-04T07:56:27Z2022-01-04T07:56:27ZCurrencySnaphot how to convert getRate() to a price<div><p>Hi Bob,</p>
<p>You've got it exactly. I should also add that the snap.getRate() method will return the rate relative to the security's associated currency and not necessarily the base currency of the file.</p>
<p>You might also be interested in this method which does most of the work for you:<br>
<a href="https://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/model/CurrencyUtil.html#getSplitAdjustedRelativeUserPrice(com.infinitekind.moneydance.model.CurrencyType,com.infinitekind.moneydance.model.CurrencyType,int)">https://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mod...</a></p>
<p>Thanks!<br>
Sean</p>
<p>--<br>
Sean Reilly<br>
Developer, The Infinite Kind<br>
<a href="https://infinitekind.com">https://infinitekind.com</a></p></div>Sean Reillytag:infinitekind.tenderapp.com,2009-01-14:Comment/495797642022-01-06T02:06:07Z2022-01-06T02:06:07ZCurrencySnaphot how to convert getRate() to a price<div><p>Thanks very much</p></div>Bob B