Example of EMT data

EMT data for one fund realized with PHP

This PHP based example fetches EMT data for one fund API endpoint by cURL and places all parts in a HTML structure.

HANSAsecur

ISIN: DE0008479023 / WKN: 847902

SRRI 6
Ongoing costs 1.58% (31.12.2021)
Transaction costs 0.40% (30.04.2022)
Incidental costs 0.00% (31.12.2021)
Entry costs n/a
Governance process B
Compatible for clients with esg preferences N
Other specific investment need N
all fund details
<?php

// Get cURL resource
$curl = curl_init();

// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL            => 'https://api.hansainvest.com/api/v2/emtdata/DE0008479023/',
    CURLOPT_USERAGENT      => 'Sample cURL Request',
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
    ],
]);

// Send the request & save response to $respJson
$respJson = curl_exec($curl);
$data     = json_decode($respJson);

// Close request to clear up some resources
curl_close($curl);

$percentFormatter = new NumberFormatter('en_US', NumberFormatter::PERCENT);
$percentFormatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 2);

?>

<h3 class="hi-profile-name"><?php echo $data->fund->name; ?></h3>
<h4 class="hi-profile-isin">ISIN: <?php echo $data->fund->isin; ?> /
    WKN: <?php echo $data->fund->wkn; ?></h4>
<table class="table hi-profile">
    <tbody>
    <tr>
        <th scope="row">SRRI</th>
        <td class="hi-emt-data"><?php echo $data->emt_data->srri; ?></td>
    </tr>
    <tr>
        <th scope="row">Ongoing costs</th>
        <td class="hi-emt-data">
            <?php echo $percentFormatter->format($data->emt_data->ongoing_costs); ?>
            (<?php echo date(
                'd.m.Y',
                strtotime($data->emt_data->ongoing_costs_date)
            ); ?>)
        </td>
    </tr>
    <tr>
        <th scope="row">Transaction costs</th>
        <td class="hi-emt-data">
            <?php echo $percentFormatter->format($data->emt_data->transaction_costs); ?>
            (<?php echo date(
                'd.m.Y',
                strtotime($data->emt_data->transaction_costs_date)
            ); ?>)
        </td>
    </tr>
    <tr>
        <th scope="row">Incidental costs</th>
        <td class="hi-emt-data">
            <?php echo $percentFormatter->format($data->emt_data->incidental_costs); ?>
            (<?php echo date(
                'd.m.Y',
                strtotime($data->emt_data->incidental_costs_date)
            ); ?>)
        </td>
    </tr>
    <tr>
        <th scope="row">Entry costs</th>
        <td class="hi-emt-data">
            <?php if ($data->emt_data->entry_costs !== null): ?>
                <?php echo $percentFormatter->format($data->emt_data->entry_costs); ?>
            <?php else: ?>
                <abbr title="not available">n/a</abbr>
            <?php endif; ?>
        </td>
    </tr>
    <tr>
        <th scope="row">Governance process</th>
        <td class="hi-emt-data">
            <?php if ($data->emt_data->governanceprocess !== null): ?>
                <?php echo $data->emt_data->governanceprocess; ?>
            <?php else: ?>
                <abbr title="not available">n/a</abbr>
            <?php endif; ?>
        </td>
    </tr>
    <tr>
        <th scope="row">Compatible for clients with esg preferences</th>
        <td class="hi-emt-data">
            <?php if ($data->emt_data->compatible_for_clients_with_esg_preferences): ?>
                <?php echo $data->emt_data->compatible_for_clients_with_esg_preferences; ?>
            <?php else: ?>
                <abbr title="not available">n/a</abbr>
            <?php endif; ?>
        </td>
    </tr>
    <tr>
        <th scope="row">Other specific investment need</th>
        <td class="hi-emt-data">
            <?php if ($data->emt_data->other_specific_investment_need): ?>
                <?php echo $data->emt_data->other_specific_investment_need; ?>
            <?php else: ?>
                <abbr title="not available">n/a</abbr>
            <?php endif; ?>
        </td>
    </tr>
    </tbody>
</table>
<a class="hi-profile-link" href="<?php echo $data->fund->url; ?>">all fund details</a>