Liquidity

16 07 2011

Liquidity is the ease at which you can trade a particular asset. Liquidity is also determined by market width, which is the cost of executing the transaction of a specified size, and by market depth, which is how much quantity can be executed at a given cost. In markets where securities are relatively illiquid it can arise that the players are willing only to buy or only to sell. Even when two-way quotes exist, the depth could be small. This means not enough orders could be in the system to match a large order.





Quotes

15 07 2011

To see the price at which a security is trading, traders need to refer to a quote. A quote could be a purchase price or a sale price. It could also be a two-way quote. A two-way quote comprises a bid price (the purchase price) and an offer price (the sale price). The bid price is the price a counterparty is willing to pay you in case you want to sell your securities to that party. The offer price is the price the party is asking for in case you want to buy securities from that party.

The offer price will logically be higher than the bid price. When you ask for a quote, for example, you will get a figure such as £54.10/£54.15. In a two-way quote, the first price is the bid price. In other words, £54.10 is the price you will get if you want to sell your securities. If you want to buy, the trader will sell that security to you for £54.15. The difference between the bid price and offer price is called the spread. The spread is the profit the trader makes by providing a two-way quote and doing a round-turn transaction (both buy and sell) at that quote. In this example, the spread is £0.05.





Why do People Trade?

14 07 2011

People trade with an objective of profiting from the transaction by buying and holding securities in the case of rising prices and by selling and protecting themselves from price declines in the case of a falling market. Traders have a price and value forecast/view of the security that they believe is correct, and they want to profit from the view.

Transactions are normally driven by two factors:

Information: The purchaser/seller genuinely thinks the prices will go up/down. This understanding is usually backed by some commercial development, news, research, or belief. An asset is undervalued when the ongoing market price is less than the intrinsic worth of the asset and overvalued when the ongoing market price is higher than the intrinsic worth.

Liquidity: Holders of securities know they need to hold securities longer in order to make a reasonable profit but are unable to hold them because they need money urgently for some other reason. Traders keep shuffling between assets in search of superior returns. If they know
one particular security gives them a better opportunity to earn, they might liquidate investments made in another security even if their investment objective in that particular security has not matured. Such transactions are liquidity-driven transactions.

Traders go long on a stock they think will go up in price. Such traders are called bullish on the stock. Traders go short on stocks they think will decline in price. Such traders are called bearish on the stock.





Equity and Equity Shares

13 07 2011

Equity is the capital that is used to start a company. It has all the risk and gives a share in the profit that the corporation makes. Equity shares are grant ownership on equity and thus the underlying company. Shareholders are owners of a company. Their ownership is proportional to the percentage of shares held in the company. Shareholders appoint the company’s board and chief executive officers (CEOs). The profit that the company makes is distributed amongst the shareholders as a dividend. When the company incurs a loss, no dividend is paid.

When the fortunes of a company improves because of improved business conditions or an increase in the demands of a company’s products, the value of shares representing the company also rises, resulting in profits for shareholders. However, during times of losses, the share prices can decline.





Capital Markets

12 07 2011

A capital market is the part of a financial market where companies in need of capital (money to invest in some venture) come forward and look for people to invest in them in search of returns. Companies raise money either through bonds or through stocks. Bonds are issued against an interest-bearing loan that the company takes. The loan assures that bondholders will get periodic interest payments. Stocks are considered riskier than bonds. Companies list their stocks on stock exchanges to create a market for them and to allow their shares to be traded subsequently.

If it’s the first time the company is raising money from the public, the process is called an initial public offering (IPO). A market where a public offering is made and companies raise money directly from investors is called a primary market. Once the public offering takes place, investors have the securities, and the company has the money. The company then pay a listing fee to an exchange to make the securities available for subsequent buying and selling through current and potential investors. This enables investors to make profits, cut risks, invest in potential growth areas, and so on by trading in the secondary market.





Semaphores

11 07 2011

A semaphore allows a special kind of critical region that is not mutually exclusive. Threads may perform a take or put operation on a semaphore, atomically decreasing or increasing its current count, respectively. When a thread tries to take from a semaphore that already has a count of 0, the thread blocks until the count becomes non-0. The initial count of the semaphore specifies the maximum number of threads that can be inside the region. Unlike mutexes, semaphores are never considered to be owned by a specific thread. Different threads can safely put and take from the semaphore without any problems.

To take from the semaphore a thread calls Wait() and to put a thread calls Release(). Semaphores are typically used to protect resources that are finite in capacity. A pool of database connections for example or a swimming pool with a maximum capacity. A semaphore can span processes in the same was as a Mutex if you give it a name on construction.

class SwimmingPool
{
  static SemaphoreSlim m_Sem = new SemaphoreSlim (2);

  static void Main()
  {
    for (int i = 1; i <= 5; i++) new Thread (Swim).Start (i);
  }

  static void Swim(object id)
  {
    Console.WriteLine (id + " wants to swim");
    m_Sem.Wait();
    Console.WriteLine (id + " is swimming");           // Only two swimmers
    Thread.Sleep (1000 * (int) id);                    // can be here at
    Console.WriteLine (id + " is done swimming");       // a time.
    m_Sem.Release();
  }
}




Mutexes

10 07 2011

A mutex is a synchronization primitive, similar to a monitor, but which can also be used for interprocess synchronization. When you create a mutex you can give it a name to identify it across processes. To lock a mutex you call the WaitOne method and the ReleaseMutex method to unlock.

A common use of a mutex is to ensure that only one instance of a program can run at a time. Mutexes are about 50 times slower to obtain than monitors.

class Program
{
  static void Main()
  {
    using (var mutex = new Mutex (false, "My Program"))
    {
      //try to obtain the mutex, give it some time in case another instance is exiting
      if (!mutex.WaitOne (TimeSpan.FromSeconds (3), false))
      {
        Console.WriteLine ("Another instance is running.");
        return;
      }
      else
      {
           //Launch
      }
    }
  }
}