Sunday, November 8, 2015

Life made simple

Learning new computer tools is always a challange and a new adventure to get your mind wrapped around a problem. With some useful links and online hints the desired algorithm may well one day come to life.

Automation of programming tasks using free data sources with simple calculations techiques and file exporting is made simple with python and no wonder why it is becoming a predominant laguage in the finance field. Just as an example, data from yahoo finance is downloaded with one simple command:

df = web.DataReader("SPY", 'yahoo', start, end)

as data is a time series of basic end of the day fields (High, Low, Open, Close, Volume), calculations are made extremelly simple since python interprets variables just like matlab. With one line of code a new column is added to the imported variable. And what is better yet, many stock indicators are already incorporated in different libraries, it is just a matter of finding the right one or all of them to incorporate them into the learning model. There are several hundred stocks published on yahoo and the end of the day approach can be easily transfered to other candle sticks with different time frames or windows. The found process on free resources has a great potential to become a state of the art trading tool its just a matter of focusing on the right set for troughtful analysis and back testing.

What is even cooler, is the simplicity of exporting manipulated data to a hard drive to use with other applications (not Excel tough). it is just a matter of one line of code:

df.to_csv('/home/t/Documents/Python/file.csv')

As an interesting observation of the day is a visualization of IBM and SPY stock once we plot for volume and price change between open and close prices. As noted, the volume on the IBM stock does not vary a lot, but the change in price does (vertical line) on the SPY stock instead, volume values are a complete big bang scattered on the plane meaning that given a high volume turnover, there will be equally likely that the price change between open and close will be high as well (be it positive or negative). I would like to know from a practical perspective, what does this means :)

No comments:

Post a Comment