API-Banking: Effizienter Rand

Description
Integration Method 1
Integration Method 2
Complete example
API Documentation

Description

This component can be used to optimise investments like the Markowitz-approach.

Requirements

To use the component, you will need these third-party libraries:
• JQuery
• Highcharts
• Tinycolor
• DSER Services

Integration Method 1

Integration

You will need additional scripts and stylesheets to use the component:

• The app-specific CSS rules, the default theme is included by default.
• The app-specific scripts files to get the plugin up and running.

Include the stylesheets to your page:

Simply copy this block into the HTML-HEAD section of your website. It is required to load the correct styling of the component.

<link rel="stylesheet" href="https://api.niiio.me/public/effizienter-rand/effizienter-rand.css" >

Create a container:

Create a new <div> container for the component inside your <body> tag. You can use the our default CSS-style by adding the class „dser-theme“ to the container.

<div id="effizienter-rand-container" style="height: 400px; width: 400px;"></div>

Asynchronous loading of required files with RequireJS

Include the required script files to your page:

• Advantage: You only need to import a few files, all required script will get loaded asynchronously through RequireJS
• Disadvantage: If you already have a script file which defines an anonoymous AMD module, then sadly this method won’t work for you.

Inlude the required javascript files:

Load the plugin scripts by adding this block at the end of the BODY section.

<script type="text/javascript" src="https://api.niiio.me/public/require-config.js"></script>
<script type="text/javascript" src="https://api.niiio.me/public/common/require.js"></script>

Setup and initialize the component:

Add this block right after the included script files.

<script type="text/javascript">
    require(['dser.effizienterRand'], function () {
        $("#effizienter-rand-container").effizienterRand({
            token: '<your-custom-api-token>'
        });
    });
</script>

Please send us an email to receive your custom API token. It is required to initialize the plugin. Replace the part with your actual token.

Please refer to the chapter “API documentation” for a complete overview of all options and properties and how to customize the component.

Integration Method 2

Integration

You will need additional scripts and stylesheets to use the component:

• The app-specific CSS rules, the default theme is included by default.
• The app-specific scripts files to get the plugin up and running.

Include the stylesheets to your page:

Simply copy this block into the HTML-HEAD section of your website. It is required to load the correct styling of the component.

<link rel="stylesheet" href="https://api.niiio.me/public/effizienter-rand/effizienter-rand.css" >

Create a container:

Create a new <div> container for the component inside your <body> tag. You can use the our default CSS-style by adding the class „dser-theme“ to the container.

<div id="effizienter-rand-container" style="height: 400px; width: 400px;"></div>

Regular loading of script files, without RequireJS

Include the required script files to your page:

• Advantage: This method will work on most pages.
• Disadvantage: You have to include a lot more scripts.

Inlude the required javascript files:

Load the plugin scripts by adding this block at the end of the BODY section.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://github.highcharts.com/bugfix/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinycolor/1.1.2/tinycolor.min.js"></script>
<script src="https://api.niiio.me/public/common/color/ColorService.js"></script>
<script src="https://api.niiio.me/public/common/charts/tooltip/ChartTooltipService.js"></script>
<script src="https://api.niiio.me/public/common/services/StockService.js"></script>
<script src="https://api.niiio.me/public/effizienter-rand/js/EffizienterRandChartConfigBuilder.js"></script>
<script src="https://api.niiio.me/public/effizienter-rand/js/EffizienterRandChartService.js"></script>
<script src="https://api.niiio.me/public/effizienter-rand/js/OptimizationService.js"></script>
<script src="https://api.niiio.me/public/effizienter-rand/jquery.effizienter-rand.js"></script>

Setup and initialize the component:

Add this block right after the included script files.

<script type="text/javascript">
$(function() {
    $("#effizienter-rand-container").effizienterRand({
        token: '<your-custom-api-token>'
    });
});
</script>

Please send us an email to receive your custom API token. It is required to initialize the plugin. Replace the part with your actual token.

Please refer to the chapter “API documentation” for a complete overview of all options and properties and how to customize the component.

Complete example

<!doctype html>
<html class="no-js" lang="">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" crossorigin="anonymous">
    <link href="https://api.niiio.me/public/common/default-theme.css" rel="stylesheet">
    <link href="https://api.niiio.me/public/effizienter-rand/css/effizienter-rand.css" rel="stylesheet">
</head>
<body>

<div class="row">
    <div class="col-xs-8 col-xs-offset-2">
        <div id="effizienter-rand-container" class="dser-theme"></div>
    </div>
</div>

<script type="text/javascript" src="https://api.niiio.me/public/require-config.js"></script>
<script type="text/javascript" src="https://api.niiio.me/public/common/require.js"></script>

<script type="text/javascript">
    require(['dser.effizienterRand'], function () {
        $("#effizienter-rand-container").effizienterRand({
            token: '<your-custom-api-token>',
            onStockAllocationSelected: function(stockAllocation) {
                console.log(stockAllocation);
            },
            wkns: ["#90004","710000","348195","728156","764930","765846","769088","812925","847603","848665","849108","972137","972219","974177","976168","977020","977261"]
        });
    });
</script>

</body>
</html>

API Documentation

Initialize

Please provide your custom API token on initialization, otherwise the plugin won’t work.

$("#effizienter-rand-container").effizienterRand({
    token: '<your-custom-api-token>',
    onStockAllocationSelected: function(stockAllocation) {
        console.log(stockAllocation);
    },
    wkns: ["#90004","710000","348195","728156","764930","765846","769088","812925","847603","848665","849108","972137","972219","974177","976168","977020","977261"]
});

Required configuration options

Key Description
token The security-token to check if your connection is valid.

Extended and optional configuration options

Key Description Default
baseURL url to DSER api service https://api.niiio.me
onAllocationSelected
(StockAllocation)
function

returns an bject containing the selected allocation on the eff. Rand.

StockAllcoation: {
wkn, isin, name, risk, yield, share
}

wkns array of the Wertpapierkennnummern (Securities identification numbers) to be used for the calculation of optimal stock allocations. [ ]