Does the economic damage caused by Covid19 affect smaller cap companies more compared to bigger cap companies?

The Covid19 pandemic has taken all of us by surprise. Within a span of a few weeks, the US stock market has dropped to a level that is beyond the Financial Crisis of 2008 and more reminiscent of the Great Depression while stock markets around the world from Hong Kong to Japan to Tokyo have experienced similar shocks. But the news has reported that in this stock market crash. The bigger companies are able to weather the crisis better due to having bigger reserves compared to the smaller/mid-size companies. So I am going to use data science to do a quick comparison using data to see if this is true or false.

In the US, there are 2 market indexes which are the S&P(Standards & Poor) and Russell 2000/3000 index. These 2 indices track large and small/mid-size companies’ stock prices. I use stock price as a proxy for the health of the company, but there are many factors involved such as cash reserves, amount of debt, etc. But to keep things simple and to get moving. I decided to get the total stock prices from the top 10 stocks from the S&P and from the Russell 2000 index. The top 10 stocks from the S&P are listed here https://www.investopedia.com/top-10-s-and-p-500-stocks-by-index-weight-4843111

The top 10 stocks from the S&P are
1 – Microsoft
2 – Apple
3 – Amazon
4 – Facebook
5 – Alphabet
6 – Google
7 – Johnson & Johnson
8 – Berkshire Hathaway
9 – Visa
10 – JPMorgan Chase

And the top 10 stocks from the Russell 2000 index which I have picked are listed here https://www.fool.com/investing/stock-market/indexes/russell-2000/

1 – Teladoc
2 – Novocure
3 – Generac
4 – Lumentum
5 – Trex
6 – Amedisys
7 – Portal General Electric
8 – Haemonetics
9 – First Industrial Realty Trust
10 – Deckers Outdoor Corp

I pull all stock prices from Yahoo Finance website where I downloaded the stock prices based on a 6 month time range which start from 7th Jan to 5th June 2020. The 2 CSV files can be downloaded here for the S&P and here for the Russell 2000.

So with these 2 csv files. I need to plot them on a graph to see how they look like first. So using Google’s Colab, Python and Panda. I started the import and reading of the CSV

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd


dataset = pd.read_csv('S_n_P - V-2.csv')
X = dataset.iloc[:, 1].values.reshape(-1, 1)
y = dataset.iloc[:, 12].values.reshape(-1, 1)


Now, the CSV file show date, stock price and the total of the 10 companies. The graph needs to show date for X and stock price for Y. But Panda does not allow me to use date as a value when importing. So I modified my CSV to add in 1 more column day which is basically a sequence of running numbers starting from day 1 which is 7th Jan to the last day 5th June, which is day 105. This new day column is at index 1 while the stock prices are at index 12

Next, I plot the graph to see how the datapoint are displayed using this code

plt.scatter(X, y, color = 'red')
plt.title('S&P')
plt.xlabel('Day')
plt.ylabel('Price')
plt.grid(b=True, color='blue', alpha=0.6, linestyle='dashdot')
plt.show()


As you can see, you can see the stock price go up and then do a drastic fall in the center of the graph before heading up again.

With the graph of the top 10 stocks of the Russell 2000 index, we see this

The stock price goes up as expected and then down again at roughly the date range of the S&P graph show previously. So with these 2 graphs, it is hard for us to get more data since the data points are more or less pretty similar. Plus the graphs show the stock price going up and down and up, so a linear regression does not make sense as it will not reflect the up and downs of the data points. So I decided to use a polynomial regression instead and this is the code that I used

from sklearn.preprocessing import PolynomialFeatures
polynomial_reg = PolynomialFeatures(degree = 5)
X_polynomial = polynomial_reg.fit_transform(X)
lin_reg_2 = LinearRegression()
lin_reg_2.fit(X_polynomial, y)


Next, I add in these lines of code to show the curve and add more minor gridlines so that we can see the points better

plt.plot(X, lin_reg_2.predict(polynomial_reg.fit_transform(X)), color = 'grey')

plt.minorticks_on()
plt.grid(which='minor', linestyle=':', linewidth='0.5', color='black')

plt.grid(b=True, color='blue', alpha=0.6, linestyle='dashdot')
plt.show()

So with the S&P, we can see the curve in the graph

You will notice that the curve goes up to 6500 and then drops down to 5450 before heading up to 6750. This means there was a 16% drop at day 55 and then it goes up again to 6750 which is about a 3.8% increase from the initial high of 6500.

Now for the Russell 2000 curve, we get this

It goes to a high of about 1100 before dropping down to 950 for a 13% drop and then it goes up to 1110 for a 0.9% increase from the initial high of 1100.

