How are prices stored in raw JSON export?
I'm trying to write a C# parser for the raw JSON exported by Moneydance.
I can see what I think should be security pricing entries in the JSON, like this one, which appears (from the date and volume information) to refer to the screenshot attached to this post):
{
"hi": "0.04185851820845542",
"lo": "0.04242681374628765",
"relrt": "0.04196391103650861",
"dt": "20170822",
"vol": "58477779",
"rhi": "0.04185851820845542",
"rlo": "0.04242681374628765",
"urt": "0.04196391103650861",
"obj_type": "csnap",
"id": "f7606bdd-e8fc-4bff-90dc-966d93a8b70c",
"curr": "038478e5-04e1-42be-a2b5-d080cbc938b4",
"ts": "1515110230867"
},
However, I don't see the pricing information in the JSON. Nor can I find it by doing a text search of the raw JSON for the values displayed in the screenshot (although it's possible I missed them as the raw JSON file is 58MB).
Is the price information encoded somehow in the JSON shown above? Or is it not included in the raw JSON export?
- Mark
-
Screenshot_2023-07-21_202454.png 59.7 KB
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Stuart Beesley ... on 22 Jul, 2023 04:32 AM
The csnap record is the pricing.
“urt” is the price
You need to apply the magic
1 / 0.04196391103650861 = 22.83
All prices stored are inverted.
For some elements you might have to also get the currency’s decimal places and apply a pow 10 factor. But I think prices are raw.
Hope this helps?
2 Posted by mark on 22 Jul, 2023 04:38 AM
LOL! I thought of several things but never considered that. Thanx!
Do you know why they’re stored inverted?
3 Posted by Stuart Beesley ... on 22 Jul, 2023 11:55 AM
It’s something to do with ease of currency conversions between different currencies. It’s a mathematical ‘trick’ so that you are storing currencies as units of 1 (rather than units of a specific currency). It looks odd and clunky but it’s probably a very good technique.
https://www.investopedia.com/terms/r/reciprocal-currency.asp
mark closed this discussion on 27 Jul, 2023 06:53 PM.