- Profile
- Backtests
- Community

Quant Developer

We are pioneering the radical future for open-source quant finance. QuantConnect is the world's largest quant community, empowering 220,000 quants with a framework, data, and infrastructure for their investments.

-0.841Net Profit

-0.291Sharpe Ratio

-0.033Alpha

1.245Beta

-0.822CAR

4.6Drawdown

70Loss Rate

1Security Types

0.034045337798946Sortino Ratio

0Tradeable Dates

2110Trades

-0.006Treynor Ratio

30Win Rate

-0.895Net Profit

-6.238Sharpe Ratio

-0.263Alpha

9.461Beta

-10.761CAR

1.1Drawdown

100Loss Rate

2Security Types

0Sortino Ratio

20Tradeable Dates

2Trades

-0.01Treynor Ratio

0Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

2Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

42.806Net Profit

8.739Sharpe Ratio

-18.211Alpha

2577.436Beta

19792170106220CAR

4.6Drawdown

48Loss Rate

1Security Types

4.6467030010054Sortino Ratio

3Tradeable Dates

51Trades

0.01Treynor Ratio

52Win Rate

-5.501Net Profit

-0.296Sharpe Ratio

0.323Alpha

-18.634Beta

-6.031CAR

11.5Drawdown

100Loss Rate

1Security Types

0Sortino Ratio

228Tradeable Dates

3Trades

0.003Treynor Ratio

0Win Rate

Jing left a comment in the discussion Error not in index

You initialize self.position as None in Initialize(), so self.position is always None before you...

Jing left a comment in the discussion Heikinashi bars constructed from trade ticks

We support Heikinashi(symbol, resolution) indicator.

Jing left a comment in the discussion Is there a time or memory limit in how long the OnData function can be?

It depends on your algorithm logic. OnData () method is called in the data resolution. If you only...

Jing left a comment in the discussion Simulation of options exercise is messing up the results

At the expiration date, an open option position will be exercised or assigned automatically if...

-0.841Net Profit

-0.291Sharpe Ratio

-0.033Alpha

1.245Beta

-0.822CAR

4.6Drawdown

70Loss Rate

1Security Types

0.034045337798946Sortino Ratio

0Tradeable Dates

2110Trades

-0.006Treynor Ratio

30Win Rate

-0.895Net Profit

-6.238Sharpe Ratio

-0.263Alpha

9.461Beta

-10.761CAR

1.1Drawdown

100Loss Rate

2Security Types

0Sortino Ratio

20Tradeable Dates

2Trades

-0.01Treynor Ratio

0Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

2Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

42.806Net Profit

8.739Sharpe Ratio

-18.211Alpha

2577.436Beta

19792170106220CAR

4.6Drawdown

48Loss Rate

1Security Types

4.6467030010054Sortino Ratio

3Tradeable Dates

51Trades

0.01Treynor Ratio

52Win Rate

-5.501Net Profit

-0.296Sharpe Ratio

0.323Alpha

-18.634Beta

-6.031CAR

11.5Drawdown

100Loss Rate

1Security Types

0Sortino Ratio

228Tradeable Dates

3Trades

0.003Treynor Ratio

0Win Rate

-0.018Net Profit

-9.165Sharpe Ratio

0Alpha

-1.643Beta

-3.232CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

2Tradeable Dates

2Trades

0.009Treynor Ratio

0Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

7Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

94.96Net Profit

0.539Sharpe Ratio

0.094Alpha

-1.178Beta

6.351CAR

26.9Drawdown

26Loss Rate

1Security Types

0.002324753740831Sortino Ratio

2730Tradeable Dates

7911Trades

-0.059Treynor Ratio

74Win Rate

4.741Net Profit

0.671Sharpe Ratio

0.001Alpha

0.208Beta

2.338CAR

3.2Drawdown

82Loss Rate

2Security Types

-0.070645065324453Sortino Ratio

505Tradeable Dates

32Trades

0.111Treynor Ratio

18Win Rate

5.018Net Profit

0.638Sharpe Ratio

0.014Alpha

0.179Beta

2.472CAR

3.8Drawdown

76Loss Rate

2Security Types

0.073663642775754Sortino Ratio

505Tradeable Dates

31Trades

0.137Treynor Ratio

24Win Rate

12.636Net Profit

1.483Sharpe Ratio

0.026Alpha

0.317Beta

6.116CAR

4.2Drawdown

100Loss Rate

1Security Types

-1.4694920148339Sortino Ratio

