Key financial ratios when buying stocks

Ratios come from:

  • Balance sheet
  • Income statement
  • Cash flow statement

It is important compare these rations within the industries.

Some ratios are more important to some other industries.

  • Some ratios are more important to some industries than others. For example, inventory turn is important when evaluating retail stock.
  • Some ratios are more important to stock type than others. Example, dividend yield

Stock ratio categories:

  • Valuation(Price)
    • Price to Earnings (P/E)
    • Price to Earnings Growth (PEG)
    • Price to Sales (P/S)
    • Price to Book (P/B)
    • Dividend Yield
    • Dividend Payout
  • Profitability
    • Return On Assets (ROA)
    • Return on Equity (ROE)
    • Profit Margin
  • Liquidity
    • Current Ratio
    • Quick Ratio (Acid Test)
  • Debt
    • Debt To Equity
    • Interest Coverate
  • Efficiency
    • Asset Turnover
    • Inventory Turnover

Valuation: Price to Earning Ratio (P/E)

Requires: Income statement, most recent share price

Formula: P/E ratio = Price per share / earnings per share

P/E ratio means how much it costs to pay for share to earn $1 earning.

Shares trading with low P/E ratio when compared with its competitor are considered value stocks.

Valuation: Price to Earnings Growth Ratio (PEG)

Requires: Income statement, most recent share price

Formula: PEG ratio = (P/E ratio)/Projected Annual growth

PEG ratio indicates the future earnings growth while P/E ratio indicates current performance.

Stock with PEG ratio below 1 is considered a good value stock.

Valuation: Price to Sales Ratio(P/S)

Requires: Income statement, most recent stock price

Formula: P/S ratio = (Price / Share)/(Annual Sales/Share)

Much like P/E or P/B, think of P/S as the price paid for $1 sales.

Valuation: Price to Book Ratio (P/B)

Requires: Balance Sheet, Most recent stock price

Formula: P/B Ratio = Price per share / Book value per share

Book value per share = Share holder equity / number of shares outstanding

It is how much you pay for $1 equity in the company. Lower the P/B ratio the more value the stock is. High value of P/B, P/E, PEG may not be a bad indicator too. Sometimes high value means something good is happening with the company and people are taking risk / paying premium to buy the stock, which may be good indicator for growth stock.

Valuation: Dividend Yield

Requires: Income Statement, Most recent stock price

Formula: Dividend Yield  = Dividend per share / price per share

If dividend yield is great, it is important to check the dividend yield over period, and it is also important to compare the yield with competing stock. When dividends are cut, that may result in reduced stock prices and this can be loss to investor.

Valuation: Dividend Payout

Requires: Income statement

Formula: Dividend Payout ratio = Dividend / Net income

This indicates percentage of profits distributed to shareholders. Higher dividend payout ratio higher the risk, and indicates the ability to payout dividend in future.

Lower payout ratio indicates higher profits and good performance of the company. Higher payout ratio indicates lower profits and poor performance of the company. With poor performance, company may not be paying same dividends in future. If the dividend payout ratio is:

  • Less than 50% – Excellent
  • 50% to 60% – Good
  • 60% to 70% – Ok

Compare the dividends in industry.

  • Utilities normally have higher payout ratios
  • Real Estate Investment Trusts (REIT) required to have higher payout to be considered a REIT

Profitability: Return on Assets (ROA)

Requires: Income Statement, Balance Sheet

Formula: Return on Assets = Net Income / Average Total Assets

A company buys assets to conduct business. ROA indicates how good the company is at effectively using its assets to make money.

Higher ROA indicates that company is performing well.

Profitablity: Return on Equity (ROE)

Requires: Income Statement, Balance Sheet

Formula: Return on Equity = Net Income / Average Stockholder Equity

ROE indicates how good a company is at rewarding shareholders for their investment.

For example, if  company B reported $10,000 of net income its shareholders have $200000 in equity, its ROE is 5%. For every $1 of equity shareholders own, the company generates $0.05 in profits each year.

Higher ROE indicates that company is performing well.

Profitability: Profit Margin

Requires: Income Statement

Formula: Profit Margin = Net Income / Sales

Profit margin calculates how much of a company’s total sales flow through to the bottom like.

Higher profits are better for shareholders, as is a high (and/or increasing) profit margin.

It is important to compare profit margin by industry. Retail companies like target has lower profit margin, but to understand the potential it is important to compare with another competing company in the same sector.

For companies like Microsoft, profit margin usually is high, but less number of sales compared with retail. So it is important to compare the profit margin with right competitor.

Liquidity: Current Ratio

Requires: Balance Sheet

Formula: Current Ratio = Current Assets / Current Liabilities

