# Coding the Financial Market

**What is Financial Engineering?**

Financial engineering is the process of applying mathematical formulae and statistical methods to solve the problems arising in the financial Market. It is broadly referred to as Quantitative finance, financial mathematics, mathematical finance, and computational finance.

Financial engineering is formulated and framed with the concepts from, Applied Mathematics, Computer Science Engineering, Statistics, Probability principles and Economic theory.

**Where do the Financial Engineers needed?**

The broad spectrum of financial institutions such as, Investment Banks, Commercial Banks, Asset Management Companies, Hedge Funds Firms, Private Equity firms, Insurance Companies, Corporate Treasuries, Regulatory Agencies like SEBI, AMFI & IRDA.

These companies barely need financial engineers to solve the market glitches and they absorb quants round the year. As the discovery of financial engineering amplifies, the need for highly qualified professionals with specific knowledge in computer engineering and finance tends to increase in the market scenario.

**Benefits of Quantitative Finance in the Stock Market:**

- Objective of the financial engineering is to apply the methods of financial modelling and computer engineering to various fiscal market problems.
- Quantitative financial research has brought efficacy and accuracy in financial markets where human errands are broadly minimised.

**Application of Computation Finance in Industry:**

The quants or financial engineers develop new tools to automate the trading and investment activities. They arrive at building,

- new methods of investment analysis.
- new debt offerings.
- new investments products.
- new trading strategies.
- new financial models.
- derivative securities valuation.
- portfolio structuring.
- risk management.
- scenario simulation.

These products facilitate ease of market watch and helps in buying and selling the stocks for generating higher returns.

**Create an Investment Strategy?**

**Pen down the process of investment objectives:**Write down how your going to adapt the buying and selling scenario.**Rules of trading plan:**Make competitive advantage by minimising taxes and transaction cost.**Analyse the performance of your investment strategy:**With changing economic cycles, mix both value and growth investing methods.**Measure your Strategy:**With lucrative benchmarks measure your returns.

**Building An Algorithm Out of an Investment Strategy Portfolio:**

Build a competitive genetic algorithm is the most possible method for solving the investment strategy portfolio problem. The objective of the genetic algorithm should be –

- Maximising the total Wealth.
- Minimising the variation of total wealth.
- Consistent returns round the term.

**Evolutionary Algorithm in General with regards to financial Markets:**

By adapting to the changing environments and circumstances, natural process of evolution and mutation occurs to best fit in solving the problems. This technique of natural selection being applied in financial markets to forecast the market scenario and land in profits. Let discuss the more technical part of it now.

Genetic algorithms are developed by mathematical functions using vectors. These Vectors are two-dimensional quantities that have direction and magnitude. Factors for each trading rule are illustrated with a one-dimensional vector that can be personified as a chromosome genetically. Whereas, the values used in each factor can be considered as genes, which are continually modified by the natural selection of evolution.

The factors influencing the Trading Strategy are –

**Moving Average Convergence Divergence (MACD) :**This factor decides the bullish and bearish market strategy which is more important in the algorithm to assess the momentum of the market.**Exponential Moving Average (EMA) :**During Intraday trading this factor is very helpful to confirm the significant market moves and to measure the validity of the moves.**Stochastics Model or Random Process:**This is used to measure the interchanging market’s random behaviour and used to value the options.

A custom developed genetic algorithm would formulate the input values into these factors to land in maximum revenue. By evolution, for every market changes the genes/factors get updated and are recorded for the use of coming generations.

**Step By Step Process To develop an Trading Engine –**

**Develop a momentum strategy with above said financial analysis –**Here, there are two basic strategies. One is Crossover strategy, that is to measure the change in momentum of market. To buy at low and sell at high. The second one is return to mean. Every stock would return to mean position in every market situation. With the help of Python and Pandas dataframe you have to create entry and exit points with markets moving average.**Backtest with historical data –**This is just testing the trading strategy you have developed. This involves gathering of data, strategy, profit/loss points and execute the same with back dates.**Optimise and Evaluate the trade engine –**Finally Evaluate with recent trends in the market.