Saturday, February 5, 2022

Inter Bank Loans (LIBOR, SOFR, SONIA, ESTR)

 Interbank Loans are very short term loans primarily over night loans between banks

Terms are short, however transactions are huge. Hundreds of Billions of dollars.

Variety of interest rates are associated with this Markets 

Fed Funds Rate : Rate at which US Banks can borrow from each other to full fill their Fed reserve requirements. This is a primary instrument for FED's monitory policy

LIBOR : London Interbank Offer Rate, has been around for sometime. It was a benchmark rate for Fixed Income securities for decades. However, with recent abuse it is being replaced by other rates.

SOFR : Secured Overnight Financing Rate (US Markets replacement for LIBOR)

SONIA : Sterling Overnight Index Average (UK Markets Replacement for LIBOR)

ESTR: Euro Short Term Rate (Euro Zone's replacement for LIBOR)

This market is very important to us, because it sets the short term interest rates for the entire Fixed Income.

It is also the market through which the Central Banks can exercise their monitory policy on the markets.

This the market where the Central Banks have the most control over and it is the conduit through which they can transmit their monetary policy to the economy.

Through this control they set interest rates for all short term markets.


Money Markets & Repos

Money Markets are usually very short term instruments.

Debt Market is roughly divided into 2 kinds

Bond Markets -> Maturities > 1 year

Money Markets -> Maturities < 1 year

TBills are Money Markets and they mostly use actual/360 or actual/365 conventions.

Repos are another short term money market Instrument.

Repo : Repurchase Agreement

Short term contract between 2 parties to exchange cash for an asset with an agreement to reverse the exchange at a future point.

2 Parties will enter into Repo Agreement.

One Party will lend cash by take other party's security. 

Second party will agree to buy the security back at a predetermined date in the future by paying the cash + interest (Repo Rate) in the contract.

Usually Repo's are very short term and they buy back the very next day.

REPO is from the buyers perspective.

Reverse Repo is the same thing from the lenders perspective (Party who is lending cash)

Example of Repo

Suppose a bank enters into a REPO agreement with a Broker Dealer. 

On Monday March 18, Broker Dealer will purchase a $5 M US Treasury Note with a coupon rate of 4.5%. With Bond currently trading at $4.5M, Broker Dealer agreed to purchase at a price of $4.4M with a repo rate of 1.5% and both parties agreed to buy it back the next day.

Note in the above transaction, Broker dealer is buying the bond at a price (4.4M) less than its market value (4.5M). This difference below the market rate is called "Hair Cut". To protect the lender incase of a default.

Hair Cut : When the amount is lent less than the Market Value of the Security, it is called Hair Cut. Charging Hair Cut will mitigate the loss of Capital.

Overnight Repos: Repos that expire the next day are called Overnight Repos

Term Repos: Little longer term Repos than overnight are called Term Repos.

Friday, February 4, 2022

Treasuries Basics

 Government Debt is called Treasury

Treasury Bills (T-Bills) -> Govt Debt with maturity < 1 year

Treasury Notes (T-Notes) -> Govt Debt with Maturity between 1 and 10 years

Treasury Bonds (T-Bonds) -> Govt Debt with Maturity more than 10 years

Treasury Strips (T-Strips) -> Zero Coupon Bonds issues by US Govt with maturity > 1 year backed by T-Bonds and the coupons from TBonds.

UK Govt Bonds are Gilts: UK Govt Bonds with maturity between 1 -30 years.

US Notes and Bonds, Gilts pay Coupons Semi Annually

Issue Date : Date when the Bond originated.

Maturity Date for a 10 year bond will be IssueDate + Maturity Date

Accrued Interest is calculated as Actual/Actual.

Sovereign Debt is the Government Debt

German Short term Bonds (< 5 years) is called Bobls.

German Long term Bonds are called Bunds

Bonds Basics

Coupon Bonds generate Cash Flows (coupons) at Preset Intervals

cash flow c1, c2, c3, c4 etc

are generated at time intervals

time interval t1, t2, t3, t4 etc

Last cash flow is cn+face value of the bond

Face Value of the bond is also called Par or Nominal value or Principal

Maturity Date is the Date contact ends. On or about maturity date, face value of the bond is paid to the Bond Holder by the Bond Issuer

Prior to the maturity, only interest / coupon payments are made.

Vanilla Bond or Bullet Bond is bond is the bond that pays our the Principal only in the end on the maturity date along with last coupon. No amortization.

If coupon is paid several times (k times) a year, the actual coupon that is being paid out at each interval is c/k

Most common coupon frequencies are 1 (Annually) and 2 Semi Annual

Zero Coupon Bonds : are special case that make exactly one payment on the Maturity Date. (Principal + Coupon Amount)

Bond Price is a measure of its economic value

Yield : Yield is a return measure for an investment over a set period of time, expressed as a percentage

Bond Yield or Yield to Maturity of the bond has a direct relationship with Bond Price.

Price=t1T(1+YTM)tCash Flowstwhere:YTM= Yield to maturity


asdfasf

adsfafa


asdfasd


Yield is inversely proportional to Bond Price


The more the yield the less will be Bond Price

Bond Price vs Nominal Value 

Bond Price > Nominal Value -> Bond is trading at Premium

Bond Price < Nominal Value -> Bond is trading at Discount

Bond Price = Nominal Value -> Bond is at Par

Yield < Coupon Rate -> Premium Bond

Yield = Coupon Rate -> On Par

Yield > Coupon Rate -> Discount Bond

Bond's Dirty Price

A dirty price is a bond pricing quote, which refers to the cost of a bond that includes accrued interest based on the coupon rate.

Remove Accrued Interest from the Dirty Price we have clean Price.

If you're pricing/selling the bond in between coupon dates,  Accrued interest from last coupon to the sale date belongs to the seller and from sale date to next coupon belongs to the buyer.

Day Conventions 

Actual /Actual (Assumes all days in the year 28 or 29 or 30 or 31 days a year)

30/ 360 (Assumes every month has 30 days and 360 days in the year)

30/365 (Assumes every month has 30 days and 365 days in a year)





















Financial Analytics - Interest Rate calculation

Interest Rate calculation

Simple Interest = PtR/100 
P= Principal
t=Time Period
R = Rate of Interest

Compound Interest over T :

A = P(1 + r/n)nt
  • A = Accrued amount (principal + interest)
  • P = Principal amount
  • r = Annual nominal interest rate as a decimal
  • R = Annual nominal interest rate as a percent
  • r = R/100
  • n = number of compounding periods per unit of time
  • t = time in decimal years; e.g., 6 months is calculated as 0.5 years. Divide your partial year number of months by 12 to get the decimal years.
  • I = Interest amount
  • ln = natural logarithm, used in formulas below
Continuous Compounding :
𝐴=π‘ƒπ‘’π‘Ÿπ‘‘

P&L = V(T) - V(0)

Gross Return = V(T)/V(0)

Return = P&L/V(0)

Return = Gross Return -1

Annualized Return (Average of Returns over a period T)
(1+Row) Pow T = V(T)/V(0)

Row = (V(T)/V(0))Pow 1/T -1




Wednesday, April 14, 2021

Dave Ramsey's Rants

Flying Turkey

    Just because you see a turkey flying in a tornado doesn’t mean turkeys can fly.

    your ways of handling money have to work in good times and in bad.

About Savings

     Savings without a mission is garbage. Your money needs to work for you, not lie around.

    Winning at money is 80 percent behavior and 20 percent head knowledge.

Denial

90 percent of solving a problem is realizing there is one. Focused intensity, life-or-death intensity, is required for you to reset your money-spending patterns, and one of your biggest obstacles is DENIAL.

Be Strong - This is funny

For your own good, for the good of your family and your future, grow a backbone. When something is wrong, stand up and say it is wrong, and don’t back down.


Frog Legs Story :

The story goes that if you drop a frog into boiling water, he will sense the pain and immediately jump out. However, if you put a frog in room-temperature water, he will swim around happily, and as you gradually turn the water up to boiling, the frog will not sense the change. The frog is lured to his death by gradual change. We can lose our health, our fitness, and our wealth gradually, one day at a time. It might be a clichΓ©, but that’s because it is true: The enemy of “the best” is not “the worst.” The enemy of “the best” is “just fine.


Few people have the courage to seek out change.


Debt and Other Fancies

    It is human nature to want it and want it now; it is also a sign of immaturity. Being willing to delay pleasure for a greater result is a sign of maturity

Myth: Debt is a tool and should be used to create prosperity. 

Truth: Debt adds considerable risk, most often doesn’t bring prosperity, and isn’t used by wealthy people nearly as much as we are led to believe.


Joining the Lie - Human Nature / Acceptance Club :

I have heard it said that if you tell a lie often enough, loudly enough, and long enough, the myth will become accepted as a fact. Repetition, volume, and longevity will twist and turn a myth, or a lie, into a commonly accepted way of doing things. Entire populations have been lulled into the approval of ghastly deeds and even participation in them by gradually moving from the truth to a lie. Throughout history, twisted logic, rationalization, and incremental changes have allowed normally intelligent people to be party to ridiculous things. Propaganda, in particular, played a big part in allowing these things to happen

When we participate in what the crowd identifies as normal, even if it is stupid, we gain acceptance into the club. Sometimes we don’t even realize what we are doing is stupid because we have been taught that it’s just “the way you do it,” and so we never ask why. As we participate in the myth, we learn to spout the principles of the myth. After the years go by and we have invested more money and time into the myth, we become great disciples and can preach the points of the myth with great fervor and volume. We become such experts on the myth that we can sell others on joining the lie. I once joined in the lie, but no more.


Don’t Let the Monkeys Pull You Down!

A group of monkeys were locked in a room with a pole at the center. Some luscious, ripe bananas were placed on top of the pole. When a monkey would begin to climb the pole, the experimenters would knock him off with a blast of water from a fire hose. Each time a monkey would climb, off he would go, until all the monkeys had been knocked off repeatedly, thus learning that the climb was hopeless. The experimenters then observed that the other primates would pull down any monkey trying to climb. They replaced a single monkey with one who didn’t know the system. As soon as the new guy tried to climb, the others would pull him down and punish him for trying. One by one, each monkey was replaced and the scene repeated until there were no monkeys left in the room that had experienced the fire hose. Still, none of the new guys were allowed to climb. The other monkeys pulled them down. Not one monkey in the room knew why, but none were allowed to get the bananas. 

We aren’t monkeys, but sometimes we exhibit behavior that seems rather chimplike. We don’t even remember why; we just know that debt is needed to win. So when a loved one decides to get a Total Money Makeover, we laugh, get angry, and pull him down.

Dont fall for the Lie

We bought the lie! We lived our lives according to the standards set to “keep up with the Joneses.” Turns out they were broke and living in debt too. 

Friday, July 10, 2020

Rumi On God



Ultimate goal of meditation. So beautifully articulated.
























































Tuesday, January 21, 2020

Java Arrays

Copy Elements of Array into new Array :

Arrays.copyOfRange(sourceArray, i, i+3)

This will copy 3 elements from the location i into new Arrays

Character Arrays :

Remove punctuation from String :

1) Convert String into char Array

