DeepAI
Log In Sign Up

Implementation of a Port-graph Model for Finance

In this paper we examine the process involved in the design and implementation of a port-graph model to be used for the analysis of an agent-based rational negligence model. Rational negligence describes the phenomenon that occurred during the financial crisis of 2008 whereby investors chose to trade asset-backed securities without performing independent evaluations of the underlying assets. This has contributed to motivating the search for more effective and transparent tools in the modelling of the capital markets. This paper shall contain the details of a proposal for the use of a visual declarative language, based on strategic port-graph rewriting, as a visual modelling tool to analyse an asset-backed securitisation market.

READ FULL TEXT VIEW PDF

page 1

page 2

page 3

page 4

12/09/2019

QualiBD Tool: Implementation Details

This paper describes the tools, technologies, and frameworks used in the...
10/16/2022

Biased or Limited: Modeling Sub-Rational Human Investors in Financial Markets

Multi-agent market simulation is an effective tool to investigate the im...
06/11/2022

Bounded strategic reasoning explains crisis emergence in multi-agent market games

The efficient market hypothesis (EMH), based on rational expectations an...
05/16/2018

Market Self-Learning of Signals, Impact and Optimal Trading: Invisible Hand Inference with Free Energy

We present a simple model of a non-equilibrium self-organizing market wh...
08/17/2021

Simulation and estimation of an agent-based market-model with a matching engine

An agent-based model with interacting low frequency liquidity takers int...
03/29/2019

Reconstructing Rational Functions with FireFly

We present the open-source C++ library FireFly for the reconstruction of...
05/05/2021

Simulation and estimation of a point-process market-model with a matching engine

The extent to which a matching engine can cloud the modelling of underly...

1 Introduction

In this paper we examine the process involved in the design and implementation of a port-graph model to be used for the analysis of an agent-based rational negligence model. Rational negligence describes the phenomenon that occurred during the financial crisis of 2008 whereby investors chose to trade asset-backed securities without performing independent evaluations of the underlying assets. This proposal is motivated by the interest an analyst or policy-maker might have in analysing whether or not the purchase of a particular class of asset-backed security ought, going forward, to be subjected to a full due-diligence.

By replacing more traditional Dynamic Stochastic General Equilibrium (DSGE) models [7] with heterogenous, proactive, agent-based models able to produce more realistic representations, a more efficient system is produced. Such a system is able to support rapid prototyping, run system simulations, and, thanks to its formal semantics, also reason about system properties. Turning to a declarative port-graph transformation system facilitates the analysis of processes of interest. This is because it is able to model the dynamic behaviour of complex systems given that its declarative nature and visual aspects produces a shorter distance between mental picture and implementation. Such a tool is not only able to convert a black box model into a white box but also provide an extensively flexible platform as shall be seen later. There are non-visual elements, such as an inbuilt strategy language, but details of the states produced by the resulting strategy programs are highlighted in a visual trace/derivation tree.

In addition, over extant approaches, the rewrite rules that drive graph transformation systems are an intuitive and natural way of expressing dynamic, structural changes which are generally more difficult to model using traditional simulation approaches where the structure of the model is usually fixed [6]. Over many of the declarative languages used within agent-based simulation tools, this approach, given its visual declarative nature, provides more conceptualization support. The use of the port-graph highlights the heterogeneous agent-based nature of the model. Given support for attributes at component-level more realistic simulations can be produced. As a graph transformation system underlying, port-graphs are in addition particularly useful in the development of more concise graph models and in the production of more concise model results given support of both topology and data at the same time. The port-graph makes comprehensive modeling much easier to manage and provides extensive conceptualization support.

Contributions.

We outline the typical specification of a graph program that can be used to represent the workings of a small Rational Negligence agent-based system. We include broad implementation details highlighting design choices and alternatives that could otherwise have guided our approach. We also carry out a thorough validation of the model with respect to its equational specification producing a base case that provides an effective platform for incrementally increasing the complexity and scope of the model. In a previous work; [3], we have defined a hierarchical port-graph extension useful in producing a more integrated model.