This shows that both mid/small-cap companies and big companies have been equally impacted by the Covid19 crises as seen by the downturn of the curve. But mid/small-cap companies did not recover as much compared to the bigger companies. This could be due to reasons such as investor confidence and what they think of blue-chip companies, company cash reserves amongst other reasons. So this graph does show that mid/small-cap companies do tend to be affected to a greater extent in terms of recovery.

Ok, if you have seen the top 10 S&P stocks, a large majority of them are tech stocks such as Amazon, Microsoft, Apple, etc. Does that affect the recovery of the top 10 S&P stocks as a whole since most of the top 10 S&P stocks are tech stocks. So to do that, I decided to pull up the top 10 stocks from the tech-heavy NASDAQ via Yahoo Finance and the top 10 stocks are

1 – Apple
2 – Amazon
3 – Comcast
4 – Cisco
5 – Facebook
6 – Google
7 – Alphabet
8 – Intel
9 – Microsoft
10 -Nvidia

I have extracted out the data for NASDAQ stock and placed them here.

Next, we see how the graph lines up. Here is the graph taken from the top 10 stocks on NASDAQ

So the curve first tops up at 6240 and then it begins the decline to 5250 which is a 15.8% drop and then it rallies up to 6600 which is a 5% increase from 6240. This shows that tech stocks have a much higher recovery rate. This could be due to bullish investors who want to put money into companies which they deem to be safer such as tech stocks such tech companies are not so much affected by the Covid19 situation although stocks across the board have dropped due to investor confidence.

So with these 3 graphs, it would seem that there is some truth that bigger companies are more well equipped to weather the crisis caused by Covid19 as a whole, and tech companies have weathered this storm much better than others.

Here are the links to the CSV file that I used
Russell 2000 : https://gist.github.com/gibtang/f60fbcdc973f4fdf90e8a0f9edc668e3
Nasdaq :
https://gist.github.com/gibtang/8924b61c06043003d9d49d5aec842b73
S&P :
https://gist.github.com/gibtang/457b31db0feea1737fcac4ee99fa7678

And the code which I used for this article
https://gist.github.com/gibtang/62e854d6fb5976601193b089e8dc85d4

Simple sorting of a list of objects by a specific property using Python

In my rudimentIn my rudimentary experiments with Python and Data modeling where I have to import data into my Jupyter notebook. I thought of sorting and it occurred to me how do you sort a list of objects using a specific instance variable, such as name. For example, I have a list of car objects which consist of name and price.

Table 1

NamePrice
Ford20000
Volvo50000
BMW24000
Toyota15000
KIA12000
Audi40000
Tesla30000

So I want to produce a list where the results are sorted in alphabetical order using So I want to produce a list where the results are sorted in alphabetical order using the name of the car like so. And I didn’t want to use any libraries, so no import for me then.

Table 2

NamePrice
Audi40000
BMW24000
Ford20000
KIA12000
Tesla30000
Toyota15000
Volvo50000

Googling didn’t return me much information as the results returned plenty of information of sorting of numbers, some results regarding sorting of words and no satisfactory result of sorting of word which is part of an instance variable. So I

Googling didn’t return me much information as the results returned plenty of information on sorting of numbers, some results regarding sorting of words, and no satisfactory result of sorting of a word which is part of an instance variable. So I decided to have a crack at it. Python is not something that I am required to do in my day job. But I do use Python for the occasional scripting when there is a need for it. So I thought that I would have a crack at it.

So this is how I would have approached the problem and my example code is shown below

First, I would declare a class of cars and create a list to insert these objects

class cars:
    def __init__(self, name, price):  
        self.name = name
        self.price = price 

unsorted_cars = []
unsorted_cars.append(cars('Ford', 20000))
unsorted_cars.append(cars('Volvo', 50000))
unsorted_cars.append(cars('BMW', 24000)) 
unsorted_cars.append(cars('Toyota', 15000)) 
unsorted_cars.append(cars('Kia', 12000)) 
unsorted_cars.append(cars('Audi', 40000)) 
unsorted_cars.append(cars('Tesla', 30000)) 

And since I want to sort the list by the name of the card, I created an empty list and put in the car names into that list and use the standard sort function to sort the list

sorted_car_name = []
for car in unsorted_cars: 
	sorted_car_name.append(car.name)

sorted_car_name.sort()

This will then return a sorted list of car names in alphabetical order. Finally now that I have the list of sorted names. I can use this as a reference to get the list of sort car objects using this double for loop to iterate through the unsorted_cars list and use the name instance variable in each car object to compare against each word in the sorted_car_name list and then insert it into a new empty list sorted_car_list if there is a match