505Tradeable Dates

9Trades

0.189Treynor Ratio

0Win Rate

5.884Net Profit

0.6Sharpe Ratio

0.014Alpha

0.255Beta

2.893CAR

7.2Drawdown

100Loss Rate

1Security Types

0Sortino Ratio

505Tradeable Dates

3Trades

0.117Treynor Ratio

0Win Rate

5.316Net Profit

0.97Sharpe Ratio

0.011Alpha

0.138Beta

2.618CAR

2.5Drawdown

58Loss Rate

1Security Types

1.6255065548246Sortino Ratio

505Tradeable Dates

38Trades

0.189Treynor Ratio

42Win Rate

4.355Net Profit

0.611Sharpe Ratio

0.013Alpha

0.136Beta

2.149CAR

3.8Drawdown

58Loss Rate

1Security Types

0.33654830516771Sortino Ratio

505Tradeable Dates

38Trades

0.161Treynor Ratio

42Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

4Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

41Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

394.166Net Profit

0.707Sharpe Ratio

0.234Alpha

-1.689Beta

17.321CAR

43.4Drawdown

29Loss Rate

1Security Types

-0.039697071293318Sortino Ratio

2518Tradeable Dates

7472Trades

-0.119Treynor Ratio

71Win Rate

-17.95Net Profit

-4.601Sharpe Ratio

-2.538Alpha

50.234Beta

-90.992CAR

21.6Drawdown

39Loss Rate

1Security Types

-0.12098452772387Sortino Ratio

26Tradeable Dates

181Trades

-0.035Treynor Ratio

61Win Rate

20.724Net Profit

0.686Sharpe Ratio

0.067Alpha

0.425Beta

6.469CAR

13Drawdown

19Loss Rate

2Security Types

0.033140992305047Sortino Ratio

756Tradeable Dates

57Trades

0.154Treynor Ratio

81Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

9Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

9Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

20.904Net Profit

0.875Sharpe Ratio

0.213Alpha

-7.448Beta

10.896CAR

13.1Drawdown

36Loss Rate

1Security Types

0.078369262839573Sortino Ratio

463Tradeable Dates

3797Trades

-0.012Treynor Ratio

64Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

9Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

352.627Net Profit

1.01Sharpe Ratio

0.067Alpha

5.98Beta

18.623CAR

19.4Drawdown

4Loss Rate

1Security Types

4.7986775746449Sortino Ratio

2225Tradeable Dates

427Trades

0.031Treynor Ratio

96Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

18Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

2Security Types

0Sortino Ratio

1Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

5Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

-9.719Net Profit

-5.319Sharpe Ratio

-1.133Alpha

1.94Beta

-69.995CAR

9.7Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

21Tradeable Dates

1Trades

-0.565Treynor Ratio

0Win Rate

0.243Net Profit

2.174Sharpe Ratio

0.136Alpha

-4.514Beta

7.67CAR

0.3Drawdown

83Loss Rate

1Security Types

0.20044758119505Sortino Ratio

0Tradeable Dates

24Trades

-0.014Treynor Ratio

17Win Rate

0Net Profit

0Sharpe Ratio

0Alpha

0Beta

0CAR

0Drawdown

0Loss Rate

1Security Types

0Sortino Ratio

27Tradeable Dates

0Trades

0Treynor Ratio

0Win Rate

Jing left a comment in the discussion How to generate the Rolling Window of 4-TradeBars

To obtain the bar open price in OnData(self, data),

Jing left a comment in the discussion Error not in index

You initialize self.position as None in Initialize(), so self.position is always None before you...

Jing left a comment in the discussion Heikinashi bars constructed from trade ticks

We support Heikinashi(symbol, resolution) indicator.

Jing left a comment in the discussion Is there a time or memory limit in how long the OnData function can be?

It depends on your algorithm logic. OnData () method is called in the data resolution. If you only...

Jing left a comment in the discussion Simulation of options exercise is messing up the results

At the expiration date, an open option position will be exercised or assigned automatically if...

Jing left a comment in the discussion Algo Framework ETF Momentum Rebalancing using Mean Variance Optimization

andrew_czeizler, this is an old post. Now we've already put...

Jing submitted the research Stock Selection Strategy Based On Fundamental Factors