Indicates ability to make payments and obligations in shorter terms against is short term assets.

If the ratio is over 1.0, it indicates company has more short-term assets than short-term liabilities.

If the ratio is less than 1, the opposite is true. But this does not mean company is not performing but it is important to dig into reasons to understand if the deficiency is temporary.

Liquidity: Quick Ratio (Acid test ratio)

Requires: Balance Sheet

Formula: Quick Ratio – (Current Assets – Inventory) /  Current Liabilities

Similar to current ratio, but this indicates more accurate situation of company to meet its shorter term payments and obligations.

By deducting the value of inventory, which may take time to sell, it takes into account current liquidity into consideration.

Debt: Debt to Equity Ratio

Requires: Balance Sheet

Formula: Debt to Equity Ratio = Total Liabilities / Total Shareholder Equity

Debt to Equity ratio measures relationship between amount of capital that has been borrowed (debt) and amount of capital contributed by share holders (equity)

More debt to equity indicates risky stock and company may not be able to meet its debt obligations. Lower debt ratio indicates that the company is performing. Also it is important to understand the reason for the debt.

Debt: Income Coverage Ratio

Requires: Income Statement

Formula: Interest Coverage Ratio = EBIT / Interest Expense

Indicates ability of company to make interest payments on its debt. This is important to understand as if the company is not able to pay interest in its debts, it will be forced into bankruptcy.

Interest coverage ratio is lower than 1, it is a sign of trouble.

Efficiency: Asset Turnover Ratio

Requires: Income Statement, Balance Sheet

Formula: Asset Turnover Ratio = Sales / Average Total Assets

Like Return of Assets, Asset Turnover ratio tell you how good the company is at using its assets to make products to sell.

For example, if Company A reported $100000 of sales and owns $50000 in assets, its asset turnover ratio is 2x. For every $1 of assets it owns, it can generate $2 in sales each year.

Higher the value, better the performance of the company.

Efficiency: Inventory Turnover Ratio

Requires: Income Statement, Balance Sheet

Formula: Inventory Turnover Ratio = Cost of Goods Sold / Average Inventory

A company should be selling its inventory as fast as possible instead of stockpiling it. The inventory turnover ratio indicates this efficiency in cycling inventory.

High inventory turnover ratio indicates the firm is selling inventory relatively quickly.

Launching custom scripts from command (shortcuts)

Well, too lazy to execute the commands to launch my vpn, rsync commands etc I created a bash script which does it for me.

Well, that did not make me happy either, because I have to cd into the directory where my scripts are and then run them. Errr…. my time is too precious to do that (I am too lazy to do that).

Thinking why not execute my scripts from using anywhere just like I launch any other standard linux commands???

Google again, and I stumbled upon this thread on asubuntu.com

Life saver 🙂 Joe Oppegaard.

Steps:

Create a bin folder in home directory:

Copy scripts into the folder:

Edit ~/.bashrc adding below to the end of the file:

PATH=$PATH:~/bin

Open new terminal and enter the script name to executing the script from anywhere in terminal.

Linux nohup to launch multiple scripts using bash

I came across this useful command when I wanted to automate some of my scripts to launch openvpn, rsync etc using one command.

The problem I had when trying this is with HUP (hangup) signal that would prevent the execution of commands further to execute other scripts.

For example, I have commands like this in my bash script:

cd /media/root/WORKING;
terminator --working-directory=/media/root/WORKING;
openvpn /media/root/WORKING/OS*;
/root/Desktop/c-programs/util/sync-cprograms.sh;
/root/Desktop/c-programs/util/sync-scripts.sh;

The first to commands gets executed and terminator launches with working directory mentioned.

OpenVPN works too, but remains in verbose mode (am I correct???). The process does not end until I exit the same. So my next commands to run scripts (that sync my folders on desktop using rsync).

Was looking for a solution and I can get any from Google. I found this command nohup. With nohup, my bash looks as below:

cd /media/root/WORKING;
openvpn /media/root/WORKING/OS* </dev/null &>/dev/null &
nohup bash /root/Desktop/c-programs/util/sync-cprograms.sh </dev/null >/dev/null 2>&1 &
nohup bash /root/Desktop/c-programs/util/sync-scripts.sh </dev/null >/dev/null 2>&1 &
terminator --working-directory=/media/root/WORKING &

Reference: nohup, null device

APT-GET update Invalid signatures

I had this issue when updating Kali linux vm for the first time.

root@kali:~# apt-get update
Get:1 http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease [30.5 kB]
Err:1 http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease
 The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease: The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
W: Some index files failed to download. They have been ignored, or old ones used instead.

This solution did not work and update ends with error as above:

rm -rf /var/lib/apt/lists
apt-get update 
apt-get install kali-archive-keyring

