Here is an example of an expert system for decision making coded in SWI-Prolog.

It takes a sample portfolio, a current asset price list and a risk tolerance profile it can then make decisions regrading selling financial assets based on specific strategy being applied.

These strategies are based on predefined tactics, and the tactics in turn are an application of lists of sell rules.

This an exercise in declarative logic programming, please DO NOT TAKE ANY OF THIS AS INVESTMENT ADVICE.

Currently only some sell rules, tactics and a strategy are implemented, this framework can however be easily extended to encompass a full spectrum trading decision making.

At some point in time I will also extend this post to further describe and document this code.  For now you can just head over to https://swish.swi-prolog.org/  paste the code in the online IDE and take it for a spin.

Continue reading