Overview.

This paper is organised as follows: We briefly examine the general structure of a simple Port-graph Transformation System and equational semantics of the chosen Rational Negligence model in Section 2. Details of the actual implementation can be found in Section 3 and Section 4 examines the results of key tests and checks on the system. We finally conclude and briefly outline future plans in Section 5.

2 Background

2.1 Port-graph Transformation Systems

A port graph is a graph where nodes have explicit connection points, called ports, and edges are attached to ports. Nodes, ports and edges are labelled by a set of attributes describing properties such as colour, shape, etc. Port graphs are transformed by applying port graph rewrite rules. We refer to [5] for a formal definition of labelled port graphs, where labels are records, i.e., lists of pairs attribute-value. The values can be concrete (numbers, Booleans, etc.) or abstract (expressions in a term algebra, which may contain variables). More precisely:

Definition 1 (Signature)

A port graph signature consists of the following pairwise disjoint sets: , a set of attributes; , a set of attribute variables; , a set of values; , a set of value variables.

Definition 2 (Attributed Port Graphs)

Let be pairwise disjoint sets. A port graph over a signature is a tuple where is a finite set of nodes ( range over nodes); is a finite set of ports ( range over ports); is a finite set of edges between ports ( range over edges; edges are undirected and two ports may be connected by more than one edge); is a set of records over , and is a set of functions , and such that

  • for each edge , the two ports connected by e

  • for each port , , the node to which p belongs

  • is the labelling function that returns the record associated to a component

Each maintains an attribute called whose value is the list of names of the ports attached to , that is, , , satisfying the following constraint:

Definition 3 (Port-graph Rewrite Rule)

A port graph rewrite rule is a port graph consisting of two subgraphs and together with a node (called arrow node) that captures the correspondence between the ports of and the ports of , and includes a condition that will be checked at matching time. More precisely, each of the ports in the arrow node has an attribute Type, which can have three different values: bridge, wire and blackhole, values that indicate how a rewriting step using this rule should affect the edges that connect the redex to the rest of the graph and that satisfy the following conditions:

  1. A port of type bridge must have edges connecting it to and to (one edge to and one or more to ).

  2. A port of type blackhole must have edges connecting it only to (at least one edge).

  3. A port of type wire must have exactly two edges connecting to and no edge connecting to .

Let and be two port graphs over the same signature . A port graph morphism maps nodes, ports and edges of to those of such that the attachment of ports and the edge connections are preserved, and all attributes are preserved except for variables in , which must be instantiated in (attribute instantiation can take place within the algorithm tab associated with the rule). Intuitively, the morphism identifies a subgraph of that is equal to except at positions where has variables (at those positions could have any value).

Definition 4 (Port Graph Morphism)

More formally given two port graphs and over the same signature , a morphism f from X to Y, denoted , and with a definition domain , is a family injective functions such that:

  1. are injective i.e. distinct components are not identified

  2. if then

  3. if for some then



Note that can also instantiate variables

We denote by the subgraph of consisting of the set of nodes, ports and edges that are images of nodes, ports and edges in .

Let be a port graph. A rewrite step via the port graph rewrite rule is obtained by replacing in a subgraph by , where is a morphism from to satisfying . More precisely:

Definition 5 (Match)

[5] Let be a port graph rewrite rule and a port graph. We say a match of the left-hand side (i.e., a redex) is found if: there is a port graph morphism from to (hence is a subgraph of ), holds, and for each port in that is not connected to the arrow node, its corresponding port in must not be an extremity in the set of edges of . This last point ensures that ports in that are not connected to the arrow node are mapped to ports in that have no edges connecting them with ports outside the redex, thus ensuring that there will be no dangling edges when is replaced by .