char[] charArr = str.toCharArray()

StringBuilder sbr = new StringBuilder();

for(i=0;i
if(charArr[i].isLetterOrDigit()) {

            sbr.append(charArr[i])

}

}

sbr.toString() // will print this will all punctuation removed.



Wednesday, January 9, 2019

Conflict Resolution - PMI ACP

Some of my fav Quotes :

There is what happened and the "STORY" about what happened.

Be hard on the problem & Soft on the person

Solution is not to blame or shame

Frame the issue to find some middle ground

You as a "Team Lead or Project Manger" is only as strong as your weakest link

"Silence is Power" - This will let the other person give up more

Always have your BATNA ready - Best Alternative to Negotiating Agreement

There is always 3 things involved in a conflict

1) Perception
2) Communication
3) Emotions

Dealing with Difficult People














Conflict Resolution Framework




Friday, November 9, 2018

Git - Overwrite Master to different branch
git checkout feature_branch
git merge -s ours --no-commit master
git commit      # Add a message regarding the replacement that you just did
git checkout master
git merge feature_branch
Master was behind by several versions
and bring it up-to date

Monday, June 4, 2018

Fav Quotes

Food For Thought

One Machine can do the work of 50 Ordinary Men
No Machine can do the work of one Extraordinary Man!


Success is a lousy teacher
It seduces smart people into thinking they can't loose ! - Bill Gates