Working solution as below:

Add the gpg key:

gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6

Check the fingerprint:

gpg --fingerprint 7D8D0BF6

Sample output:

pub   rsa4096 2012-03-05 [SC] [expires: 2021-02-03]
      44C6 513A 8E4F B3D3 0875  F758 ED44 4FF0 7D8D 0BF6
uid           [ unknown] Kali Linux Repository <devel@kali.org>
sub   rsa4096 2012-03-05 [E] [expires: 2021-02-03]

then :

gpg -a --export 7D8D0BF6 | apt-key add -
apt update

Source: Stack Exchange

Linux command cheats

Remote desktop (rdesktop):

To open a remote desktop over rdp with required window dimension (1280×960 in this example):

root@kali:/media/root/PWK# rdesktop -u offsec -p CEmbxkhMQ1Z 10.11.14.78 -g 1280x960

Change file owner/group (chown):

SYNOPSIS                                                                        
     chown [-fhvx] [-R [-H | -L | -P]] owner[:group] file ...                   
     chown [-fhvx] [-R [-H | -L | -P]] :group file ...

chown localshare:localshare demo

We can see that the new owner of demo folder is localshare. But does this change apply to sub folders??? No… child folders/files are still owned by previous owner/s as below:

To change the owner for all content in folder:

chown -R localshare:localshare demo

Debugging compiled binaries in Linux

GNU development tools provide a program called objdump.

Example: Binary of a hello world program as in post Compiling C program in Linux to output 20 lines after the regular express main.:

root@kali:~/Desktop/c-programming/demo# objdump -D helloworld | grep -A20 main.:
0000051d <main>:
 51d: 8d 4c 24 04 lea 0x4(%esp),%ecx
 521: 83 e4 f0 and $0xfffffff0,%esp
 524: ff 71 fc pushl -0x4(%ecx)
 527: 55 push %ebp
 528: 89 e5 mov %esp,%ebp
 52a: 53 push %ebx
 52b: 51 push %ecx
 52c: 83 ec 10 sub $0x10,%esp
 52f: e8 ec fe ff ff call 420 <__x86.get_pc_thunk.bx>
 534: 81 c3 cc 1a 00 00 add $0x1acc,%ebx
 53a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
 541: eb 16 jmp 559 <main+0x3c>
 543: 83 ec 0c sub $0xc,%esp
 546: 8d 83 f0 e5 ff ff lea -0x1a10(%ebx),%eax
 54c: 50 push %eax
 54d: e8 5e fe ff ff call 3b0 <puts@plt>
 552: 83 c4 10 add $0x10,%esp
 555: 83 45 f4 01 addl $0x1,-0xc(%ebp)
 559: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
 55d: 7e e4 jle 543 <main+0x26>

Reference to understand number system:

Number Systems: An Introduction to Binary, Hexadecimal, and More

The hexadecimal number starting with 0x0000051d on the far left are memory addresses. Location in memory that these address point to contain bits of machine language instructions.

Hexadecimal instructions in the middle of listing in above screen shot are the machine language instructions. These hexadecimal values are representations of the bytes of binary 1s and 0s the CPU can understand. But language instructions such as 0101010011 are useful for CPU only and not for naked eye. So, machine code is displayed in hexadecimal bytes and each instruction is put on its own line.

Still, these hexadecimal instructions are not really helpful to understand the instructions unless we know what they mean. The instructions on the far right are assembly language representation of the hexadecimal commands.

The assembly shown in above screen shot is in AT&T syntax. It is easy to recognize AT&T syntax by the cacophony of % and $ symbols prefixing everything.

The same code can be shown in Intel syntax (which is cleaner compared with AT&T syntax) using option -M intel as below:

root@kali:~/Desktop/c-programming/demo# objdump -M intel -D helloworld | grep -A20 main.:
0000051d <main>:
 51d: 8d 4c 24 04 lea ecx,[esp+0x4]
 521: 83 e4 f0 and esp,0xfffffff0
 524: ff 71 fc push DWORD PTR [ecx-0x4]
 527: 55 push ebp
 528: 89 e5 mov ebp,esp
 52a: 53 push ebx
 52b: 51 push ecx
 52c: 83 ec 10 sub esp,0x10
 52f: e8 ec fe ff ff call 420 <__x86.get_pc_thunk.bx>
 534: 81 c3 cc 1a 00 00 add ebx,0x1acc
 53a: c7 45 f4 00 00 00 00 mov DWORD PTR [ebp-0xc],0x0
 541: eb 16 jmp 559 <main+0x3c>
 543: 83 ec 0c sub esp,0xc
 546: 8d 83 f0 e5 ff ff lea eax,[ebx-0x1a10]
 54c: 50 push eax
 54d: e8 5e fe ff ff call 3b0 <puts@plt>
 552: 83 c4 10 add esp,0x10
 555: 83 45 f4 01 add DWORD PTR [ebp-0xc],0x1
 559: 83 7d f4 09 cmp DWORD PTR [ebp-0xc],0x9
 55d: 7e e4 jle 543 <main+0x26>

