Demo: Unit Testing in Visual Studio (C#)

Introduction

In this post, a demonstration on how to perform unit testing in Microsoft Visual Studio is covered. The demo is structured as follows:

  • create a console app with accompanying c sharp classes, and
  • perform unit testing on the methods used in the created classes.

In writing a program, implementing unit testing is a key step. The unit test project can be thought of as a document which can be used to understand the functionality and expected outcomes of the code. It is good practice to test the methods used in a program to check that the program delivers the expected results, and in performing the tests errors in the code can be picked up and corrected.

It often occurs that in the production process, a program needs to be extended. In extending the program, the results from one method should not alter the functioning/outcome of other methods. When unit testing is in place, errors can easily be picked up if it were the case that adding new code altered the outcome of existing working code. In this way, the existing working code is validated again when new code is added to the project. Using unit testing therefore serves as an important quality check of a program in the production process. Continue reading

Hierarchy in MATLAB

Introduction to Hierarchy

This blog is part 2 on the object oriented programming in Matlab. Consider reading out previous blog first.

In classifying objects, hierarchy in the objects is a common occurrence, where subclasses and super-classes can be defined. In the example of a rectangle class, a superclass namely Shape can be defined, where the superclass provides a more broadly defined class for a shape, and rectangle a more narrowly defined class for a specific type of shape. We can extend our example, by including the creation of Triangle and Circle classes, which are also subclasses of the superclass Shape.

Continue reading

Demo: How to create objects using OOP in MATLAB in under 10 minutes!

Introduction

In this post, a demonstration on how to create objects using object oriented programming (OOP) in MATLAB is covered using easy to follow steps, and the basic MATLAB syntax. The demo is structured as follows:

  • creating objects using the basic MATLAB syntax,
  • hierarchy in objects (including Abstract method functions), and
  • initialising and validating property values.

OOP is an approach to programming, where focus is put on design patterns and classification systems. It forms a consistent framework which is recognisable, and can be easily reused and extended by others. OOP is ideal to use when designing complex models, because of the flexibility and extensibility of the code, where a simple model can easily be extended to cover a more complex model. Continue reading

Making Charts using Octave's Financial Package

In a previous blog we showed how to visualise stock prices for Deutsch Bank using core graphics functionalities of Octave. In this blog we will take a look at some finance-specific plot types available in the Financial Package on Octave Forge. This blog will show how to fetch some price data for Apple and use the data to make a:

  • High Low plot
  • Bolling Bands plot
  • Point Figure plot
  • Renko plot

First we will consider snippets of code to download data and create each type of plot. In the appendix a complete listing of code is given so you can easily reproduce the results on your own machine.

Continue reading

Using Octave For Asset Price Simulation

In this blog we want to demonstrate the power of Octave for doing simulations. Specifically we will take a look at the Black Scholes formula and how fast an option price computed using Monte Carlo simulation will converge to the actual value using the closed-form solution. The idea is to demonstrate how Octave can be used for this kind of simulations. In a previous blog we showed how to created plots, so here will will focus on the simulation only. The mantra when using Octave is "use vectors and matrices". If you can pull that off, your code will be efficient. On the other hand if you need to resort to for-loops, that will slow things down significantly.

Continue reading

Octave analysis of Deutsche Bank

In this blog the basics of generating and saving plots to file using Octave will be demonstrated. We are going to make plots and do some basic data analysis on the Deutsche Bank stock prices. Deutsche has been under pressure these last days, which rose our curiosity.

Deutsche Bank shares collapsed by nearly 7% taking it close to a 30-year low on Thursday evening following reports that hedge funds were pulling assets from it amid suggestions the German government may be forced to bail it out.

Deutsche Bank's share price approaches 30-year low -The Guardian

 

Continue reading

Octave

We are looking at Octave as an alternative or extension to Matlab. Octave has the major advantage of being open source allowing you to share your code with ease and no additional cost. Anybody interested in your code can simply download and install Octave and start executing and editing the code. Matlab code can also be shared, but a license fee is charged for each Matlab installation. Depending on your target audience this might significantly reduce your reach.

For those of you unfamiliar with Octave:

GNU Octave is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. Octave is normally used through its interactive command line interface, but it can also be used to write non-interactive programs. The Octave language is quite similar to Matlab so that most programs are easily portable.

GNU Octave

We will be blogging about experiences to help others in their considerations of Octave and in the hope to gather feedback from the financial engineering community.

Ugly Duckling consulting for Rabobank

We are very happy to be working with one of the leading banks in the field of food and agri worldwide. Rabobank is an international financial services provider operating on the basis of cooperative principle serving approximately 8.8 million clients around the world.

The balance sheet risk of the bank is managed by the ALM team. Ugly Duckling will be supporting this team in an automation project with the aim of increasing efficiency and reducing operational risk.

Tapestry part VII - Wrap Up

Introduction

In this blog series we presented various blogs on Tapestry with the goal to show how to build a simple "Hello World" style application that gives GUI using HTML pages and presents a WEB API. By using Stream Response it's possible for Tapestry to return a stream, and with that we build a simple API. Testing this setup is a little involved and explained in detailed in the last blog of the series. We present a short overview of the blogs here. Continue reading