Tuesday, May 29, 2018

GIT Bash - revert last commit from remote repository

List all Commits :
git log -> command to display all prior commits


Press "q" to exit from that history screen


Revert to Prior Commit in Gitbash


https://ncona.com/2011/07/how-to-delete-a-commit-in-git-local-and-remote/




You can delete a local commit by doing:
git reset –hard HEAD~
Lets say there is a repository with 4 commits.
$git log --pretty=oneline --abbrev-commit
46cd867 Changed with mistake
d9f1cf5 Changed again
105fd3d Changed content
df33c8a First commit
Commit 46cd867 is the most recent commit and the one we want to delete, for doing that, we will use rebase.
$git rebase -i HEAD~2
That command will open your default text editor with your two (Change the number 2 with the number of commits you want to get) 

$git push origin +


Friday, May 18, 2018

Agile Certification Prep

Continuous Product Improvements:


Intraspection : done while sprint is in progress. When team needs a direction / scope change - meeting of minds

Premortem : What is our risks what can go wrong

Retrospection : What did we accomplish, what can we do better

Continuous Process Improvements :

1) Throughput : Mean of story points delivered across n number of sprints
2) WIP : Limit Work in Progress
3) Takt Time : The pace at which team needs to perform to meet user expectation
4) Theory of Constraints : Identity your major constraints and try to reduce your constratins
5) Cumulative Flow diagram : Visual representation of Reality into current iteration. This chart can indicate issues that may have occurred in the iteration.
4) Value Stream Mapping : Long term strategic view - used to identity value add vs non value add and identify bottle necks, wait times, inefficiencies etc
5) Process Mapping : Same as Value Stream Mapping but this is short term

