AI Expert System to Boost Trading

BalanceAI Network
7 min readFeb 8, 2024

--

Decision making

Trading is psychologically demanding due to the need for rapid decision-making amidst a vast amount of data. Traders face constant pressure to interpret market information, assess risk, and execute trades swiftly.

Managing vast datasets can lead to information overload and may contribute to decision-making errors. The importance of effective data management and analysis tools in the modern trading process is thus beyond question.

Expert systems

When confronted with the task of handling extensive datasets, machine learning is the foremost solution that comes to mind. However, in certain scenarios, expert systems have the potential to outperform machine learning approaches.

When dealing with well-defined rule-based domains and situations where transparent decision-making is needed, well designed expert systems can play a pivotal role.

In artificial intelligence, an expert system is a computer system emulating the decision-making ability of a human expert. Expert systems are designed to solve complex problems by reasoning through bodies of knowledge, represented mainly as if–then rules rather than through conventional procedural code. The first expert systems were created in the 1970s and then proliferated in the 1980s. Expert systems were among the first truly successful forms of artificial intelligence (AI) software. An expert system is divided into two subsystems: the inference engine and the knowledge base. The knowledge base represents facts and rules. The inference engine applies the rules to the known facts to deduce new facts. Inference engines can also include explanation and debugging abilities. [1]

The impact of expert systems is not limited to just one area; their implementation has led to numerous benefits across multiple industries.

Have a look at the introduction to Expert Systems [2]:

Consider these key advantages of Expert Systems [3]:

Increased efficiency: Expert systems automate repetitive tasks, allowing professionals to focus on more complex aspects of their work.

Enhanced decision-making: By leveraging extensive knowledge bases and logical reasoning capabilities, expert systems provide reliable recommendations for decision-makers.

Improved productivity: With efficient problem-solving abilities, experts can handle larger workloads effectively.

Reduced costs: Expert systems minimize errors and increase accuracy while reducing the need for costly human resources.

In the context of trading, one always faces such situations where the ultimate goal is to determine whether to buy or sell the asset.

Balance Risk is the expert system that processes a large volume of data as an input.

Among them are the instrument price, stop loss level, take profit level, position size, portfolio balance, historical price data, assets correlation matrix and others.

Based on those dataset, the system calculates different metrics that can inform the user, whether the trade can be potentially profitable and whether any of the well known trading rules is not broken.

Some system parameters can be preset by the user to fit one’s own trading approach.

Balance Risk combines python and CLIPS programming languages. CLIPS is a rule-based programming language specifically designed for building expert systems. CLIPS was developed at NASA’s Johnson Space Center.

CLIPS provides a set of constructs for defining rules and a rule-based inference engine for executing those rules. Thanks to this, incorporating any new rule or model can be seamlessly done to enhance the system’s performance.

Use Case

Correlated positions

Imagine the scenario when the user is about to open a long position on the e.g. LTC/USDT pair. Before executing the transaction, Risk Model warns the user that he/she already has a long position on the ETH/USDT pair.

As price movements of these two instruments are highly positively correlated the user is informed that such a strategy may maximize the potential return, however increasing the overall risk exposure of his portfolio.

CLIPS language operates by maintaining a list of facts and a set of rules which operate on that list.The following CLIPS code segment handles the execution of the rule that is described above:

The discussed rule consists of three parts. The first part, (defrule positive-same, simply names the rule as positive-same. The next part is the elongated logical IF clause, and the last part, (assert (risk-data …, is the action part of the rule. In plain language, this rule means: if there exists some fact on the fact database, and if those facts meet the expected logical relationship, then assert another fact, (risk_is position_positive_same_corr), onto the fact database. The facts that are provided as input to the positive-same rule are:

The above list of facts/data includes: instruments names, trades directions, instruments ids and correlation matrix elements.

Within the CLIPS formalism, any set of facts, complex rules operating on those facts, new facts (asserted by rules) and new rules, can be arranged in expanded decision tree algorithms to finally give the answer whether to buy or sell the asset.

Risk limit per trade

Let’s take a look at another useful scenario. It is well known among traders that it’s super important to stick to their risk limits per trade settings. This helps them avoid big losses and navigate the ups and downs of the market. By managing risk wisely in each trade, traders can protect their money and increase the chances of long-term success in the ever-changing world of trading.

The CLIPS rule below can help traders to keep the risk limit per trade according to their strategy.

This rule again consists of three parts. The first part, (defrule position-risk, simply names the rule as position-risk. The next part is the logical IF clause, and the last part, (assert (risk-data …, is the action part of the rule.

The facts that are provided as input to the position-risk rule are:

The first line denotes position details: instrument id, opening price, stop loss limit, positions size, exchange rate, and lot size. Two other lines are related to the strategy settings and account balance.

Maintaining a consistent risk limit per trade in line with a strategy can be challenging due to factors like fluctuating exchange rates, psychological influences, and managing multiple positions simultaneously.

However, with the help of Risk Balance, the trader would be informed by the system whenever the trade he/she is about to open violates the strategy.

Summary

Balance AI Risk can empower traders and financial professionals to design robust risk management strategies, optimize their trading performance, and navigate the complexities of financial markets with greater confidence and efficiency.

Anyone can build their own risk models that can be used to adhere to complex trading strategies.

Our expertise encompasses a thorough comprehension of markets, trading, and the construction of artificial intelligence models for diverse applications.

As we are building our AI Models Marketplace, we are open-sourcing part of our work.

Balance AI Risk framework (including example risk models) can be found at: https://github.com/balancedao/balance-ai-risk

We are going to encourage community members to build sophisticated risk models using our framework.

Stay tuned for announcements regarding the launch of a special program to kickstart this initiative.

Sources:

  1. https://en.wikipedia.org/wiki/Expert_system
  2. Introduction to Expert Systems (AI) by https://www.youtube.com/@Destinlearning
  3. https://www.elsverds.org/expert-systems/
  4. Bhattacharya, K., Gangopadhyay, S., DeBrule, C. (2021). Design of an Expert System for Decision Making in Complex Regulatory and Technology Implementation Projects. In: Chakrabarti, A., Poovaiah, R., Bokil, P., Kant, V. (eds) Design for Tomorrow — Volume 3. Smart Innovation, Systems and Technologies, vol 223. Springer, Singapore. https://doi.org/10.1007/978-981-16-0084-5_50
  5. Rak, Massimiliano & Salzillo, Giovanni & Granata,Daniele. (2022). ESSecA: An automated expert system for threat modeling and penetration testing for IoT ecosystems, Computers and Electrical Engineering, Volume 99,2022, 107721, ISSN 0045–7906

Disclaimer:

Any analysis, information or explanation we give to you about operations and performance on your trading account is not intended to be and should not be considered as advice. We do not provide investment, financial, legal or tax advice, especially we do not provide advice to conclude any transactions. This tool shall only analyse your trades, explain how it works, what is the trend, what is the possible risk etc. If you decide to use the information provided at the service, you do so at your own discretion and risk. The decision to conclude any transaction, including buying, selling, trading in securities or any other investments rest solely on you. Any trading or investment transactions involve a risk of substantial loses and shall be made based on the personalised investment advice of qualified financial professionals. We are not liable for any loss or damage that you, or any other person or entity incurs, as a result of any trading or investment transactions based on any information provided at the service.

--

--

BalanceAI Network
BalanceAI Network

Written by BalanceAI Network

BalanceAI is an open-source protocol that powers a decentralized, blockchain-based AI Models Marketplace.

No responses yet