Chicago Python Workshop

Alpha Generation: Controlling Intraday Risk Profile with Python

Friday, February 10 2017, 10:30 AM – 5:30 PM [CST]

Chicago, 10th of  Frebruary

You will learn why the use of high frequency market data is necessary to be able to measure correctly the risk and rebalance your portfolio adequately. You will also learn how to build strategies to generate alpha. You will study how to build your own portfolio, create a strategy, backtest it, optimize it, and use vol forecasting with PortfolioEffect hft Python package.

Prerequisite

Beginner knowledge of Python and finance, college level math, laptop with Anaconda2 installed

Aagenda

10:30 AM-11:00 AM   Welcome

11:00 AM-11:30 AM   Introduction to high frequency market data

11:30 AM-12:00 PM   Intraday risk metrics

12:00 PM-12:30 PM   Exercise-build intraday risk metrics on portfolio

12:30 PM-1:00 PM    Backtesting portfolio and build your own strategies

1:00 PM-1:30 PM     Lunch break

1:30 PM-2:00 PM     Exercise on backtesting

2:00 PM-2:30 PM     Vol forecasting

3:00 PM-3:30 PM     Exercise on vol forecasting

3:30 PM-4:00 PM     Portfolio optimization & Alpha generation

4:00 PM-5:00 PM     Exercise-build your own optimization for alpha generation

5:00 PM-5:30PM     Closing remarks

Organizers

Andrey Kostin, PhD & Stephanie Toper
For any questions, email info@portfolioeffect.com

Registration

Registration: Click here, space is limited

 

Very interesting R and Python Workshops in NYC

During our 2 workshops, we covered how to compute intraday risk, backtest strategies, forecast metrics and optimize your portfolio to get more alpha. We went through classic moving average strategies to comparing high frequency strategies to low frequencies. Attendees from different background have been present from banks to hedge funds to academics. It gave a stimulating environment.

Next workshop is in Chicago February 10th. Use discount EARLY to get $150 saving. Saving expire on January 10th.

Alpha Generation: Controlling Intraday Risk Profile with Python, Chicago, Feb 10th

NYC Python Workshop

NYC R Workshops

Intraday Strategy Backtesting, Portfolio Optimization and Risk Forecasting with R

Nov 17th, NYC

You will learn why the use of high frequency market data is necessary to be able to measure correctly the risk and rebalance your portfolio adequately. You will also study how to build your own portfolio, create a strategy, backtest it, optimize it, and use vol forecasting with PortfolioEffectHFT package available on CRAN.

Prerequisite:

Beginner knowledge of R and finance, college level math, laptop with RStudio installed

 

Agenda:

10:30 AM-11:00 AM    Welcome

11:00 AM-11:30 AM    Introduction to high frequency market data

11:30 AM-12:00 PM    Intraday risk metrics

12:00 PM-12:30 PM    Exercise-build intraday risk metrics on portfolio

12:30 PM-1:00 PM      Backtesting portfolio and build your own strategies

1:00 PM-1:30 PM         Lunch break

1:30 PM-2:00 PM         Exercise on backtesting

2:00 PM-2:30 PM         Vol forecasting

3:00 PM-3:30 PM         Exercise

3:30 PM-4:00 PM         Portfolio optimization

4:00 PM-5:00 PM         Exercise Built your own optimization

5:00 PM-5:30PM           Closing remarks

 

Registration: Click here, space is limited

For a student discount, please email info@portfolioeffect.com

NYC Python Workshop

Intraday Strategy Backtesting, Portfolio Optimization and Risk Forecasting with Python

Nov 16th, NYC

You will learn why the use of high frequency market data is necessary to be able to measure correctly the risk and rebalance your portfolio adequately. You will also study how to build your own portfolio, create a strategy, backtest it, optimize it, and use vol forecasting with PortfolioEffect hft package available on Anaconda.

Prerequisite:

Beginner knowledge of Python and finance, college level math, laptop with Anaconda2 installed

Agenda:

10:30 AM-11:00 AM    Welcome

11:00 AM-11:30 AM    Introduction to high frequency market data

11:30 AM-12:00 PM    Intraday risk metrics

12:00 PM-12:30 PM    Exercise-build intraday risk metrics on portfolio

12:30 PM-1:00 PM      Backtesting portfolio and build your own strategies

1:00 PM-1:30 PM         Lunch break

1:30 PM-2:00 PM         Exercise on backtesting

2:00 PM-2:30 PM         Vol forecasting

3:00 PM-3:30 PM         Exercise

3:30 PM-4:00 PM         Portfolio optimization

4:00 PM-5:00 PM         Exercise Built your own optimization

5:00 PM-5:30PM           Closing remarks

 

Registration: Click here, space is limited

For a student discount, please email info@portfolioeffect.com

New R/MATLAB Package Released: High Frequency Price Estimators & Models

We are happy to announce PortfolioEffectEstim toolbox availability for both R & MATLAB.
It is designed for high frequency market microstructure analysis and contains popular estimators for price variance, quarticity and noise.

For R

https://cran.r-project.org/web/packages/PortfolioEffectEstim/
Or via downloads section:
https://www.portfolioeffect.com/docs/platform/quant/tools/r

For MATLAB

http://www.mathworks.com/matlabcentral/fileexchange/55335-portfolioeffectestim-high-frequency-price-estimators—models-toolbox
Or via downloads section:
https://www.portfolioeffect.com/docs/platform/quant/tools/matlab

Features

Package features key estimators for working with high frequency market data.

Microstructure Noise:

  • Autocovariance Noise Variance
  • Realized Noise Variance
  • Unbiased Realized Noise Variance
  • Noise-to-Signal Ratio