For a given graph, several outcomes on application of a rule may be possible (due to the intrinsic non-determinism of rewriting). Strategies in rewriting systems are a means of controlling the creation of rewriting steps and improving rewriting opportunities. A sequence of rewriting steps is called a derivation. A derivation tree is a collection of derivations with a common root. Intuitively, the derivation tree is a representation of the possible evolutions of the system starting from a given initial state (each derivation provides a trace, which can be used to analyse and reason about the behaviour of system). In Porgy [5], the strategy language allows us to control the way derivations are generated. The strategy expression setPos(crtGraph) sets the position graph as the full current graph. If is a rule, then the strategy randomly selects one possible occurence of a match of rule in the current graph , which should superpose the position subgraph but not superpose the banned subgraph . This strategy fails if the rule cannot be applied. and denote success and failure, respectively. The strategy expression is used to check if the rule can be applied (i.e., if there is a match for the left hand side of the rule in the current graph) but does not apply the rule. tries strategy and if it fails then tries to apply . If both strategies fail then the whole statement fails. selects one of the transformations , …

according to the given probability distribution

. executes strategy (not exceeding iterations if the optional parameter is specified) while succeeds. repeatedly executes a strategy , not exceeding times. It can never fail (when fails, it returns ).

2.2 The Rational Negligence Model.

As defined in [8] “Securitisation is the process of converting cash flows arising from underlying assets or debts/receivables (typically illiquid such as corporate loans, mortgages, car loans and credit cards receivables) due to the originator into a smoothed liquid marketable repayment stream” and this ensures that the originator can raise asset-backed finance through loans or the issuance of debt securities also known as assets. An originator is any financial intermediary with a portfolio of assets on its balance sheet. In a securitisation, assets are selected, pooled and transferred to a tax neutral, liquidation-efficient (i.e bankruptcy avoiding), Special Purpose Vehicle (SPV), who funds them by issuing securities.

In the core rational negligence model [2], the profit expected by an agent (e.g., a bank) from trading an asset depends on whether or not follows the negligence rule, i.e., the rule of not performing independent risk assessment. Let

be a binary variable indicating whether or not the agent is following the negligence rule, then

can be characterised by the following equations, where is the probability of asset toxicity, is the average of all ’s in the domain, is the cost of purchasing an asset (note that the payoff from successfully reselling the asset is normalised to unity), is the cost of performing a complete risk analysis, is the number of trading partners of the seller bank and is the set of agents.

  • Expected profit for when following the negligence rule, i.e., when , if buys an asset and then tries to sell it to :

    This is because if the asset is toxic then will loose if checks, and will have a profit of if does not check. Of course does not know a priori whether

    will or not follow the rule, but it can estimate

    as the average of all the values of in the system, . Note that when the profit is as expected

  • Similarly, the expected profit for when the rule is not followed, i.e., , is defined by:

    This is because if the asset is toxic, then will not buy it (losing only ), but if it is not toxic then it will resell it with a profit of .

So the best response of agent to a buying request is determined by analysing the projected profitability of assuming a negligent approach over a diligent approach:

Following [2], we implement a model that mimicks the transactions that follow the trading of one asset since this is sufficient to perform validations against equivalent DSGE analyses. The goal of the model is to study the evolution of the system till fixed point or stable state is reached i.e., in this case, a state such that all potential buyers in the universe of discourse no longer alternate between diligent and non-diligent behaviour in their handling of the purchase of a particular asset. Details of the set of port-graph rules that encapsulate this computation can be found in Tables 1 and 2. The beginanalysis rule in Table 1 performs the profitability check.

3 Implementation

We represent the full ABS (Asset-backed Securitization) universe hierarchically as several initial graphs. Port graph rewriting rules and strategies are used to control the step-wise evolution of the graphs and to create a derivation tree that can be used for plotting and analysing parameter values. The asset trading model sits at the top level of the model hierarchy and it is non-deterministic in nature. Below this system, also able to handle asset pricing and valuation issues, lie several deterministic subsystems that model origination, structuring of the deal, SPV transfers and profitability of the sale.

