stock_exchange / README.md
README.md
Raw

Stock Exchange

In this project a framework was given for the stock exchange, with a filled main.cc with the menu for the program and empty to be filled-in functions in beurs[.h]|.cc. There is also a tool program given to make files for a stock exchange, which can then be used in the main program as input for a stock exchange. In this project a stock exchange is made, where all upcoming price closes of the stocks in this exchange, the interest rate on money in the bank (not in a stock) and the provisions are known in advance. We then use several algorithms to determine - given a sum of money at the starting day - the most profitable sequence of selling and buying till the specified final day to find out the maximum amount of money possible at the final day. This is calculated in three different algorithms, namely: a bottom up algorithm, a top down algorithm and a recursive algorithm.

This project was a school project made in a group and on a git of the University. I therefore copied the whole project to this (private) repository. The language of the program, comments and (most) variables are in Dutch, since the course of this project was also in Dutch. If anything is unclear feel free to contact me.

Holding stocks

It is only possible to hold 0 or 1 share of a company. This means a holding of stocks for a day can be represented in bit strings with each bit representing a holding for a company (0 for not holding a share and 1 for holding a share). We implemented this in an other class called dag[.h]|.cc, which represents a day in the stock exchange, containing each share prices and interest yield of a specific day.

Making instances of a stock exchange

There are already 4 text files with a stock exchange given, which can be used to test the program. There is also the option to create own stock exchanges with the tool program. For this genereerinstantie.cc has to be compiled with its own Makefile called MakefileGenereer. The definitions of the variables the program asks you to fill in are given below:

  • tw: number of days from the starting day to the final day
  • n: number of companies a share price is generated
  • p: provision percentage
  • b0: sum of money at the starting day

After these variables one has to give a lower and upper boundary for a share price and a lower and upper boundary for the interest rate. the program then outputs a stock exchange with random share prices and interest rates within these boundaries.

My contribution

This project was made with a classmate and some code was already given in the framework, I therefore did not program all the code in this project. The following functions is my contribution:

  • functions in beurs[.h]|.cc:

    • resetBeurOpzet
    • leesIn
    • drukAfInvoer
    • rente
    • verkopen
    • kopen
    • aandeelIncombinatie
    • berekenEindbedrag
    • berekenBedrag
    • addTransacties
    • bepaalMaxBedragBU
    • drukAfTransacties
  • added function in standaard[.h]|.cc:

    • berekenMacht