Price Variance:

  • Two Series Realized Variance
  • Multiple Series Realized Variance
  • Modulated Realized Variance
  • Jump Robust Modulated Realized Variance
  • Uncertainty Zones Realized Variance
  • Kernel Realized Variance (Bartlett, Cubic, 5th/6th/7th/8th-order, Epanichnikov, Parzen, Tukey-Hanning kernels)

Price Quarticity:

  • Realized Quarticity
  • Realized Quad-power Quarticity
  • Realized Tri-power Quarticity
  • Modulated Realized Quarticity

Use could provide your own high frequency market data or use our server-side high frequency prices for all major US equities.

Client-side Market Data

To run an estimator using client-side data:

data(goog.data)
estimator<-estimator_create(priceData=goog.data)
rv.data = variance_tsrv(estimator)
util_plot2d(rv.data,title="Realized Variance of GOOG")

Server-side Market Data

To run an estimator using server-side data:

estimator<-estimator_create(asset='GOOG',fromTime="2014-09-01", toTime="2014-09-14")
tsrv.data = variance_tsrv(estimator,K=2)
util_plot2d(tsrv.data,title="Two Series Realized Variance of GOOG")

More details in the package manual:
https://cran.r-project.org/web/packages/PortfolioEffectEstim/vignettes/PortfolioEffectEstim.pdf

API Reference:
https://cran.r-project.org/web/packages/PortfolioEffectEstim/PortfolioEffectEstim.pdf

High Frequency Market Microstructure: Part 1 (Microstructure Noise)

Market Microstructure Noise

Microstructure noise describes price deviation from its fundamental value induced by certain features of the market under consideration. Common sources of microstructure noise are:

  • bid-ask bounce effect
  • order arrival latency
  • asymmetry of information
  • discreteness of price changes

Noise makes high frequency estimates of some parameters (e.g. realized volatility) very unstable. The situation gets even worse for high order moments like kurtosis, which makes tail risk estimation using HF data very problematic. We will investigate how severe could be noise contamination for different stocks as the we move towards transactional frequencies.

Example: Bid-Ask Bounce

Bid-ask bounce occurs when traders buy at ask prices and sell at bid prices. Their trades cause prices to bounce from bid to ask. These price changes reverse when traders arrive on the other side of the market.

Bid-ask Bounce

Read more…

Intraday Strategy Backtesting in R – Part 2 (Rule-based Strategies)

In this post we take intraday backtesting with PortfolioEffectHFT package one step further by adding a simple signal-based rebalancing rule. Using this rule we will create two trading portfolios – a high frequency strategy portfolio and a low frequency portfolio and compare them with each other in terms of their intraday risk and performance.

Both strategies would employ a price moving average signal with a window of different calendar length to simulate position entry and exit with different holding period durations. Our trading portfolio would consist of a single GOOG position to keep matters simple.

Rule-Based Trading Portfolios

First, we define a moving average method that receives a price vector and a window length for averaging.

# Create function of moving average
MA=function(x,order){
  result=x
  x1=c(0,x)
  result[(order):NROW(x)]=(cumsum(x1)[-(1:(order))]-cumsum(x1)[-((NROW(x1)-order+1):NROW(x1))])/order
  result[1:(order-1)]=cumsum(x[1:(order-1)])/(1:(order-1))
  return(result-0.0000000001)
}

The high frequency trading strategy has a window length of 150 seconds, while the low frequency strategy uses 800 second window. When the stock price exceeds the N-second moving average, each strategy would buy 100 shares of the stock. If moving average goes above the current price while we are still in position, the strategy would issue a sell signal. Now that we defined our position holding rules, we can construct our trading portfolio for further analysis.

Read more…

Intraday Strategy Backtesting in R – Part 1 (Buy-and-Hold Strategies)

Great news! PortfolioEffectHFT package was released on CRAN last week and allows all R users to backtest high frequency trading (HFT) strategies, perform intraday portfolio analysis and optimization on PortfolioEffect’s own compute cluster. The service is free to use within the free usage tier and has an optional access to price history for all US Equities – in case you need access to high quality intraday price data. You could even combine server-side and client-side data creating mixed data portfolios.

So, what is PortfolioEffect? It is a platform with an open API that was designed to provide portfolio & strategy metrics at intraday horizons and handle most market microstructure effects found in high frequency price returns in an automated fashion:

  • market microstructure noise
  • price jumps/outliers
  • extreme tail risk (high-order moments)
  • price fractality (long memory)

In other words, it makes working with high frequency data look similar to classic portfolio analysis on EOD prices, but results are available for every price tick (or time bar).

In this introductory post we will show how to construct a portfolio with a few positions and compute key metrics like return volatility and Sharpe Ratio.

Buy-and-hold Portfolio

Here we are creating are simple buy-and-hold strategy with only two positions. For that we will use 1-second price quote history of AAPL & GOOG available in all code examples for demonstrative purposes. By default SPY (S&P 500) would be used as a market index, unless other symbol is specified explicitly in portfolio_create.

Active trading strategy would normally require a vector of holding quantities at corresponding rebalancing times. But for a buy-and-hold strategy we just need to specify fixed position quantities across selected time span.

require(PortfolioEffectHFT)

# Create empty portfolio
portfolio=portfolio_create("2014-10-01 09:30:00","2014-10-02 16:00:00")

# Add position AAPL and GOOG to portfolio
portfolio_addPosition(portfolio,"AAPL",100)
portfolio_addPosition(portfolio,"GOOG",200)

To display major portfolio charts, call plot method on the constructed portfolio object.

plot(portfolio)

Read more…