Abstract: This tutorial explores a stock selection strategy based on fundamental factors. The first step involves developing a factor selection model to determine if factors can differentiate potential winners and losers in the stock market. The selected factors are then used to implement a factor ranking stock selection algorithm for Turkish equities. The algorithm ranks stocks based on their factor values and calculates an equally weighted composite factor score for each stock. The stocks are then placed into quintile portfolios based on their factor scores, and the highest ranked 20 stocks are selected to construct portfolios at the beginning of each month. This process is repeated at the end of each month to construct new portfolios.

Jing started the discussion Algorithm Examples

Hi QC Community Members,

Jing submitted the research Momentum Effect In Country Equity Indexes

This discussion examines the momentum effect in country index exchange-traded funds (ETFs). The algorithm selects 35 country index ETFs as the trading universe and uses the MomentumPercent indicator helper method to save the indicator of each symbol. At the start of each month, the algorithm selects the top five index ETFs with the best 6-month momentum to open long positions and liquidates ETFs that are no longer in the top list. The algorithm's results show that momentum effects exist in country indices. Holding a portfolio of the five best performing country index ETFs over the previous six months outperformed the equal-weighted portfolio by around 90% per annum from 2002 to 2022.

Jing submitted the research Momentum Effect In Stocks

This abstract discusses the momentum effect in stocks and presents an algorithm that explores this phenomenon in large-cap stocks. The momentum anomaly suggests that stocks that have performed well in the recent past are likely to continue performing well in the near future. The algorithm uses the universe selection API to create a momentum portfolio, eliminating stocks with a price lower than $5 and ETFs without fundamental data. The fine-universe selection chooses the 50 largest companies based on market capitalization. The momentum percent is calculated as the relative difference in stock prices over a certain period. The abstract concludes by referencing Quantpedia's article on the momentum effect in stocks.

Jing submitted the research Forex Carry Trade

Abstract: The forex carry trade strategy involves selling low-interest rate currencies and buying high-interest rate currencies to profit from the interest rate differential. This discussion focuses on implementing the strategy using custom data imported from Nasdaq Data Link. The trading universe consists of 9 currencies with available central bank interest rate data. The algorithm sorts the forex symbols based on interest rates and goes long on the currency with the highest interest rate while going short on the currency with the lowest interest rate. The strategy is rebalanced monthly using the Scheduled Event method. This discussion serves as a reference for implementing the forex carry trade strategy.

Jing submitted the research Pairs Trading With Stocks

Pairs trading is a popular algorithmic trading strategy that involves finding two stocks that historically move together in price. This strategy takes advantage of mean reversion, where prices that have diverged from their historical relationship are expected to revert back to their mean. The first step is to select stock pairs from a universe of stocks by minimizing the sum of squared deviations between their normalized price series. The top 4 pairs with the smallest historical distance measure are then traded. The trading period is six months, and positions are opened when the price spread between the stocks diverges by two standard deviations. The position is closed when prices revert back. This strategy presents a statistical arbitrage opportunity and has been extensively studied in quantitative finance.

Jing submitted the research Asset Class Momentum

This discussion focuses on the concept of asset class momentum and its application in a trend following algorithm. The algorithm uses the momentum effect to identify entry points by calculating the rate of change in price movements for a specific asset. The algorithm's portfolio consists of 5 ETFs from different asset classes, and it uses the MomentumPercent indicator in LEAN with a 12-month period. The algorithm selects the 3 ETFs with the strongest 12-month momentum percent and weights them equally in the portfolio. The portfolio is held for 1 month before being rebalanced with new momentum percent values. Unlike traditional asset class trend following strategies, this rotational momentum system compares the performance of different asset classes and selects only the best-performing assets for the portfolio. The portfolio is rebalanced monthly, ensuring that only the best-performing assets are held.

Jing submitted the research Short Term Reversal Strategy In Stocks

Abstract: This tutorial focuses on implementing a short-term reversal strategy in stocks based on the research conducted by De Groot, Huij, & Zhou (2012). The strategy involves selecting the worst performers and shorting the top performers in the universe of stocks on a weekly basis. However, in this implementation, we limit the universe to the most liquid large cap stocks to reduce trading costs. Our analysis reveals that this strategy generally underperforms the S&P 500 index, except during the 2020 market crash. The strategy code is divided into four main parts: Initialization, Universe Selection, OnData, and OnSecuritiesChanged. The initialization phase involves setting parameters and implementing a coarse universe selection method. The relative performance of the strategy and benchmark is evaluated over different time periods, including a 5-year backtest, the 2020 market crash, and the subsequent recovery.

Jing submitted the research Asset Class Trend Following