sorted_car = []
for sort_car in sorted_car_name:  
	for unsorted_car in unsorted_cars:
		if unsorted_car.name == sort_car:
			sorted_car.append(unsorted_car)
			break

s

sorted_car_list now will then have the final list of cars sorted by the car name in alphabetical order as shown in table 2 above. Do note that this method is not very efficient due to the double for loop where we loop through the list of cart objects in unsorted_cars and then loop through each word in sorted_car_name and do a comparison to see if there is a match and then we insert that unsorted_car object into the sorted_car list.

You can download the sample Python code here. To run the code, just go to your command line and type ‘python python_sort_sample.py’ and it will print out the list of unsorted cars and the final sorted cars. I hope this can be helpful to any Python folk out there.

A friend of mind, Ruiwen, just pointed out to me that Python has a sorted() function which can be used. The sorted() function takes in a list of objects, the key to sort by and returns the sorted list. This function uses lamba which create an anonymous function. So to sort our unsorted list of car names, we use

result_list = sorted(unsorted_cars, key=lambda cars: cars.name)
for car in result_list: 
	print(car.name + " and price is " + str(car.price))

So by passing in the list of unsorted cars, and the anonymous function and the attribute to sort by, which is the name of the car. We will get the sorted list in result_list. This is a much better way of sorting, although the usage of the lamba veers your Python code into the functional programming paradigm. Here is a link to the github gist holding the code sample https://gist.github.com/gibtang/83f9681b525908900ec4b490992f032d

Some related links to the sorted function
https://julien.danjou.info/python-functional-programming-lambda/
https://docs.python.org/3/howto/sorting.html
https://www.w3schools.com/python/ref_func_sorted.asp

Being thankful even during times of crisis

I just started helping in the development of www.coronatracker.com which is a website meant to be a single point for all news related to Covid-19 and we have intensified effort now that WHO has classified the outbreak as a pandemic. 

This is a purely voluntary effort and we work on it outside of office hours. The website runs on Nuxt.js for the frontend and Express.js for the backend. Being a hardcode PHP developer, I had to step out of my comfort zone to learn Node.js as my JS expertise was only related to DOM manipulation and JQuery.

But it was a good learning experience as I finally had the opportunity to pick up express.js and node.js. Although this is not a good time to be in, we must all be thankful for whatever we have now, in good times and bad.

My experience with YouTrip

Photo by Pixabay on Pexels.com

It’s been almost a month since I came back from my year end vacation where I took the entire family to Fukuoka, Hiroshima, Kyoto and Osaka. I have always loved visiting Japan and checking out the cultural sights, sounds and food and this has been my 5th time visiting Japan.

But 1 thing I did differently from my previous trips was that I brought 50% less cash and I use a YouTrip card instead. Previously, I was wary of using my credit card overseas due to the excessive fee that credit card companies charge for foreign currency usage.

Usage of the YouTrip card is the same as how you would use any Mastercard, except that you need to sign on the receipt. But generally, I did not encounter any issues with the card although a friend of mine had an issue of the transaction not going through on a few occasions.

But there are a few features that would have added more value to me, as a user

1 – Push notification when the wallet is running low. There was 1 occasion where my YouTrip card was declined and my instinctive reaction was that there was something wrong with the card. So I pay for my lunch using another credit card instead. But when I checked the mobile app, that was when I realised that the balance was insufficient to cover the charge, hence the declined payment. So having a push notification when the wallet amount drops below a certain amount will be useful for me

2 – Auto top-up and option to choose preset amounts. This is where the Grabpay function in the Grab app does it well. Grabpay has an auto top-up function and also options to top up with various default amounts. This makes the topping up UX much better and intuitive as I generally tend to top up my YouTrip card using certain fixed amounts.

3 – Maps of nearby ATMs where I can withdraw money. I know that YouTrip allows me to withdraw JPY from ATMs, but I didn’t have time to scout around for any ATMs. So having a maps feature showing me where the nearby ATMs would be good. As there is a small charge for every withdrawal. Having more people withdraw money using YouTrip can also be an additional revenue driver.

Overall, I have a pretty good impression of the YouTrip card and I will be looking at using it more often for my overseas travels.

Leadership is ever crucial in a startup

I am not afraid of an army of lions led by a sheep; I am afraid of an army of sheep led by a lion.

Startups are a scrappy business. Lack of money, product-market fit, resources and time are all common issues faced by a startup. Hence, it is crucial that the management level of any startup, from the CEO, COO to the CTO are all able to step up to leadership roles.

