Aristotle vs Shopenhauer. Please, don’t try to be right

Around 350 years B.C. lived Aristotle, who founded the Peripatetic school. Aristotle and his disciples’ aim was to find truth by discussing, and bouncing ideas of each other while taking nice walks under the Athenian sun. Aristotle would ask questions to find truth by induction, arriving at conclusions from known facts to reach higher levels of understanding.

Fast forward to 1831. German philosopher Arthur Schopenhauer, example of philosophical pessimism, wrote “The art of being right: 38 ways to win an argument” , his goal was not to find the truth, but to win dialectic fights. He saw discussion as a competition to which the goal was to win, instead of a way to enrich each other and humanity through arriving at better understanding of the universe.

In my life I have met many people with which it is very nice to discuss, because their clear goal is to use logic to progress together, to shine a light on the unknown, and to help each other.

I have also met quite a few people who believe the most important thing is to be right, who will use every trick in the book to win the conversation and come out on top. It is not difficult to know when you’ve met one.

Here are a few of Schopenhauer’s logical fallacies, so you can be ready to point them out and avoid these traps:

  1. The Homonymy: extend the understanding of a particular word, and the refute it triumphantly. Claiming credit for having refuted the original stament.

“You are not yet initiated into the mysteries of the Kantian philosophy.”
…”Oh, if it’s mysteries you’re talking of, I’ll have nothing to do with them.”

  1. Generalize your opponent’s specific statements: Take a proposition which has been said concretely, as though it had been said with absolute application.

“A Moor is black; but in regard to his teeth he is white; therefore, he is black and not black at the same moment.”

  1. Bandwagon Fallacy: Arguments that appeal to the growing popularity of an idea as a reason for accepting it is true.

“Increasingly, people are coming to believe that Eastern religions help us to get in touch with our true inner being. Therefore: Eastern religions help us to get in touch with our true inner being.”

  1. Fallacy of Division: If the whole has a property, then every part has this property.

“Water is liquid, therefore H20 molecules are liquid”, “Atoms are invisible, I am made of Atoms, therefore I am invisible”

  1. Straw Man Fallacy: Misrepresent a position to make it appear weaker than it actually is. Refute the misrepresentation and claim the real position has been refuted.

After Will said that we should put more money into health and education, Warren responded by saying that he was surprised that Will hates our country so much that he wants to leave it defenceless by cutting military spending.

  1. False Cause: Explain correlation as causation

Pointing to a fancy chart, Roger shows how temperatures have been rising over the past few centuries, whilst at the same time the numbers of pirates have been decreasing; thus pirates cool the world and global warming is a hoax.

  1. Slippery Slope: If we allow A to happen, then Z could happen. Therefore A should not happen.

Colin Closet asserts that if we allow same-sex couples to marry, then the next thing we know we’ll be allowing people to marry their parents, their cars and even monkeys.

  1. Ad Hominem: attack your opponent’s personal traits in an attempt to undermine their argument.

After Sally presents an eloquent and compelling case for a more equitable taxation system, Sam asks the audience whether we should believe anything from a woman who isn’t married, was once arrested, and smells a bit weird.

We need to work together in search of the solutions to our daily struggles, hence a positive Aristotelian attitude is helpful and very appreciated, whereas trying to “win” conversations is damaging and discouraging.

shopenhauer

 

Advertisements

Emergent behaviors and IT Projects

Did you know that the largest known ant colony goes from northern Italy to the Spanish Atlantic coast? Yet ants don’t have an architect overseeing their construction, or a centralized coordination group which tells the rest of the ants what they have to do.

Ants are simple individuals with very limited communication skills, yet they are capable of forming minimum paths from the colony to the food and form efficient ant chains moving the food to the colony.

Grasscutter ants harvest tons of grass every year which they can’t digest, bring it to their colony, cut it to the right size and place it into a garden of fungus, which eats the grass and the ants eat the fungus. It’s not one or two intelligent outliers that do this. It’s the colony that does this to feed it’s 5.000 individuals.

