Back to The Blog

Maintaining Market Integrity

Trade Surveillance using RDFox

Trade Surveillance using RDFox

Photo by Nicholas Cappello on Unsplash

When the Food and Drug Administration (FDA) rejected the cancer drug Erbitux in 2001, share price in the pharmaceutical company ImClone dropped significantly. Investors were severely impacted, while those close to Samuel Waksal, the CEO, appeared to benefit. An SEC investigation uncovered that Waksal advised various executives, friends and family to sell their stock, knowing the drug was going to fail the assessments. For this action, Waksal faced seven years in prison and $4.3 million in fines.[1]

Insider trading is a serious offence, punishable with jail time and/or heavy fines. It involves “trading in a public company’s stock by someone who has non-public, material information about that stock for any reason”.[2] By having access to insider information, one party has an advantage over another, with financial rewards (if undetected). The kind of information in question, is not available to the wider public and would significantly impact the integrity of the markets, by swaying decisions by investors, fund managers or individuals to buy or sell certain shares.

Investigating insider trading is a complex and time intensive job. This article will show how RDFox can be used to improve the investigation process through rules and ontologies. Furthermore, a hypothetical investigation will demonstrate how trades can be quickly and effectively examined.

Investigating insider trading

There are a number of reasons why a trade might be viewed as suspicious. For example, a stock might performs better than expected and gain 10% of its value in a day. When this occurs, trades will be flagged by an automated system to the internal investigators who must determine whether the trader was acting within the bounds of usual activity, or whether the action constitutes insider trading. Most trades will not be suspicious, while a few will be referred for further investigation.

Banks and trading institutions use significant resources (money, software and time) to investigate the flagged trades, which can amount to several thousand a day. The flags themselves lack context, and the investigators are often overloaded with information making it difficult for them to quickly and effectively determine the nature of the trade. A method which extracts the key information in a timely fashion would improve the efficiency of this system and have substantial financial benefits.

Improving insider trading investigations

To streamline the investigation process, the investigators need all the relevant context and information, without being overloaded. This information needs to be consumable and easy to manage, so that the suspicious trades can be filtered out from those which have been falsely flagged.

This can be achieved with RDFox, a high-performance knowledge graph and semantic reasoning engine. By harnessing the power of advanced semantic reasoning, one can create an intelligent system built using a hierarchy of rules and ontologies. The rest of this article will explore how this can be done.

The data

To establish if a trade is suspicious, we need to have a large amount of data on the industry, including historical data. For this example, we are using data from our partner Refinitiv, an LSEG (London Stock Exchange Group) business, which includes information on the Company’s employees and shareholders, and whether they have been involved in any deals.

The data set includes data on 100,000 companies and 3000 traders, which amounts to 100,000 trades per day and 1,000,000 deals between 1965 and 2019. This is roughly 350 million triples within the database.

As well as the data, ontologies are mapped into the database. The following image shows an ontology for deals (OWL):

As well as the aforementioned information, a dataset of fictional traders and their trades has been included for this demonstration. The following image shows an ontology of trader data (OWL) which explores two fictional traders:

If we expand Sally Goodman, one of our fictional traders, in the RDFox console data explorer, we can see all the data on Sally, including her trades and a bio with her previous employers. Additional information could be linked to the traders to improve the wealth of information accessible, which can be used to determine if insider trading is occurring. As you can see, information on the trader’s education has been included in this demonstration.

(RDFox data explorer showing our hypothetical trader)

The rules

The image above would not be possible without Datalog rules. RDFox is unique in its ability to execute Datalog rules, quickly, correctly and incrementally. Rules bring significant benefits to this use case through OWL 2 RL, numerical (arithmetic) functions, local constraints (filters and Negation as failure), graph analytics (aggregation and recursion) and the combination of the above.

The financial industry is subject to frequently changing regulations. This means a flexible system is required which allows the addition or removal of criteria. RDFox is incredibly flexible due its advanced reasoning capabilities, allowing the knowledge graph to be updated at any points with almost unnoticeable iteration periods.