When you are fighting against bigger and more well armed competitors. Being a good leader and leading a team to overcome all odds is what will set your startup to succeed.

To be a good startup leader, you do not need to have a winning smile, good looks or outgoing as these are merely window dressing. A good startup leader needs

  1. Vision – Are you able to articulate your vision and inspire your employees even when the chips are down
  2. Authenticity – People can see a fake leader as clear as day. So you need to be authentic to earn the trust of your subordinates
  3. Empathy – Being able to understand the concerns and feelings of your staff and motivate them is important in a stressful startup environment

This video shows Jack Ma selling a compelling vision of Alibaba in his initial sales pitch. He may not look like what you would think a leader would look like, but Alibaba’s success speaks for itself.

If you are able to lead and manage your team well. Even an army of sheep will attain success down the road.

I hire based on attitude, not qualifications

accomplishment ceremony education graduation
Photo by Pixabay on Pexels.com

The Emperor Napoleon was often known to take off his cross of the Legion D’Honneur and place it with his own hands on the bosom of a brave man. Louis XIV would have first inquired if this brave man was noble. Napoleon asked if the noble was brave.

Napoleon came of age in a world where your lot in life was determined by whether you were born from nobility. He upended all that by rewarding his troops based on fearlessness and leadership in battle, regardless of rank or profession. And that played a big part in his success even though his officers and men came from all walks of life. General Saint-Cyr was the son of a tanner and Marshall Augereau’s father was a fruit seller. But these men proved their worth by soundly beating other armies in battle led by commanders who were from royal families.

Similarly, when I look at resumes or applications for roles in my department. I do not place heavy emphasis on things such as degrees in Computing Science, or a Master degree in Software engineering. I would instead ask for a Github link to their past projects which I will evaluate. Next, I will ask them questions to evaluate the applicants on 3 personal aspects of their personality and they are

  1. Willingness to learn
  2. Ability to work hard
  3. Taking the initiative

Whether the candidate has a CS or related degree is not a dealbreaker for me. I evaluate them not based on what paper they have, but what they know and what they are willing to do to fill in those missing gaps in their knowledge. But what made them great was not what they studied in university, but what they possessed in their attitude.

Hence, this also gives me a greater pool of people to select from as I do not restrict myself to hiring from universities or other academic institutions as my pool is now much larger than that.

Reducing technical debt in startup world

File:Yarn ball.jpg
In a startup, you are always expected to rollout new things fast. And this comes at the expense of code cleanliness, so over time, you will notice that the code starts looking ugly as hell, with outdated comments, ugly hacks, repetitive code etc. You get my my drift.

But yet, you can’t pause development for a few weeks or months to clean up the code as time is not on your side. But still, the technical debt and cruft keeps piling up every time you push a new commit to git.

So now you are stuck between a rock and a hard place. You need to rollout your product features at a regular cadence and yet, as a developer. Seeing all that nastiness in the code base gives you a headache every time you fire up your favourite editor. VS Code is my IDE of choice in this particular case.

You know that you can’t totally ignore the growing technical debt, as all that debt will need to be repaid at some point in time in the future. And yet it needs to be shaved off, either today, tomorrow, or in some indeterminate point in the future. So what can you do? ¯\_(ツ)_/¯

So here is what I did. I decided to factor in repaying of the interest in my day to day development work. So whenever I am working on a specific part of my codebase. I will allocated additional time in just cleaning up of the code related to that specific part of the codebase. That can include refactoring of code, removing of stale comments etc

But how much time do I allocate? That actually depends on how critical that part of the codebase is to your startup.

I currently work in a startup which does B2B food delivery, so the critical paths are the food ordering flow, checkout and payment flow. So whenever I am working on a piece of code that touches these sections of code. I will put in more effort to refactor and clean up the code as these parts are heavily used, and will have a lot of impact if my refactoring introduces some bugs. I will even write more tests that usual just to make sure that my refactored code is stable.

But if I am working on something that is outside the critical paths and which I know does not impact my product much, then I may choose to do minimal refactoring, or not refactor the code at all.

Through this methodology, I can slowly shave off some technical debt, and yet have minimal impact on product development. As everyone who has worked in a startup knows. Time to market is very important, but yet, as a developer. You can’t let your codebase incur too much debt as that debt will need to be repaid sooner or later.

So it is better to start paring down the debt during your day to day development rather than to do it all in 1 shot in the future.

My take on mobile payments in SEA

5121286093_db38be7d92_z