Process Efficiency Pct : Value Time / (Value Time + Cycle Time) *100

Cycle Time : Dev Point of view - time when a story point is picked up for development and actually delivered

Lead Time :  Time between when a requirement is identified, story created, picked up for development and delivered

Servant Leadership : Communicate, collaborate and congratulate

Agile Knowledge Areas

Table shows mapping agile to PMBOK guide having knowledge area (stakeholder management, scope management, cost management, et cetera) and agile considerations.


Tuesday, September 30, 2014

Recover lost eclipse file

If you know the location of your workspace, and the approximate time, when the file was lost, you can get it from

\.metadata\.plugins\org.eclipse.core.resources\.history\e4

http://wiki.eclipse.org/FAQ_Where_is_the_workspace_local_history_stored%3F

Wednesday, July 30, 2014

How to deal with highly defensive people

Many times in life, we come across people in our lives who seem to be super quick to take offense when you thought you were offering help, advice or constructive feedback. Worse, some of you might have someone like this in your life who asks you for feedback. Your heart sinks as you know that no matter what you say or how you say it, they’ll likely be devastated. People like this can be found in every family, workplace or group of friends. Dealing with them requires a special set of skills.

The Dark Side of Sensitivity

People like this often describe themselves as being sensitive and they are. But often their reactions to your comments are a defense mechanism. The two may feel the same to the person experiencing them but in reality, they are worlds apart. Sensitivity is born of careful attention, it involves looking closely, understanding deeply and therefore not causing harm. Defensiveness is the bastard child of shame. For people who have survived harshly judgmental environments, shame dominates the psychological landscape.