Termites create 6 meter high “cathedrals”, with no central coordination, just simple rules that are wired into each individual’s DNA guiding them to release certain chemicals in response to stimuli such as proximity to other chemicals.

Birds fly in organized flocks without having radio communication to coordinate their positions and speeds, following 3 simple rules: 1) avoid getting too close to neighbor, 2) steer towards average heading of neighbors 3) steer towards average position of neighbors.

Wolves hunt in packs circling the prey with no communication needed, just following two rules: 1) get close to the prey 2) when close enough to the prey, move away from other wolves.

Fish swim in groups, homogeneous groups are called schools and heterogeneous are called schoals. This reduces their chance of being eaten by a predator. This chance is further reduced by joining a schoal of bigger fish, which will be preferred by predators. One puzzling aspect of schoal selection is how a fish can choose to join a schoal of fish similar to themselves, given that they cannot know their own appeareance.

The set of rules that the individuals follow is easy to understand, but the emerging behavior of the group is in no transparent way derived from this set of rules.

Would there be a set of rules that would enable us to work efficiently in projects without the need for central coordination?

ants

Ease with uncertainty using the cosmic scale

“The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents. We live on a placid island of ignorance in the midst of black seas of infinity, and it was not meant that we should voyage far. The sciences, each straining in its own direction, have hitherto harmed us little; but some day the piecing together of dissociated knowledge will open up such terrifying vistas of reality, and of our frightful position therein, that we shall either go mad from the revelation or flee from the deadly light into the peace and safety of a new dark age.”

The Call of Cthulhu – H.P. Lovecraft

As you read this, sitting on your chair, sipping on your coffee, you are hurling through a dark, cold and incomprehensibly vast space on a gigantic ball of dirt which is rotating around our sun at 30 km/second. Us and our neighboring galaxies are rushing at 1,000km/second towards a structure we call the great attractor, with a mass of 100 quadrillion times that of our Sun and 150 million light-years away.

You are not an individual. The visible universe is composed of 1080 atoms. You are composed of 1027 of these same atoms, 99% of which form hydrogen, oxygen and carbon. These atoms that compose you, group in molecules, which group in cells, which create you. These cells are living and performing tasks like digesting your food, transporting endorphins to make you happy, or killing other beings which are inside your body so you don’t get sick.

Check out below, a kinesin protein which is walking around inside one of your cells right now, transporting some vesicles to keep the cell working.

kinesin

The universe has existed for over 14 billion years, and will exist for many billion years to come. If we compare the age of the universe to one calendar year, on the first of January we would have had the big bang, around September the solar system would have formed. Dinosaurs would have become extinct on 29th of December, and Jesus Christ would have been born on the 31st of December 5 seconds before midnight. Columbus would have reached the Americas 1.2 seconds before midnight. Your whole life, with all your trials and tribulations will have gone by in less than 0.23 cosmic seconds.

Think about this when you are worried about your performance review or your project getting delayed.

Why do we get angry?

“Anybody can become angry – that is easy, but to be angry with the right person and to the right degree and at the right time and for the right purpose, and in the right way – that is not within everybody’s power and is not easy. “
Aristotle

Wouldn’t it be great if we could control our temper at all times? If emails or conversations never resulted in our anger emotion being triggered and us feeding this feeling by responding with an aggressive language or a snappy, self-serving response?

Humans have a common set of primary emotions that become triggered due to external circumstances:

  1. Happiness: Happiness is triggered by things we like. Too little happiness is bad, causes depression and lack of will to live. Too much Happiness can be bad, it can make us take unreasonable risks and pay the consequences.
  2. Sadness: Sadness is triggered by a loss we don’t accept. Too little sadness is bad, sadness helps cope and empathise with others. Too much sadness causes depression.
  3. Fear: Fear is triggered by a threat. Being unable to feel fear will lead to foolishness and taking unreasonable risks and pay the consequences. Being too fearsome will incapacitate you from living a normal life.
  4. Disgust: Disgust helps us avoid certain parts of something. For example I may not like the noise someone makes while chewing food, but I can separate that from the whole person, I don’t reject the whole person, just a small part.
  5. Anger: Anger is triggered by disrespect of boundaries, either someone does not respect a limit you impose on them or someone is imposing a limit on you that you don’t accept.