With the recent Fintech festival in Singapore lately. That has made fintech hotter than hot. Mobile payments are now one of the hotter areas in fintech and a lot of companies are jumping into this vertical. Just a few months ago, our prime minister mentioned mobile payments in Singapore and compared it with China where Wechat is so ubiquitous for payments and not just for chatting. Razer then announced that they are working on a mobile payments platform for Singapore, by Singaporeans. But suffice to say, Grab has the upper hand in this fight. Grab launched Grabpay late last year and since they have transitioned it from a credit top-up platform to a money transfer platform where you can transfer money from 1 Grab account to another. And now they have worked with hawker stalls to help them use Grabpay to accept payments. All this fit into a logical step by step play by Grab to corner the mobile payments market in South East Asia. And the mobile payments market in South East Asia is still up for grabs and my money is on Grab to get 1st place.

But transferring money from 1 Grab account to another is simple enough as the numbers are transferred from within their own infrastructure. But the killer comes when customers need to transfer money out from their Grab account to their bank account. Then the banks will demand their pound of flesh as the banks realize that a lot of fintech startups are encroaching on their existing turf or stealing their lunch from new unserved markets. As the banks own the bank accounts of the customers and are in a position of power, Grab and any other similar players will need to pay hefty fees in order to let Grab customers transfer their Grabpay credits from their phone to their bank accounts.

But there are 2 other ways that Grab can come out ahead
– Enhance their current Grab rewards programs to include payment for services and goods so that Grab customers can do more using the Grab app aka the Wechat model. If there are sufficiently good enough services on the app where people can do their entire shopping online and do not see the need to transfer money from their Grabpay account to their own account. Then there is no need to negotiate with the banks who are the gatekeepers

– Negotiate with a smaller bank for good enough rates and once Grab has a critical mass of users doing money transfer from their Grabpay to their own bank account. They can then approach the bigger banks and pitch their deal as Grab would be in a better bargaining position then.

Mobile payments is a brutal game and as there is no incumbent player here now in South East Asia for this huge market. I look forward to seeing 1 soon. #fintech #mobilepayments

Bricks & Mortar is not dying. It is just evolving

36194093672_ac6d716118_k

Everyone has said that bricks & mortar shops are dying and that it has started years ago with people taking shuttered stores as a sign of the retail apocalypse. But that is just hyperbole. Upon reading this article, it only reinforced my view that retail is still here to stay, but in another different form as we know it.

Honor, which now sells half its phones in offline retail stores, said it had also been opening up retail stores with local agents over the past years.

“Our offline sales might soon outstrip that from the internet, but it does not mean that we are no longer an internet brand, as Honor will stick to its business model,”

Honor is a brand by China’s Huawei which is also home of 1 of the largest e-commerce company Alibaba. In a country where the e-commerce consumer behavior is more advanced than most countries and people are used to using Wechat for payments, procurement of services etc. It comes as a surprise that retail purchases are still a big part of the consumer behavior.

E-commerce may have provided convenience to a lot of shoppers, but people still want to see, touch and feel products with their own hands before putting down money for a purchase. Handphones are a prime example of an item where people prefer to touch, play and grasp it in their hands to see how it feels like. After all, you can’t tell how responsive a mobile phone is without actually tapping on the screen and doing a few swipes.

In my company A Better Florist, where we do purely e-commerce retailing of flowers, we do get the occasional walk-in customer who drops by to see our bouquets in real life even though we do none whatsoever advertising of our shop.

Plus now, it is common for people to go to retail shops to look and touch the item and then do the purchase online with free delivery thrown in. So for retail malls to survive, they must transition to a showroom concept instead of being a pure brick & mortar play. Make your entire mall into a showroom showcasing your products and then give the shoppers an iPad or a mobile app where they can do the purchase online after viewing the item. Just like what Singpost is intending to do with their own mall and that is the right move that retail malls should follow.

After all, survival is all about evolving and the one most open to evolving will survive.

 

 

It pays to network for startups

7798615430_ffd9167197_o

Reading this article on co-working spaces and reading about the 20 billion valuation of WeWork. Prior to joining A Better Florist, I ran my own consultancy service Azukisoft and I was reminded of my initial reason why I joined a co-working space in the first place, which in this case is Hackerspace.sg. I joined them as I was looking for a cheap space to work out from. Plus, the different people there who work on different tech initiatives and in different startups provided me with a sounding board for my development ideas or product ideas. It is time that people see co-working spaces as more of just a place for working, but also a place to grow a valuable network. Over the years, I have also gotten quite a bit of business and work from referrals via the members and events held there.

As a business, you live and die by revenue. And networking will be a good channel to meet people and get more exposure and revenue.

Here is the article that I read
http://www.china-briefing.com/news/2017/10/12/coworking-spaces-in-china-no-longer-just-for-tech-startups.html