Knowing that highly sensitive people’s destructive behaviour comes from shame doesn’t excuse it, but it does help you understand why. From the outside, defensive behaviour is disproportionate, bizarre, often appalling. But from the perspective of the highly sensitive person, these actions are justifiable self-protection.

How to Have a Functional, Trusting, Relaxed, Mutually Satisfying Human Relationship with a Highly Defensive Person

In short, you can’t. The long answer is you can’t, don’t bother trying. The reason you can’t look to defensive people for satisfying relationships is that it requires two human beings.

I’m not being flip, defensive people genuinely think more with their ancient, reptilian brain and process in the parts of the brain that control social interaction and which evolved much, much later less. Beneath our elaborate neural structures that mediate our subtle social interactions we all possess what neuroscientists call the reptilian brain. It’s the most ancient part of the brain which evolved in reptiles and isn’t capable of nuanced emotion or logical thought. It’s primary driving force is fear. Two fears to be exact.

The first worry of the lizard brain (yours, mine, everyone’s!) is “I don’t have enough!” – enough food, money, love, glory. Insert your own noun here but the theme “not enough” pounds away constantly. The only other major concern for the lizard brain is “someone’s out to get me!”. A highly sensitive person perceives threat coming from lots of sources; one day the enemy could be a colleague, a relative the next, that mean women in the check-out at Tesco’s two minutes later. But to the lizard brain, someone somewhere is always about to attack.

Evolutionarily this makes sense. Lizards live longer if they obsessively acquire more food, shelter and mates, and if they expect predators to jump out at them at any moment. Sadly, reptiles are blind to non-defensive emotions; to the glow of love, the joyful giggle. The only thing playing on their mental movie screens all day, every day is The Lack and Attack Show. The same is true of highly sensitive/defensive people.

When humans are gripped by primal fear, they get completely in touch with their ancient lizard brains and highly defensive people are virtually always gripped by primal fear.

So the best relationship you can hope to sustain with a highly defensive people is the sort you might have with a reptile. Listen out the lyrics to the song The Snake by Al Wilson to get a better idea. You can treat a highly defensive person as tenderly as the woman in this song but you’re still highly likely to get bitten. Handle with care, step back and maintain some distance is your relationship with a highly defensive person.

source : http://www.counselling-directory.org.uk/counselloradvice10218.html#respond

Wednesday, January 22, 2014

Excel - Find values in List not in other List

You have 2 lists in Column A (smaller list) and Column B (larger list). You want to find values in Col B, that are not in Column A

Here is the formula for doing this :

In Col c, you write = match(B2,A$2,A$350,0)

Doing so, you will see a #N/A next to all values from B that are not found in List A.

Found one more fun thing in excel :)

Tuesday, June 25, 2013

Excel VLookup

Excel vlookup can be used to lookup a key and print its corresponding value. Very convenient when you quickly need to show desc from a set of values

Formula : =vlookup(col to lookup,array range to lookup, col num of the rest, TRUE = approximate match, FALSE = exact match)

Also to keep the range from changing when you copy over your formula to other cells,

When you enter the range in your formula, to keep the range from changing, you will need to enter the range as an Absolute Reference.  By that I mean, the range will be absolute, or will not change, when you extend the formula from the first cell to the rest.

To make the range Absolute, put a Dollar Sign ($)in front of both the column letter and the row number in the cell range.  For example, if the cell range is D1:F100 (Columns D, E, and F, from rows 1 through row 100), to make it an absolute range, so it will not change, enter the range in your formula as: $D$1:$F$100.  Now when you copy the formula down to subsequent rows, the range of D1:F100 will remain constant, or Absolute, in each of the formulas as they are copied down,and will not change as you copy the formula down.