Figure 1: All Tiers Flattened and Condensed

We chose to model asset-transfer transactions using a combination of global and local data, and a global state, the node (an indicator of market behaviour obtained as the average value of each individual bank’s approach, represented by the local lower-case attribute and not to be confused with the global value ). A indicator node is used within a rule to detect whether the market has reached a stable state. Tables 3 and 4 contain a description of the nodes used. Alternative designs are possible, highlighting the flexibility of the approach: For example, local copies of the z-attribute could be used to propagate negligent/diligent behaviour using propagation algorithms borrowed from social network models whereby information is transmitted, or in this case received, based on the actions of neighbours or neighbours-of-neighbours or other clusters [10]. The details of this alternative model shall be future work.

Name of Rule                        Description
requesttobuy Sends a request-to-buy message to a random bank changing
the name of this node to (PotentialBuyer).
A copy of the rule:
beginanalysis Computes profitability , of , generating
a node Theta with attribute DeltaU1U0 = .
Computation in the algorithm tab is as follows:
updatez Updates the attribute in node Z. The new value in
is .
Computation in the algorithm tab is as follows:
Table 1: Rewrite Rules
Name of Rule                        Description
followresult Applies if DeltaU1U0 .
As additional visualisation support, it generates a follow
node if more profitable to not do a full risk analysis.
Arrow-node Application Condition:
If
deviationresult Applies if DeltaU1U0
As additional visualisation support, it generates a deviation
node if more profitable to do a full risk analysis
(Similar to followresult).
followdecision Transfers asset and prepares for a new transaction (i.e. cleans
up after the decision negligence rule), updating bank’s attribute ,
updating the Change counter if necessary.
deviationdecision Transfers asset and prepares for a new transaction (i.e. cleans
up after the decision to deviate from the negligence rule), updating
bank’s attribute , updating the Change counter if necessary
(Similar to followdecision).
change Sets the Change counter back to 0 if greater than 0.
Computation in the algorithm tab is as follows:
Table 2: Rewrite Rules

Tables 3 and 4 describe the nodes in the system and their ports respectively.

Entity Attribute Description
Buyer (B/PB) Payoff (payoff) Returns from re-selling an asset.
Bank/Potential
Indicates whether or not,
as a rule, the institution
performs independent risk analyses
Bank ID (b_id) Bank identifier
Asset Current Value (c_val) Cost of purchasing an asset
Probability An asset is toxic if the borrowers
of Toxicity (p_tox) of the underlying loans are
likely to default or are in default
Actualised Toxicity Current toxicity level
(a_tox)
Perception (pe) External rating of the asset
by rating agencies
Due Diligence Cost Full cost of an independent
(ddcost) risk assessment
Change change Change in bank approach
Sum of change Sums all changes in a current cycle
(sumofchange)
z Represents the global average z
Number of Iterations Counter that keeps track of
Z (numofiterations) AllTrade iterations
Number of Agents Variable that keeps track of
(numofagents) number of banks
Theta U1 Profitability of being negligent
U0 Profitability of being diligent.
DeltaU1U0 Difference between U1 and U0.
Table 3: Nodes and Attributes
Entity Ports Description
Bank O (Owns) Edges attached to this port highlight
assets owned by the bank
C (Contacts) Communication channel with another bank
Asset OB (Owned_by) Connects the asset to its current owner
Z EN (Environment) Global entity that tracks current average sentiment
PotentialBuyer O (Owns) Links to assets owned by the bank
C (Contacts) Communication channel with another bank
GE (Generates) Declares a relationship with an analysis node
Change CH (change) Counter that keeps track of behaviour changes
Theta PB (Produced_by) Entity that produces this computation helper
Table 4: Ports in each kind of node

