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

This is a basic Twitter data miner written in Python. It utilizes the Twython, Pandas, Numpy, Matplotlib, Re, Textblob libraries to extract and analyze Twitter data based on a specific search query.

By collecting and organizing the data by chosen time period we are able to visualize the frequency of use of the search term per period as well as assign a positive or negative sentiment to the period based on natural language processing analysis.

We are also able to gain some suggestion as to the rising or falling popularity of the search term by fitting a regression line across the periods, where the slope of the line can suggest an accelerating or decelerating trend.

We are also able to aggregate a list of related hashtags that are used along with the search query.

Since this simple data miner utilizes the Twitter standard search API we are limited to 7 days of historic data and completeness is not guaranteed, it is enough for us to build an example that illustrates the possibilities available by mining public opinion through the medium of Twitter.

Twitter data miner article art Continue reading