Monday, June 3, 2013

Java HashMap with millions and millions of records

I am just trying to find an answer to this problem. If you have millions and millions of records stored in a map, you are sure to run out of memory. Here is some alternates..

MapDB
JDBM2
BERKELEY DB (Serialization overhead)
HSQLDB 

You can also use effective hashing algorithms like :

Buzz Hash
http://www.java2s.com/Code/Java/Development-Class/AveryefficientjavahashalgorithmbasedontheBuzHashalgoritm.htm

Hash History
http://www.serve.net/buz/hash.adt/java.000.html


Some basics on HashMap

An instance of HashMap has two parameters that affect its performance: initial capacity and load factor. The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity at the time the hash table is created. The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehashed (that is, internal data structures are rebuilt) so that the hash table has approximately twice the number of buckets.

Your problem is that 1.7 GB raw Text is more than 1500 MB even without the overhead added by the individual string objects. For huge mappings you should either use a database or a file backed Map, these would use disk memory instead of heap.


JDBM2 is exactly what you are asking. It provides a HashMap backed up by disk storage (among other maps). Its fast, thread-safe and the API is really simple.

MapDB provides concurrent TreeMap and HashMap backed by disk storage or off-heap-memory. It is a fast, scalable and easy to use embedded Java database engine. It is tiny (~250KB jar), yet packed with features such as transactions, space efficient serialization, instance cache and transparent compression/encryption. It also has outstanding performance rivaled only by native embedded db engines.


  1. As discussed at length in other posts, with a good hashCode(), 26M entries in a Map is no big deal.
  2. However, a potentially hidden issue here is GC impact of giant maps.
I'm making an assumption that these maps are long lived. i.e. you populate them and they stick around for the duration of the app. I'm also assuming the app itself is long lived -- like a server of some sort.
Each entry in a Java HashMap requires three objects: the key, the value, and the Entry that ties them together. So 26M entries in the map means 26M * 3 == 78M objects. This is fine until you hit a full GC. Then you've got a pause-the-world problem. The GC will look at each of the 78M objects and determine they're all alive. 78M+ objects is just a lot of objects to look at. If your app can tolerate occasional long (perhaps many seconds) pauses, there's no issue. If you're trying to achieve any latency guarantees you could have a major issue (of course if you want latency guarantees, Java's not the platform to choose :)) If the values in your maps churn quickly you can end up with frequent full collects which compounds the problem greatly.
I don't know of a great solution to this issue. Ideas:
  • It's sometimes possible to tune GC and heap sizes to "mostly" prevent full GCs.
  • If your map contents churn a lot you could try Javolution's FastMap -- it can pool Entry objects, which could lower the frequency of full collects
  • You could create your own map impl and do explicit memory management on byte[] (i.e. trade cpu for more predictable latency by serializing millions of objects into a single byte[] -- ugh!)
  • Don't use Java for this part -- talk to some sort of predictable in-memory DB over a socket
  • Hope that the new G1 collector will help (mainly applies to the high-churn case)
Just some thoughts from someone who has spent a lot of time with giant maps in Java.

Friday, May 10, 2013

Starting JBoss from Eclipse using JBoss Tools

Step by Step guide to start JBoss from your Eclipse IDE (Indigo or higher) I have juno

https://docs.jboss.org/author/display/AS7/Starting+JBoss+AS+from+Eclipse+with+JBoss+Tools

Thursday, February 14, 2013

Exclude certain files from copy

We just want to exclude .err files from being coped over. This is an awesome command that does the trick in just one line ;)

find $UNIX_APPS/cla/$OUTDIR ! -name "bank_loan_accruals*err" -name "bank_loan_accruals*" |xargs -i cp {} /develop/rayudsr