Sunday, 5 August 2018

How to import CSV files into Parquet with Kite SDK

Summary 

In order to perform some data studies, I need to import a CSV file, generated by Yahoo Finance and containing historical data from General Electric (GE) into Parquet files in HDFS so I can later run some Spark Jobs on it. 

The data is a time-series and that should be partitioned per year and month (just for the sake of the example).

In order to have a quick solution (I do not want to write a Spark Job or Java application), I will use Kite SDK.

Steps to follow
  • Clean the data with a simple AWK script
  • Define the schema of the Parquet file (column types, etc.)
  • Define the partition strategy that is going to follow (for more optimal querying)
  • Execute the import

Friday, 27 July 2018

Calendar Spreads using Put Options

Summary

As I am not too happy with the results, I have not deployed any Iron Condor lately. Nor I have had the chance of deploying a Put Spread, which is a trade that I am much happier with.

In the meantime I have been reading about Calendar Spreads and done a bit of paper trading with them. Today I would like to share my thoughts on them.

Note: This is not meant to be a proper study on Calendar Spreads, just some notes I have compiled on the way. Any serious study on a trading strategy requires a proper set of back tests.

Example Trade Setup: Positions opened, days until expiration (DTE) and debit invested

The calendar spread is composed of two positions (in this example PUT options for the German DAX30 - ODAX):
  • Same strike price: 12500 points in this case.
  • Different lifespan: A shorter one, using the front month (32 days) and longer in the other, some three or four months in the future (158 days).
  • Short/long: You sell the front option and buy the option in the future.
As the option in the future has more time value, this results in an overall debit.

For instance, this is the current status of a "paper trade" that I have simulated for a couple of weeks:

TypeNameDTEDeltaThetaVegaDebit/Credit
Long PutDecember 12500158-43,581,6231,82€-390€
Short PutAugust 125003235-3,6811,8390€

Results in this profit/loss graph:


The orange line is the profit/loss at the expiration date of the short option, while the blue line is displaying the profit/loss 9 days after opening the trade. Note that the amounts are all multiplied by 5 here as each ODAX option represents 5 contracts (or 5€ per point).

Friday, 6 April 2018

Closed: ODAX May 2018 Put Spread

Summary

Yesterday was the unusual case when, right after opening a position, the market makes a sharp movement in my favor. So sharp that I was able to collect 60% of the maximum profit in just one day. Therefore, it did not make sense risking the exposure for one month and a half, only to get the 40% remaining.

DAX 30 on April 6th 2018. Source Investing
Trade Status

After closing the spread, I booked a gain of 81€. With that, the current gain since the beginning of the year is 0,49%. DAX 30 index is down 4,9% in the same period of time.

TypeNameOpen DateDTEP/L
Put SpreadODAX May 2018 10700/103004/4/201844    81,00€


All the trade details can be found here.

Portfolio

No open position in the portfolio right now. I might reopen the Put Spread if we test again the lows made last week.

See also

Wednesday, 4 April 2018

New position: ODAX May 2018 Put Spread

Summary

This morning, with the DAX 30 hitting 11800, I opened a 10700/10300 Put Spread aiming for the May expiration cycle (44 days until expiration).

DAX 30 on April 4th 2018. Source Investing
It does not have much time value compared with other trades and the short delta was smaller than usual (closer to 10 than to the usual 16), but the German index has been breaking some supports and we might be entering a bear market. I did not go for a full Iron Condor as I fear the index tendency for bouncing upwards.

Wednesday, 28 March 2018

Closed: ODAX April 2018 Iron Condor

Summary

Last Friday, I closed the remaining Put Spread at a small loss after seeing the DAX index breaking supports and making new year lows. As the time of this writing, five days later, I am still not sure whether that decision was precipitated.

DAX 30 on March 28. Source Investing
Too bad I did not close the spread when I was winning 70% of the premium received. Anyway, I wanted to close the spread as I do not plan to pay attention to the stock market during this Easter week.

Friday, 16 March 2018

Closed: ODAX March 2018 Put Spread

Summary

Today expires at max profit the Put Spread I opened after rolling the failed February 12100-11700 Put Spread.

DAX 30 on March 16th 2018. Source Investing

Given the very high IV when I opened it, and the sideways market since then, this was an easy ride and I chose to get all the premium for it. Moreover, this spread was only half the usual width, so the money at risk was half as well.

ODAX April 2018 Iron Condor: Closed Call Spread

Summary

Last Wednesday, after almost 30 days, no movement in the DAX index and a nice volatility contraction, I was able to close the Call side of the Iron Condor locking around 77% of the premium initially received.

DAX 30 on March 16th. Source Investing

There were still more than 5 weeks to go, so I preferred to take the money from the table, giving the index tendency for rallying (although it is taking a more bearish profile lately).