2
$\begingroup$

I have obtained the financial data of a company using Entity["Company", ...]["Dataset"]:

Entity["Company","SingaporePressHoldings::dngt3"]["Dataset"]

Unfortunately, the units for revenue, cash, accounts payable, etc. are in US dollars rather than the original currency used in the company's published financial report.

Is there a way to view the dataset of financial information of a company using the original currency?

$\endgroup$
4
$\begingroup$

You can use UnitConvert to convert money quantities to "SingaporeDollars". Here's a function to do this:

toNativeCurrency[e_Entity] := With[
    {c = e["City"]["Country"]["CurrencyCode"]},
    e["Dataset"][All, Replace[q_Quantity?MoneyQ :> UnitConvert[q, c]]]
]

MoneyQ[q_Quantity] := !FreeQ[UnitDimensions[q], "MoneyUnit"]

For your company (all those currency conversions are slow):

dataset = toNativeCurrency[Entity["Company","SingaporePressHoldings::dngt3"]]

enter image description here

Look at the InputForm to verify that the correct currency is being used:

Normal[dataset][[1]] //InputForm

Quantity[1.7875263488897222*^8, "SingaporeDollars"]

Addendum

If you want to convert currencies using the date of the property, then you can use the Dated function. For example:

UnitConvert[
    Quantity[23, Dated["USDollars", {2019,1,1}]/"Years"],
    Dated["SGD", {2019,1,1}]
]

Quantity[31.52219146124501, "Years"^(-1) DatedUnit["SingaporeDollars", {2019, 1, 1}]]

The following function carries out this idea:

toNativeCurrency[e_Entity] := With[
    {c = e["City"]["Country"]["CurrencyCode"]},
    KeyValueMap[<|#1 -> toDatedCurrency[Quiet[e[#1, "Date"]], #2, c]|>&, e["Dataset"]]
]

MoneyQ[q_Quantity] := !FreeQ[UnitDimensions[q], "MoneyUnit"]
toDatedCurrency[date_DateObject, value_, c_] := ReplaceAll[
    value,
    Quantity[v_, u_] /; !FreeQ[u, "USDollars"] :> UnitConvert[
        Quantity[v, u] /. "USDollars" -> Dated["USDollars", date],
        Dated[c, date]
    ]
]
toDatedCurrency[_, value_, _] := value

For your company (all those currency conversions are slow):

dataset = toNativeCurrency[Entity["Company","SingaporePressHoldings::dngt3"]]

enter image description here

You might ask another question about how to format dated quantities so that they look better.

$\endgroup$
  • $\begingroup$ I know about currency conversion, but does this really show the amount of Singapore dollars on the day the financial report was released? There might be a huge error involved if we are using current exchange rates to convert past data... $\endgroup$ – Flux Jun 28 at 9:02
  • $\begingroup$ @Flux You can use CurrencyConvert to convert the values on the exact day of interest. However, I think you might have to find information on when the report was released from another source as Mathematica doesn't seem to include dates for the values it reports. $\endgroup$ – MassDefect Jun 28 at 16:18
  • 1
    $\begingroup$ I feel uncomfortable with this solution. I believe the original data comes from Morningstar in the local currency. Converting the figures to USD (presumably done by the dataset) and back to the local currency again introduces errors. $\endgroup$ – Flux Jun 29 at 11:40
  • 1
    $\begingroup$ I found a way to get particular fields in the local currency without needing any currency conversion (see this). Can you incorporate that into your answer so that your solution doesn't need any currency conversions? $\endgroup$ – Flux Jul 29 at 9:14
1
$\begingroup$

To get one particular field, for example AccountsPayable, in the local currency instead of in USD:

company = Entity["Company","SingaporePressHoldings::dngt3"]
company[EntityProperty["Company",
                       "AccountsPayable", 
                       {"CurrencyType" -> "LocalCurrency",
                        "TimeSeriesType" -> "Annual",
                        "Date" -> 2010 }]]

The option {"CurrencyType" -> "LocalCurrency"} selects the local currency.

Admittedly, this answer only addresses the problem of extracting a particular field in the local currency. It does not answer the question of displaying the entire dataset in the local currency. I will leave it to others to answer that question as I am still new to Mathematica.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.