After the creation of a comprehensive set of rules, reduction strategies were created that defined the sub-graphs to be selected for evaluation and which rules should be applied to the starting state of the model and it is from this point that the derivation tree begins to undergo construction as the execution strategy calls on rules that create step-wise transformations. Specifically, the asset transfer processes are governed by the strategies AllTrade and FixedPointSearch (see Strategies 1 and 2 below), using 8 rewrite rules summarised in Tables 1 and 2.

Also highlighting flexibility is the fact that a variant of strategy AllTrade can simply replace the orelse operator by a ppick

operator, and then begin to model probabilistic choice of logit type between following or deviating from the negligence rule. The probability distribution used in this case implements the stochastic “trembles” described in 

[4] and can be written within our strategy environment as follows:

ppick(followResult, deviationResult, udfLogitModel)

where udfLogitModel is a function that reads the profitability of being negligent or diligent (attributes U1 and U0 in the node Theta of the graph produced by the relevant rule) and returns the following values as a list:

where is the current agent number and is the intensity of choice parameter that controls the ease by which fixed point is reached (as specified in [4]).

1 #AllTrade#;
2 while(match(change))do(
3   one(change);
4   #AllTrade#)
Strategy 1 FixedPointSearch
1 setPos(crtGraph);
2 repeat(one(requesttobuy);
3   one(beginanalysis);
4   (one(deviationresult);one(deviationdecision)) orelse
5   (one(followresult);one(followdecision))
6   setPos(crtGraph);
7   one(updatez))(k)
Strategy 2 AllTrade

4 Testing

A successful base case validation has seen test results (see Figure 2 where average Z count value is plotted versus depth of the simulation) line up qualitatively with results from the more traditional ABM simulation given in [2]. In particular, for high values of (that is, high probability of toxicity), we observe the expected result when the initial state contains a mixture of negligent and diligent agents: a sharp drop in , corresponding to a sharp switch in average approach (i.e., more banks decide to perform independent analysis), which in turn will generate stability. An illustration of this can be seen in Figure (c)c and notice that given high due diligence costs Figures (b)b and (e)e highlight a negligent approach whereas Figures (c)c and (h)h reflect the favouring of a diligent approach. However, even for high toxicity, if the initial state is a set of negligent agents, the model reaches equilibrium without switching approach as seen in Figure (l)l.

(a) Low Toxicity, High Due Diligence Cost,Mixture of Diligent and Negligent Banks
(b) High Toxicity, High Due Diligence Cost, Mixture of Diligent and Negligent Banks
(c) High Toxicity, Low Due Diligence Cost, Mixture of Diligent and Negligent Banks
(d) Low Toxicity, Low Due Diligence Cost, Mixture of Diligent and Negligent Banks
(e) High Toxicity, High Due Diligence Cost, Diligent Banks
(f) Low Toxicity, High Due Diligence Cost, Diligent Banks
(g) Low Toxicity, Low Due Diligence Cost, Diligent Banks
(h) High Toxicity, Low Due Diligence Cost, Diligent Banks
(i) Low Toxicity, High Due Diligence Cost, Negligent Banks
(j) High Toxicity, High Due Diligence Cost, Negligent Banks
(k) Low Toxicity, Low Due Diligence Cost, Negligent Banks
(l) High Toxicity, Low Due Diligence Cost, Negligent Banks
Figure 2: Experiment Results. (y-axis: Count of the number of negligent banks. The intersection of x and y axes in the case of a starting universe of purely diligent banks corresponds to the co-ordinates (0,0) as opposed to (11,0) in the case where we begin with negligent banks. Curves tending upwards reflect a negligent equilibrium result)

5 Some Related Work and Conclusion

Fundamentally, general purpose agent-based simulation tools and platforms111http://jasss.soc.surrey.ac.uk/18/1/11.html like JAS, Netlogo, AgentBuilder, Swarm, MASON, Repast, SeSAm, GAMA and INGENIAS Development Kit, support an imperative object-oriented approach to model development, facilitating the modular approach to coding. EMERALD and JADE middleware integrate a declarative approach but without any visualization support. Other tools and languages like Stratego, Maude and ELAN [9] support a pure term-writing approach which in the case of Maude is augmented by probabilistic features. What can we do in our chosen approach that we could not have achieved using existing solutions cited? The visual, declarative nature of graph transformation systems are welcome in the cases where users seek to primarily focus on describing what the system should accomplish in terms of problem domain versus the how, and maintain strong conceptualization support that can subsume the details of spatial and topological constraints.

We have shown that strategic port-graph rewriting provides a basis for the design and implementation of a multi-level graph model able to capture the inner workings of the sub-prime secondary securitisation market in a manner that reflects the aforementioned rational negligence phenomenon and that provides optional operational support.

We observed that a declarative approach is much easier to program and maintain, and the incremental manner in which development was approached (e.g. coarse-grained rules tested before finer optimizations), in addition to the modular nature of development, eliminated many coding bugs. Interacting with the system was not convoluted in anyway and being able to view the states generated by each rule within the resulting derivation tree was useful in addition to being able to view nodes within the tree that maintained specific properties.

In future, we hope to further develop the hierarchical model to be able to capture all details of the full securitisation life-cycle and cater for more dynamically to changing parameters.

References

  • [1]
  • [2] Kartik Anand, Alan Kirman & Matteo Marsili (2013): Epidemics of rules, rational negligence and market crashes. The European Journal of Finance 19(5), pp. 438–447, doi:10.1080/1351847X.2011.601872.
  • [3] Nneka Ene, Maribel Fernández & Bruno Pinaud (2017): Attributed Hierarchical Port Graphs and Applications. In: Proceedings Fourth International Workshop on Rewriting Techniques for Program Transformations and Evaluation, WPTE@FSCD 2017, Oxford, UK, 8th September 2017., pp. 2–19, doi:10.4204/EPTCS.265.2.
  • [4] J.Doyne Farmer, M. Gallegati, C. Hommes, A. Kirman, P. Ormerod, S. Cincotti, A. Sanchez & D. Helbing (2012): A complex systems approach to constructing better models for managing financial markets and the economy. The European Physical Journal Special Topics 214(1), pp. 295–324, doi:10.1140/epjst/e2012-01696-9.
  • [5] Maribel Fernández, Hélène Kirchner & Bruno Pinaud (2017): Strategic Port Graph Rewriting: an Interactive Modelling Framework. Research Report, N/A. Https://hal.inria.fr/hal-01251871.
  • [6] Juan de Lara, Esther Guerra, Artur Boronat, Reiko Heckel & Paolo Torrini (2014): Domain-specific discrete event modelling and simulation using graph transformation. Software and System Modeling 13(1), pp. 209–238, doi:10.1007/s10270-012-0242-3.
  • [7] Charles Ka Yui Leung & Thomas A. Lubik: Introduction: Dynamic Stochastic General Equilibrium Modelling and the Study of Asia-Pacific Economies. doi:10.1111/j.1468-0106.2012.00579.x.
  • [8] Sheri Markose, Yang Dong & Bewaji Oluwasegun (2008): An Multi-Agent Model of RMBS, Credit Risk Transfer in Banks and Financial Stability: Implications of the Subprime Crisis.
  • [9] Narciso Martí-Oliet, José Meseguer & Alberto Verdejo (2005): Towards a Strategy Language for Maude. Electronic Notes in Theoretical Computer Science 117, pp. 417 – 441, doi:10.1016/j.entcs.2004.06.020. Proceedings of the Fifth International Workshop on Rewriting Logic and Its Applications (WRLA 2004).
  • [10] Jason Vallet, Hélène Kirchner, Bruno Pinaud & Guy Melançon (2015): A Visual Analytics Approach to Compare Propagation Models in Social Networks. In A. Rensink & E. Zambon, editors: Proc. Graphs as Models, GaM 2015, EPTCS 181, pp. 65–79, doi:10.4204/EPTCS.181.5.