I was looking for a simple way to calculate performance of my investments over time. Popular portfolio trackers like Moneycontrol and Value Research did not meet my needs. So I decided to try out Google Spreadsheets.
Nice thing with Google Spreadsheets is its support for import and queries.
e.g. AMFI India publishes daily NAV’s on their website http://portal.amfiindia.com/spages/NAV1.txt
You can import the data programmatically and run a query on it to find desired NAV.
I can use following simple query to check the latest NAV of Birla Sunlife Frontline Equity fund, whose symbol is INF209K01YY7
=QUERY(SPLIT(QUERY(importDATA("http://portal.amfiindia.com/spages/NAV1.txt"),
"SELECT * Where Col1 like '%INF209K01YY7%'"),";"), "Select Col5")
Google Spreadsheets obviously supports data from Google Finance with its built in function GOOGLEFINANCE
=GOOGLEFINANCE("SBIN","price")
This will return latest price for State Bank of India.
You can also use Stock Exchange assigned ID’s to query the data from Google Finance
=GOOGLEFINANCE("500510","price")
This will return latest price for Larsen and Tubro.
However the most killer feature of Google Spreadsheets is its support for ArrayFormula in conjunction with XIRR.
Let me explain.
Consider following cash flow.
A
B
C
D
1
Transaction
Symbol
Date
2
Sell
Havells
31/12/2017
3
Buy
Havells
01/01/2017
4
Buy
Havells
06/01/2017
We have to update the XIRR formula to include the new transaction we just added in our cash flow
=XIRR(D2:D4,C2:C4)*100
Symbol
XIRR
Havells
4.493
This is very cumbersome to update XIRR formula, if you have a diversified portfolio with 10+ symbols and investing on a regular basis.
You can see for two symbols we have to keep close track of cell numbers etc to accurately calculate XIRR.
ArrayFormula provides nice workaround to simplify and automate this process of using XIRR formulas for a growing number of transactions
As you can see that except the symbol name both the formulas are identical. We can remove the hard coded symbol name and refer to the cell which has symbol name.
Using ArrayFormula in the portfolio tracker has simplified maintenance of the spreadsheet and saved quite a few hours for me.
While testing REST APIs for one of my projects, I found REST Assured. It was perfect, as it took care of low level HTTP calls under the hood, and provided a high-level, easy to use framework to write tests. Not only REST Assured works really well to test webMethods flow services, you can also run these tests as part of Continuous Integration process through Gradle.
You will need following things on your machine. Make sure these are working without any issues.
Java JDK 1.8 (link). Set JAVA_HOME. And add JAVA_HOME to your PATH
Here we are just taking advantage of Integration Server’s built in content handler for Content Type - ‘application/json’. For the flow service available on Integration Server, we can simply pass JSON request using REST Assured framework. Integration Server will take care of converting this to IDoc and subsequently process it to return a JSON response back to your test case.
Run the tests using Gradle wrapper
Gradle wrapper provides a convenient and easy to use CLI to run your tests. Using Gradle wrapper you can quickly associate your REST Assured tests with your Continuous Integration process.
Good thing about using REST Assured and Hamcrest to test your webMethods flow services is, it is completely FREE. You don’t need to buy an expensive automated testing solution to test your flow services.
Further resources to read
REST Assured has comprehensive documentation available to get you started.