-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPortfolio.h
34 lines (31 loc) · 1.16 KB
/
Portfolio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "stdafx.h"
#include "Priceable.h"
#include "ContinuousTimeOption.h"
#include "MonteCarloPricer.h"
/**
* A Portfolio contains options in various quantities
*/
class Portfolio : public Priceable {
public:
/* Virtual destructor */
virtual ~Portfolio() {};
/* Returns the number of items in the portflio */
virtual int size() const = 0;
/* Add a new security to the portfolio, returns the index
at which it was added */
virtual int add( double quantity,
std::shared_ptr<ContinuousTimeOption> security ) = 0;
/* Update the quantity at a given index */
virtual void setQuantity( int index,
double quantity ) = 0;
/* Compute the current price */
virtual double price( const MultiStockModel& model )
const = 0;
/* Price this portfolio using one consistent set of monte carlo simulations */
virtual double monteCarloPrice(
const MultiStockModel& model, const MonteCarloPricer& pricer) const = 0;
/* Creates a Portfolio */
static std::shared_ptr<Portfolio> newInstance();
};
void testPortfolio();