Us humans cannot control feeling the emotion, it being triggered, what we can work on is what we do with it after it has been triggered.

  1. When happiness is triggered we can work on taking care of how we express it to avoid making others feel sad or angry. For example it’s important to be a good winner and not rub it in your opponent’s face when you win.
  2. When sadness is triggered we can work on understanding what loss we are not accepting, and finding ways to cope.
  3. When fear is triggered we can work on measuring the size of the threat. More often than not the scenarios we play in our minds are worse than the real outcome.
  4. When disgust is triggered we can work on understanding which part of the whole we don’t like and make a differentiation. Accept the person even if they wear a watch of your rival football team.
  5. When anger is triggered we can analyse which boundary the other person is breaching or imposing on you. Figure out why and what stories are you telling yourself: Is the other person a villain? (Is the other evil or stupid?) Are you a victim? (I am good, this is happening to me) Are you helpless? (Are all courses of action pointless?) Is the boundary being pressed immovable? Should you not accommodate?

In particular, email is a wonderful tool to ignite the flames of angry discussion, since email is always interpreted (what did he mean by “fine”, does he think I’m stupid? I’m sure he thinks I’m stupid! Arggg, I’ll respond copying his boss!). It would be great if we were all more conscious of our emotional intelligence, and used it to remove the obstacles limiting us from perfect collaboration.

anger

Bitcoin Algorithmic trading

I’ve been playing for the last three weeks with a fun project: Bitcoin algorithmic trading.

Kraken.com has a super easy restful api which allows to place orders with just a few lines of code. Using the api is free and you only need to pay 0.26% per trade.

For example, I can query my balance with three lines of code

<?php require_once ‘header.php’;
$res = $kraken->QueryPrivate(‘Balance’);
print_r($res);
?>

I can place an order to buy or sell bitcoin with nine lines

<?php require_once ‘header.php’;
$res = $kraken->QueryPrivate(‘AddOrder’, array(
‘pair’ => ‘XXBTZEUR’,
‘type’ => ‘sell’,
‘ordertype’ => ‘limit’,
‘price’ => ‘1200’,
‘volume’ => ‘0.0001’
));
print_r($res);
?>

I can query the last trades executed in the market in three lines

<?php require_once ‘header.php’; $res = $kraken->QueryPublic(‘Trades’, array(‘pair’ => ‘XXBTZEUR’,’since’=>’1486857244103748648′));
print_r($res);
?>

These three functions are all is needed to be able to build a program that looks at the direction the trades are going, check my balance and place an order.

I had a stroke of insight, an algorithm which could not fail: “If the last three trades are going up, buy it all. If the last three trades are going down, sell it all, else wait” I thought to myself my first lamborghini would be orange while I got to work building the program.

Instead of letting it loose with my money I thought it would be a good idea to backtest it first, to simulate how my algorithm would fare.

You can download the whole history of bitcoin trades for each market here. The following script scheduled with cron to run every morning at 5:00 am downloads the whole history of prices, loads it into a mysql table, runs my algorithm and outputs a file with each decision taken.

#!/bin/bash
cd /home/roge/programando/kraken/histdata
wget http://api.bitcoincharts.com/v1/csv/krakenEUR.csv.gz
gunzip -f krakenEUR.csv.gz
cd ..
mysql kraken <truncate_krakenEUR.sql
mysqlimport kraken –local histdata/krakenEUR.csv –columns timestamp,price,volume –fields-terminated-by=’,’
mysql kraken <create_ruleofthree.sql
php backtest_ruleofthree.php >backtest_ruleofthree.output

the output is 4.8 million lines long so I thought I’d use big data analysis tools such as jupyter/pandas/matplotlib to see what my algorithm had done in a nice chart. Below you can see how my algorithm is super efficient at giving all my money to kraken in fees. In less than 30.000 ticks I would have blown through all my savings. Back to the drawing board 🙂

bitcoinalgotrading