Asset class trend following is a strategy that aims to exploit momentum anomalies across different assets. By using moving averages or momentum filters, this strategy seeks to gain exposure to an asset class when there is a higher probability of outperformance with lower risk. This algorithm applies trend following principles to 5 ETFs representing different asset classes such as stocks, bonds, and commodities. It uses a simple moving average to detect the trend and allocates equally to the ETFs when the closing price is above its ten-month moving average. Otherwise, it stays in cash. The implementation in LEAN includes a warm-up period of ten months to initialize the indicator for use in the algorithm.

Jing submitted the research Sector Momentum

In this discussion, the concept of sector momentum is explored as a strategy for reallocating capital based on changing market conditions. The algorithm presented is an adaptation of asset class momentum, where 10 sector ETFs are selected and the 3 with the strongest 12-month momentum are chosen for the portfolio, each weighted equally. The portfolio is then rebalanced monthly using a Scheduled Event. This approach is based on the idea that sectors with strong momentum are likely to continue performing well in the near future. The discussion references Quantpedia's research on sector momentum as a resource for further information.

Jing submitted the research Forex Momentum

This discussion focuses on the concept of Forex momentum, which is a trend following strategy that involves buying assets that have performed well in the past and selling assets that have performed poorly. The algorithm described in this discussion applies momentum to the Forex market, specifically focusing on 15 Forex pairs from 2006 to 2018. The algorithm selects the top 3 currencies with the strongest 12-month momentum against USD to go long, and the bottom 3 currencies with the lowest 12-month momentum against USD to go short. The discussion also references Quantpedia's FX Momentum as a resource for further information.

Jing submitted the research Short Term Reversal

The short-term reversal strategy aims to take advantage of the phenomenon where stocks with low returns in the past month or week tend to have positive abnormal returns in the following month or week, while stocks with high returns tend to have negative abnormal returns. To implement this strategy, the universe selection API is used to choose stocks with a price higher than 4, and the top 100 stocks are selected based on dollar volume. In the fine universe selection, the top 20 stocks are chosen based on market cap. The RateOfChange indicator is used to calculate the monthly return, and the strategy involves going long on the 10 stocks with the lowest performance in the previous month and going short on the 10 stocks with the highest performance from the previous month.

Jing submitted the research Intraday Dynamic Pairs Trading Using Correlation And Cointegration Approach

This tutorial implements a high frequency and dynamic pairs trading strategy using a two-stage correlation and cointegration approach. The strategy is based on George J. Miao's work and is applied to the U.S. bank sector stocks. Backtesting with 10-minute stock data in September 2013 shows a compounding annual return of up to 26.924% and a 3.011 Sharpe ratio. This strategy is particularly profitable during market downturns and increased volatility. The example provides a basic starting point and can be customized with different lookback periods, data intervals, and threshold values. High Frequency Trading (HFT) and statistical arbitrage concepts are also discussed. The data used in the strategy consists of stocks in a specific industry to increase the number of pairs with high correlation.

Jing submitted the research CAPM Alpha Ranking Strategy On Dow 30 Companies

This abstract discusses the implementation of a CAPM Alpha Ranking Strategy on Dow 30 companies. The tutorial explains how to use historical data, set event handlers, conduct linear regression, and build custom functions in the QuantConnect Algorithm Lab. The strategy demonstrates that stocks that outperformed the market in the previous month are likely to outperform again in the following month. However, the model fails to capture alpha and performs poorly when market volatility increases. The CAPM theory is also explained, describing the relationship between systematic risk and expected return for assets. The formula for calculating the expected return of an asset given its risk is provided, along with an explanation of beta and alpha.

Jing submitted the research Can Crude Oil Predict Equity Returns

Abstract: This tutorial explores the use of regression analysis to predict stock market returns by comparing them to short-term U.S. T-bill rates. The approach is based on the paper "Striking Oil: Another Puzzle?" by Gerben, Ben and Benjamin (2007). The strategy involves fully investing in stocks if the predicted return is higher than the risk-free rate, and investing in short-term U.S. T-bills if the predicted return is lower. The backtesting period is from 2010 to 2017, with monthly regression analysis and a rolling dynamic projection. The analysis shows that the strategy underperforms the market in recent years, potentially due to the weakening relationship between stocks and oil.

Jing submitted the research Fundamental Factor Long Short Strategy

