Category: programming (page 1 of 1)
Using GeoIP2 Databases With NGINX
April 16, 2019
I’ve been using Google Analytics for a while but I never liked the side effects of this way of collecting website usage data such as having to install Google’s tracking scripts on all of my web pages. Those scripts are bad for both user privacy and website performance so I’ve decided to get rid of them and find an alternative way to collect the data I’m interested in. In this post I’m going to show how to set up a NGINX web server that can log the location of it’s clients.
Kotlin 1.3 Features: Coroutines
February 1, 2019
Coroutines have been available since Kotlin 1.1 but Kotlin 1.3 has lifted them out of experimental mode which means that Coroutines API is finalized and it’s ready to be used in production environments. There are many brave souls who’ve started using coroutines since the early days although the API has been changed with the release of Kotlin 1.3 so the old coroutine code needs some adjustments in order to follow the latest standards.
Kotlin 1.3 Features: Contracts
December 3, 2018
The Kotlin compiler is pretty smart when it comes to static analysis but there are still cases when the code looks perfectly obvious to a programmer but it’s very difficult to understand for the compiler. Contracts were introduced in Kotlin 1.3 and their sole purpose is to improve the static analysis by letting programmers provide an additional information on what to expect from each particular function.
Plotting Financial Data With Python: Efficient Frontier (N assets)
November 25, 2018
We already have the efficient frontier script that we created in the previous post but it has one major limitation: it does not allow us to plot more than 2 assets. Plotting 2 assets is enough to see diversification in action but it’s not practical to have a portfolio that consists of 2 assets. In this post we’re going to extend the previous script in order to support an arbitrary number of assets.
Plotting Financial Data With Python: Efficient Frontier (2 assets)
November 21, 2018
The main idea behind the Efficient Frontier is that the overall risk (volatility) of a portfolio may not be equal to the sum of the risk of its components so some combinations are better than others. In this post we’re going to visualize the optimal weights of 2 given assets in a hypothetical portfolio.
Plotting Financial Data With Python: Comparing Returns
October 11, 2018
It’s hard to compare the returns on the given securities just by looking at their price history in absolute terms so we need to find a better way of comparing historical returns. One of the possible solutions is to adjust the whole data series in such a way that the first data point would be equal to some predefined number. We are going to adjust the price history of both stocks so they will always start with the same value, let’s say 100. This method allows us to see what would happen with $100 invested in 2 given stocks on the date D.
Plotting Financial Data With Python: Variance
October 6, 2018
Variance is an important indicator if you want to know the level of risk associated with a given security. It’s important to understand that past variance might not be a good predictor of future variance but most of the time it works and we don’t have other options anyway. Let’s create a script for displaying returns distribution, variance and standard deviation of any given security.
Plotting Financial Data With Python: History
September 30, 2018
Sometimes I want to plot some financial data and it might be tricky because most of the financial websites do not offer enough customization or they have a usage limitations unless you subscribe. So, I’ve decided to find a reliable data source and plot this data myself. Here are the basic steps that are necessary to do that.