N.B. This use case uses multiple rules, some of which are outlined below.

Rule examples

This rule calculates the value of a trade [Arithmetic functions]:

The following rule creates an alert when there are trade limit violations [Filter in rules]:

The following rule can be used to create an alert for any traders who have not traded [Negation]:

This rule can be used to calculate the volume of trades per trader [Aggregation]:

Hypothetical trade investigation using RDFox — Kit Wallis

Please note that whilst the companies do exist, the deals, trades and traders are all fictional, and we edited the data to create a good story!

Kit Wallis, a junior trader, carried out a trade which was flagged as suspicious. The investigators are looking into this trade to work out if it is indeed insider traded, or falsely flagged. This is an overview of the information they are provided.

This overview is used by the investigators to deduct whether Kit needs to be reported to the regulators. The following images represent sections of this knowledge graph.

The investigators can see that the trade in question was worth £91,532, which is under the £100,000 limit for a junior trader. They mark down that the amount traded is not of concern and continue investigating Kit.

They find out that in total Kit has been responsible for £30 million in trades during the month of March, in 2019. This figure was a result of the aggregate rule. However it does not indicate guilt, so again they note down that this figure is not of concern.

They look at Kit’s bio and see he has worked at the bank since 2017. Prior to this he was working at Shuwa Corporation in Japan (remember this…)

The investigators now turn to the trade in question. A trade in Isetan Mitsukoshi Holdings Ltd (IMH) shares. The knowledge graph shows that this company has been involved in two deals. One during the 1990s, which resulted in an investment consortium acquiring 26% of the company and the second deal, on the first of the 1st of April 2019.

On closer look, information shows that Shuwa Corporation (Kit’s previous employer) disclosed that it had acquired a 21.9% interest in IMH, and further ownership transfers in the coming weeks would leave Shuwa with a 23.6% interest in IMH. This would likely lead to an increase in the share price of the company that Kit had traded. This (long) trade had happened a day before the deal was announced…

This does appear to be suspicious… Kit traded shares in IMH, a company which Shuwa had just acquired a large stake in. Perhaps Kit traded the company based on some non-public materials given to him by an old colleague at Shuwa? If this is the case, he has acted illegally. The investigators decide that they will have to bring him in for a meeting with the compliance team.

The knowledge graph represents this information, and can be used to detect patterns. For example, the high level view of Kit’s trade produces this circular relationship:



An application using RDFox could shorten the process of investigating flagged trades, by presenting relevant information in a concise, intelligent way. This is all possible due to the combination of rules which allow domain expertise to be encoded into the system and re-used for each investigation.

This is a significant improvement on current practise, which relies on checking many deals, companies traded and historical data. By helping the investigators to quickly distinguish between approved trades and insider trading, this solution will save valuable resources.

To learn more about RDFox have a browse on our website or medium publication. To request an 30 day free trial license click here. Academic licenses are available for free on request. Alternatively, you can contact us at


About Refinitv

Refinitiv, an LSEG (London Stock Exchange Group) business, is one of the world’s largest providers of financial markets data and infrastructure. With $6.25 billion in revenue, over 40,000 customers and 400,000 end users across 190 countries, Refinitiv is powering participants across the global financial marketplace; providing information, insights, trading platforms, open data and technology that enable customers to execute critical investing, trading and risk decisions with confidence. With a 100% focus on the financial community, Refinitiv is optimized for investments in key products and technologies to drive performance and innovation across all members — from investors, banks, trading, corporates, governments and more. For more information visit:


The Team and Resources

The team behind Oxford Semantic Technologies started working on RDFox in 2011 at the Computer Science Department of the University of Oxford with the conviction that flexible and high-performance reasoning was a possibility for data-intensive applications without jeopardising the correctness of the results. RDFox is the first market-ready knowledge graph designed from the ground up with reasoning in mind. Oxford Semantic Technologies is a spin-out of the University of Oxford and is backed by leading investors including Samsung Venture Investment Corporation (SVIC), Oxford Sciences Innovation (OSI) and Oxford University’s investment arm (OUI). The author is proud to be a member of this team.