The abstract for this QuantConnect discussion is about a long/short equity strategy based on fundamental factors. The strategy is based on the AQR white book and aims to consistently beat the market. The strategy uses three factors to rank stocks: value, quality, and momentum. Value is measured using the price-to-book ratio, quality is measured using the operation margin, and momentum is measured using the recent monthly return. The stocks are ranked based on these factors and assigned weights to calculate the final score. The strategy has been implemented and tested using an algorithm with 250 stocks. The abstract provides an overview of the strategy and its key components.

Jing submitted the research Dual Thrust Trading Algorithm

Abstract: The Dual Thrust trading algorithm, developed by Michael Chalek, is a popular strategy used in Futures, Forex, and Equity markets. This tutorial provides an introduction to the strategy and demonstrates how to implement it on QuantConnect. The algorithm calculates the range based on historical price data and opens positions when the market moves a certain range from the opening price. The strategy was tested on individual stocks in both trending and range-bound markets, with better results seen in trending markets. The strategy was also implemented on the S&P 500 ETF SPY, which outperformed the market. The strategy can be further extended to other markets by adjusting parameters and applying risk control.

Jing submitted the research Combining Mean Reversion And Momentum In Forex Market

In this tutorial, we explore a strategy that combines momentum and mean reversion in the foreign exchange (forex) market. The strategy is based on research by Alina F. Serban, who adapted the concept from research in the equity market by Ronald J. Balvers and Yangru Wu. Serban creates a momentum factor using returns from the past three months and a mean reversion factor based on the deviation from the mean price. Regression analysis is used to predict the returns for the next month. The strategy is applied to the forex market, specifically the EURUSD, GBPUSD, USDCAD, and USDJPY pairs, with monthly rebalancing. The model's significance level and coefficients are similar to those in Serban's paper, but the returns and Sharpe Ratios obtained are not as good as claimed. The algorithm achieves a stable annual return of 11%, a 0.8 Sharpe Ratio, and an 11% drawdown. The strategy is centered on the theory of uncovered interest parity (UIP), which states that exchange rate changes should incorporate interest rate differentials. By identifying deviations from UIP, abnormal returns can be generated. The strategy uses the deviation from UIP as an indicator. The tutorial provides an overview of the interest parity conditions and the model and parameter estimation process.

Jing submitted the research The Momentum Strategy Based On The Low Frequency Component Of Forex Market

Abstract: This discussion focuses on a momentum trading strategy in the Forex market based on the low frequency component of the exchange rate. The strategy utilizes the Hodrick-Prescott Filter to generate the non-linear trend component, which is then measured using the MA(1, 2) rule. The performance of the strategy was tested on seven exchange rates, showing less robustness and sensitivity to model parameter changes. The Hodrick-Prescott Filter decomposes the time series into cyclical and trend components through an optimization problem. Trading signals were generated using MA rules on the low-frequency component, with smoother trends observed with larger values of lambda.

Jing submitted the research The Dynamic Breakout II Strategy

Abstract: This tutorial discusses the Dynamic Breakout II strategy, which is based on the book "Building Winning Trading Systems". The strategy involves determining the look-back period based on volatility change rate and making trading decisions based on the highest high, lowest low, and Bollinger Bands indicator. The strategy is auto adaptive and can adjust its rules based on past performance. It is commonly used in Forex, Future, and Equity markets. The newer version of the strategy introduces the Bollinger Band and adjusts the look-back days using market volatility. The stop loss signal is also dynamically changed with the look-back period. Backtesting on EURUSD and GBPUSD over a 6-year period showed a drawdown of 20% and profitability in trending markets.

Jing submitted the research Volatility Effect In Stocks

This discussion focuses on the volatility effect in stocks, specifically how stocks with lower volatility tend to earn higher risk-adjusted returns compared to those with higher volatility. The study extends to US stocks with higher market capitalization. The method used involves universe selection, where stocks without fundamental data and those with a price below 5 are excluded. A universe of 100 stocks is selected based on dollar volume, and then 50 stocks with the highest market cap are chosen. The volatility is calculated using a RollingWindow to store daily return data, and the standard deviation is used as a measure of volatility. The trading strategy involves going long on 5 stocks with the lowest volatility and liquidating stocks not in the lowest volatility list. The portfolio is rebalanced monthly.

Jing started the discussion A tool algorithm for picking effective factors in stock selection model

The most important feature of a successful multi factor stock selection model is its ability to...

Jing started the discussion Generate volatility surface plot by interpolation

Hi everyone,

Jing left a comment in the discussion How to generate the Rolling Window of 4-TradeBars

To obtain the bar open price in OnData(self, data),

5 years ago