top of page
Search
  • Writer's pictureIsmael Basit

#5 3/3 Trading Algorithm: Compressing Sequences with SumNumeric

Updated: Sep 23, 2020

Welcome back to our AlgoTrading blog, this is the last post focused on SumNumeric and how this tool of ours reads and analyse news.

As you might have understood by reading the previous posts an important part of our porogram is aimed to "compress" datas in order to ease the calculations, that's what we are going to do today, we are going to explain you how these compressions work.

Compressing helps us work with work with ordered numbers and shorter sequences by simply grouping them and running easy calculations.

To start, the function will take as argoment (in the brackets) the string of the sequence of value to compress (eg. period) and will return a string with the result that will most likely be added to another strings.

These are the steps how the string will be compressed:

#1 The first thing that we need to do is to separate each "group" of value ( it is a

group if starts with a two digit value in which the first digit is 1 or 2).

eg. 17-39-21-33-41-17-31 ---> becomes --> 17-39, 17-31 and 21-33-41

#2 The second step instead is to calculate the mean valueof the second digit of all

the values starting with the same first digit categoty inside each group.

eg. 17-31-42-33-48 --> becomes -->17-32-46

#3 The third step, once we have each group sorted, is to unite all of them starting

with the very first digit, this can be done by calculating the mean value for every two

digit (starting with the same first digit).

eg. G1 19-31-42, 17-37 and 18-35-46 --> become --> 18-35-44

G2 21-43 and 23-45 --> become --> 22-44

#4 The final step in order to arrive to a final result (of a single sub-section, such like

Title, Sub or Body) is to add the sequences we found (in case of the erlier example

are G1 and G2) and the resulting string that we'll have is what we need.

eg. G1: 16-34-43 and G2 21-31 --> become --> G1 + G2 --> 16-34-43-21-31


After that this result from every subsection has to be put together but considering the hierarcy as stated in the first post concerning SumNumeric, this is easely done in our program by considering, doing the average of the values, twice the values from the Title and Body and once the Subtitle's.

This is it for today! The next post will be the last about this Algotrading project, make sure you don't miss it!

StatsApplied

4 views0 comments

Recent Posts

See All
Post: Blog2_Post
bottom of page