Compiling C Program in Linux

C code must be compile into machine instructions before it can be executed.

GCC compiler (GNU compiler collection) is free compiler that translates C into machine language that a processor can understand.  Compiling a C code generates binary code.  The binary’s instructions are written in machine language, an elementary language the CPU can understand.

Each architecture has different machine language. Compilers are designed to translate the language of C code into machine language for a variety of architectures.

Example:

Below is a hello world program named helloworld.c

#include <stdio.h>

int main()
{
 int i;
 for (i=0; i< 10; i++) {
 printf("Hello World!\n");
 }
 return 0;
}

To compile the c program:

root@kali:~/Desktop/c-programming/demo# gcc -o helloworld helloworld.c
root@kali:~/Desktop/c-programming/demo#

Executing the above command to compile the C program generates a binary executable file helloworld:

This compiled file requires executable permission to be executed. We can ls command to verify existing permissions on file:

root@kali:~/Desktop/c-programming/demo# ls -l helloworld
-rwxr-xr-x 1 root root 7252 Jan 21 00:31 helloworld

As the file is already executable, we can run the binary:

root@kali:~/Desktop/c-programming/demo# ./helloworld
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
root@kali:~/Desktop/c-programming/demo#

Bash script to mount SMB drive

I used to have my working directory on my home NAS with Samba file sharing. Below script helped me to avoid entering mount command and openvpn command every time I login into my computer.

cifs-utils must be installed on linux system to mount a SMB share using mount.cifs. cifs-utils can be installed using below command:

$ sudo apt-get install -y cifs-utils
#!/bin/bash

echo "Enter user for shared folder"
read shareuser
echo "Enter share password"
read sharepass

echo $shareuser
echo $sharepass

mount.cifs //<host>/<Name of SMB share> /root/Desktop/<Folder for mount> -o username=$shareuser,password=$sharepass
cd /root/Desktop/<Folder for mount>
openvpn OS*

I found this article “Install cifs-utils for SMB client” helpful if you want to mount Samba shares when system starts.

Useful commands to launch terminator

I like to use terminator over default terminal in linux, and I also like to use a bash script that can connect me to VPN and launch terminator with working directory as the directory that contains my project root.

I used OS* in below bash because name of vpn config file starts with “OS” and I have no other files in the directory with name starting with “OS”

#!/bin/bash
terminator --working-directory=<path to directory>
cd /media/root/USB && openvpn OS* &

 

Permission denied when executing C Program on Linux(from flash drive)

I had this issue when trying my first hello world like C program on Kali linux. I am able to save and compile C program using GCC (GNU compiler collection) but could not set the permissions to it.

The reason??? the file is on a USB drive. I am not sure if mounting it via VM ware is a reason. However, could not execute it from the pen drive.

Will be very happy if someone can explain the reason 🙂

I tried it, and you can notice that I am current on c-programming folder in my pend drive.

root@kali:/media/root/PWK/lab/c-programming# ls
firstprog firstprog.c
root@kali:/media/root/PWK/lab/c-programming#

The permissions before chmod:

root@kali:/media/root/PWK/lab/c-programming# ls -l firstprog
-rw-r--r-- 1 root root 7252 Jan 13 01:05 firstprog
root@kali:/media/root/PWK/lab/c-programming#

And after chmod:

root@kali:/media/root/PWK/lab/c-programming# chmod +x firstprog
root@kali:/media/root/PWK/lab/c-programming# ls -l firstprog
-rw-r--r-- 1 root root 7252 Jan 13 01:05 firstprog
root@kali:/media/root/PWK/lab/c-programming#

Now… moved the folder to Desktop and trying the same:

root@kali:~/Desktop/c-programming# ls
firstprog firstprog.c
root@kali:~/Desktop/c-programming# ls -l firstprog
-rw-r--r-- 1 root root 7252 Jan 13 01:05 firstprog
root@kali:~/Desktop/c-programming# chmod +x firstprog
root@kali:~/Desktop/c-programming# ls -l firstprog
-rwxr-xr-x 1 root root 7252 Jan 13 01:05 firstprog
root@kali:~/Desktop/c-programming#

And now executing the same:

root@kali:~/Desktop/c-programming# ./firstprog
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
root@kali:~/Desktop/c-programming#

Bingoooo!!! 🙂