Translate

Thursday, February 25, 2021

Do’s and Don’ts for Software Engineer Job Interview

Source: https://dzone.com/articles/dos-and-donts-for-your-next-software-engineer-job


See some tips you need to put your best foot forward and succeed in your next technical interview.

  

In my estimation, I have given over 2,500 interviews in my career, the bulk of them for Software Engineer positions. I have been interviewing Software Engineers for over 25 years and in my current role as CEO of Solution Street, I conduct, on average, two interviews a week. Solution Street has been evolving its interview process for over 18 years, and we feel like we offer a pretty robust and fair process. In this article, I will give you the tips you need to put your best foot forward and succeed in your next technical interview.

Do’s for a Software Engineer Job Interview

First, let’s talk about interview Do’s. Based on my experience, here is my list of the top seven things you should absolutely Do!

  1. Research the company and people you are interviewing with.  Spend some time looking at the company website, the interviewer’s background information (if available), and see if they have written any articles/blog posts. Make sure you know what the company does (what do they build/make/sell?) as well as the interviewer (what is their role?).

  1. Prepare key questions you would like to ask.  Your questions should be specific to the company and interviewer(s). Typical questions here are: What type of work do you do? How are the teams made up (cross functional or by function)? What technologies do they use? How is the work-life balance? What are the company's core values and are they real? What are the company’s goals?

  1. Show up 15 minutes early!  Don’t be late; if you get there more than 15 minutes early, wait in your car, or in the nearest cafe. If you are going to be late, let them know (but don’t be late!).

  1. Dress to impress. Even if the company is casual, you should dress nicely. You don't need to overdress based on the company's dress code (you should ask about this before your interview), but you should present your best!

  1. Smile. Smile, smile, and smile some more!

  1. Listen carefully. Repeat the question back if you are not sure. I can’t tell you how often we have eliminated a candidate from consideration because they just refuse to listen during the interview. Answer the questions simply and don’t go on and on unless prompted. How well you listen in the interview is a good indicator of how well you will listen in the job!

  1. Be honest. If asked something you don’t know, say, “I don’t know that.” If, however, you know something close, offer details of that if they are interested. For example, if asked if you know Angular, but you only know React, you should say, “I haven't used Angular before, but I have used React and I have done some reading and I feel like I could come up to speed on Angular very quickly.” Express how you are a hard worker and willing to put in extra time on your own time to learn the technology. Don’t cheat; you may be tempted in an online interview to Google the answer - don’t do it!

Don’ts for a Software Engineer Job Interview

Now that we have covered the Do’s, let’s cover the Do NOTs! Here are 10 things that you should never do during an interview (yes, I have actually seen all of these!).

  1. Chew gum. Chewing gum in an interview is never professional!

  1. Bring your phone. Unless you have a sick family member or a spouse about ready to give birth, leave your phone in the car. If you need to bring your phone, explain why ahead of time and make sure you block out all other callers.

  1. Wear jeans. Even in a casual environment, you should wear slacks or a dress to an interview!

  1. Mumble. Some of us talk louder than others. If you are a soft talker, practice with a friend to appropriately increase your volume. You need to be able to speak clearly and concisely. Silence is perfectly okay; don’t feel the need to fill the void with ums and hmms and whatnots…

  1. Be stoic. Be passionate, animated, energetic...drink a  cup of coffee before the interview if you need to, but don’t go overboard!

  1. Badmouth anyone or any company (or any technology).  Be Switzerland. If you’re asked why you left a company, you can say you weren't being challenged, or it wasn't a fit, but don't say “that company sucks,” or “those guys are jerks” (even if they are).

  1. Ever rate yourself 10 out of 10 for anything (unless you invented it).  Let's say you consider yourself a really great Java developer. In an interview, if you're asked to rate your Java programming skills and you say they are a 10 out of 10 but you miss one or more questions about Java, the interviewer will feel that you overrated yourself. But if you rate yourself as an 8 out of 10 and you miss one or none of the Java questions, the interviewer will think...wow, this person is great and humble! When asked to rate yourself, be honest and fair, err on the side of “under-rating” yourself.

  1. Wear dangling/large bracelets or fidget with your pen.  Clunky bracelets can be a noisy distraction if you are asked to code as part of the interview and your jewelry continually clunks against the computer keyboard or table. Similarly, fidgeting can be a big distraction. For instance, I interviewed someone who clicked their pen open and shut about 50 times during a 1-hour interview...all I could think of was the pen!

  1. Lie on your resume.  Don't even exaggerate, be humble and honest.

  1. Tell the interviewer that you don’t like this kind of work.  The interview is not the place to say that your real passion is something completely different and you just do this to pay the bills. Even if this is true, it is not something you should bring up in an interview.

10 Steps to Succeed in a Live Coding Exercise

Now that we have covered the key Do’s and Don’ts of interviewing, many Software Engineer interviews include a live coding exercise. When doing a live coding session, here are my 10 steps to success!

  1. The first step is to repeat the question back to the interviewer(s).  Make sure you understand the directions. If the interviewer(s) shares the program problem on the screen or paper, try to resist going directly to reading it. First, listen to the person describe the problem; once they pause, then you can read the problem yourself and repeat it back to them in your own words. Take a deep breath and try to relax!

  1. Make sure you understand the time restrictions.  Know how long you have to do the exercise. If you're not sure, ask how long you have to complete it.

  1. Write the signature first.  Outline the function calls and parameters passed. If you prefer solving on paper, that is okay, just make sure you ask the interviewer.

  1. Talk through the problem.  As you are solving it, ask questions.

  1. Start with pseudocode as comments.  Then build as you go.

  1. Code what you know first.  The rest will come.

  1. Test the solution.  Test out the solution in front of the interviewer(s).

  1. Refactor the code.  Do this if given time.

  1. Use good variable names from the start.

  2. Add comment documentation to methods/classes/functions.

I am often asked how to prepare for questions that might be asked during an interview. Software Engineer interview questions vary tremendously from company to company, so it is very hard to know exactly what will be asked. I recommend you start by taking a close look at the job description. Here is a sample job description from my company’s website:

Preparation Process for an Actual Job Description

Solution Street has a great opportunity for C#/ASP.NET developers with a strong background in software design and development having worked on multiple projects over their career with the following experience: 5+years .NET development experience Oracle PL SQL Ability to work with minimal supervision Excellent communication skills *This position is currently remote, but candidates should be local to the Northern VA, DC area.

From reading this, the interviewee should be prepared to be asked about the following in an interview for this position:

C# - What are the fundamentals of the language, and what are typical mistakes folks make using the language? If interviewing for a junior position, you should know the basics of syntax, variable scoping, iterators/loops, assignments, basic Object Oriented constructs. For a mid-level position, possible questions might include namespaces, overloading, more advanced Object Oriented concepts (inheritance, polymorphism, abstraction). For an advanced position, topics might include more architectural concepts, memory leaks, garbage collection, performance, threading and lambdas.

ASP.NET - Here you probably need to know more about the version they are looking for (good question to ask in the initial screen); once you know that, you can get a better idea if this is legacy code base asp/spaghetti, webforms, MVC or .NET core. For each of these, you should know how they work, be able to do an implementation in front of someone, understand the framework, the lifecycle, conventions and configurations. Ideally, you would be able to compare these; what can you do with .NET core that you can’t with .NET MVC? (Core is cross platform.)

Oracle PL SQL - Again, it’s probably a good idea to know what they are looking for here before the interview; do you need to be able to design tables and relationships? Or do you just need to be able to write SQL? How about stored procedures, do you need to be an expert at these?

Minimal supervision - This says they are looking for a self-starter, someone who can troubleshoot problems on their own, someone who can ask the right questions to solve the problems presented. Be prepared for questions like “What would you do if you didn’t have any work assigned to you?” and “What would you do if you hit a blocker?”

Excellent communication skills - This says they want you to be able to communicate well with the team both verbally and in writing. Can you articulate something complex in a way that is easy to understand? You may get a question about how you would explain big endian byte order to your grandmother.

So reviewing the job description can usually help you prepare for the types of questions in the interview, but there are sometimes when the job description is just plain wrong, or the interviewer is not as familiar with the job description as they should be, or they are just “winging it.” So you may get some random questions out of left field that you are totally not expecting. The best way to deal with an unexpected question is to try to understand why they are asking it. For example, if you were interviewing for the position advertised in the job description above and you were asked how well you know Angular (which is not mentioned in the job description), you might reply with the best answer you can...which could be "I really haven't had a chance to use Angular, but I would love the opportunity to!” This sounds way better than “I don’t.” But after you answer, you can say, “I didn't notice Angular in the position description. Are you considering moving to Angular for the front end of this system?” This can trigger a good dialog.

Some interviewers don’t have a ton of experience so they just Google “top interview questions for Java developers” or “top interview questions for React developers” depending on the job position, and use the first few questions they find. So it’s not a bad idea for you to do this since you'll be prepared if they happen to do this!

Some interviewers use a probing technique; they ask a question and if you answer it well, or seem knowledgeable in a specific area, they continue to ask more and more detailed questions until they either run out of questions or you run out of answers. For this style, a great option for the interviewee is to not just answer, but give examples of how/when they used the technology or technique they are asking about.

Lastly, some interviewers like to ask brain teasers or math questions, or big idea/thought questions. Big tech companies are famous for questions like “How would you move Mt Fuji?” or “How many gas stations are in the USA?” The important thing here is not to get flustered and to take up the challenge and show your analytical thinking and problem-solving skills. Clarify the probing questions and come up with ideas and the pros and cons of those ideas.

3 Tips for an Online Interview

During this COVID-19 time, most interviews are being done online, so I have a few hints for online interviews that will help you out:

  1. Make sure you have a good set of headphones with a microphone. Using your laptop mic has a good chance of not sounding well and having feedback from your speaker.

  2. Make sure you have solid bandwidth for the interview and test the tools you will be using ahead of time. In a recent interview, the interviewee had very bad audio and video and the connection kept dropping. At the end of the interview, I asked the individual to run a speed test that showed a throughput of less than 1 MB/second which was a surprise to this person who didn't know why it was so bad.

  3. Find a quiet place free of distractions and interruptions. We have all had our kids or our pets interrupt us during these times which is fine for normal business, but for an interview, you really need to find a quiet place.

I hope my recommendations for a smooth interview process, including my list of do's and don'ts, suggestions for a successful live coding session and how to prepare for interview questions, and tips for online interviews have been helpful. If you have other suggestions, drop a comment, we are always trying to improve!

Sunday, February 21, 2021

Ultimate List of Automated Trading Strategies You Should Know

Sources:

Ultimate List of Automated Trading Strategies You Should Know - Part 1 https://medium.com/automation-generation/ultimate-list-of-automated-trading-strategies-you-should-know-part-1-c9a333f58930

Ultimate List of Automated Trading Strategies You Should Know - Part 2 https://medium.com/automation-generation/ultimate-list-of-automated-trading-strategies-you-should-know-part-2-88184b27cd60

Ultimate List of Automated Trading Strategies You Should Know - Part 3 https://medium.com/automation-generation/ultimate-list-of-automated-trading-strategies-you-should-know-part-3-25d580ccab0c


Since the public release of Alpaca’s commission-free trading API, many developers and tech-savvy people have joined our community slack to discuss various aspects of automated trading. We are excited to see many have already started running algorithms in production, while others are testing their algorithms with our paper trading feature, which allows users to play with our API in a real-time simulation environment.

When we started thinking about a trading API service earlier this year, we were looking at only a small segment of algo trading. However, the more users we talked with, the more we realized there are many use cases for automated trading, particularly when considering different time horizons, tools, and objectives.

Today, as a celebration of our public launch and as a welcome message to our new users, we would like to highlight various automated trading strategies to provide you with ideas and opportunities you can explore for your own needs.

Please note that some concepts overlap with others, and not every item necessarily talks about a specific strategy per se, and some of the strategies may not be applicable to the current Alpaca offering.

(1) Time-Series Momentum/Mean Reversion

(2) Cross-Sectional Momentum/Mean Reversion

(3) Dollar Cost Averaging

(4) Market Making

(5) Day Trading Automation

(6) News/Event-Driven Trading

(7) Using Machine Learning

(8) Exchange Arbitrage (N/A for Alpaca)

(9) Portfolio Rebalancing

(10) ETF/Index Arbitrage.

(11) Market/Social Sentiment Strategy

(12) Pairs/Long-Short

(13) HFT (High-Frequency Trading)

(14) Order Slicing (N/A for Alpaca)

(15) Synthetic Options Strategy (N/A for Alpaca)

(1) Time-Series Momentum/Mean Reversion

Background

(Time-series) momentum and mean reversion are two of the most well known and well-researched concepts in trading. Billions of dollars are put to work by CTAs employing these concepts to produce alpha and create diversified return streams.

What It Is

The fundamental idea of time-series forecasting is to predict future values based on previously observed values. Time-series momentum, also known as trend-following, seeks to generate excess returns through an expectation that the future price return of an asset will be in the same direction as that asset’s return over some lookback period.

Trend-following strategies might define and look for specific price actions, such as range breakouts, volatility jumps, and volume profile skews, or attempt to define a trend based on a moving average that smooths past price movements. One of the simple, well-known strategies is the “simple moving average crossover”, which buys a stock if its short-period moving average value surpasses its long-period moving average value, and sells if the inverse event happens.

Mean-reversion is the expectation that the future price return of an asset will be in the opposite direction of that asset’s return over some lookback period. One of the most popular indicators is the Relative Strength Index, or RSI, which measures the speed and change of price movements using a scale of 0 to 100. For the purposes of trying to assess the likelihood of mean-reversion, a higher RSI value is said to indicate an overbought asset while a lower RSI value is said to indicate an oversold asset.

For Implementation

Trend-following and mean-reversion strategies are easy to understand since they look at a single asset’s time-series and try to make a prediction about that asset’s future return, but there are many ways to interpret the past behavior. You will need access to historical price data and may benefit from an indicator calculator library such as TA-lib. Virtually every trading framework library, including pyalgotrade, backtrader, and pylivetrader, can support these types of strategies.

Here is the Quantopian tutorial with backtest result for moving average crossover:

(2) Cross-Sectional Momentum/Mean Reversion

Background

In the U.S. stock market, there are more than 6,000 names listed on the exchanges and actively traded every day. One of the hardest problems in stock trading (and also true for global cryptocurrency trading) is how to pick the stocks.

What It Is

Cross-sectional momentum compares the momentum metrics across different stocks to try to predict the future returns of one or more of them. Even if two stocks such as Facebook and Google are indicating a momentum breakout, this may be driven by the market, but you try to beat the market by taking stronger momentum between those signals. Same for mean reversion. The point is that we consider the market movement that drives each individual stock and consider the relative strength of signals across stocks in an effort to produce a strategy that will outperform the market. This tends to be more computationally heavy, since you need to calculate the metrics with potentially tens to hundreds of time-series.

For Implementation

Again, for this type of strategy libraries like TA-Lib may make it easier to calculate the indicators. Also, you may need simultaneous access to multiple symbols’ price data. IEX’s API can provide up daily bar data for up to 100 stocks per query.

A medium post about cross-sectional study:

(3) Dollar Cost Averaging

Background

This is one of the simplest automated trading strategies and it is widely used by many investors.

What It Is

The idea is to invest a fixed amount of money into an asset periodically. You may doubt it, but some research indicates that this works in the real world, especially long-term. The logic behind it is that price fluctuates many times, and you may buy the stock cheaper overall compared to just investing in the stock at one point in time.

Remember, all of you who contribute to your 401k account are basically doing this. However, you might never think about doing it yourself, simply because there has been no easy way to automate this process.

For Implementation

Now with Alpaca trading API, it’s much simpler and provides much more flexibility.

(4) Market Making

Background

Market makers are important intermediaries who stand ready to buy and sell securities continuously. By doing this, they provide much-needed liquidity and are compensated for their inventory risk primarily by capturing bid-ask spreads.

Market making used to be done primarily by humans, who worked as floor traders in the pits, but now it’s almost entirely performed by machines. As exchanges have become more and more electronic, the strategy market makers employ has naturally required automation.

What It Is

There are a variety of approaches to market making but most typically rely upon successful inventory management through hedging and limiting adverse selection.

Some market makers may have very tight exposure limits and seek to turn over their positions quickly with the goal of being flat at the end of each day. Others may operate on a much longer horizon, carrying a large and diverse portfolio of securities long and short indefinitely. Undoubtedly, for any market maker, speed helps. The speed of calculation allows the market maker to continuously update its pricing and portfolio risk models, while the speed of execution allows the market maker to act on its models in a timely manner in an effort to reduce adverse selection and get better pricing on its hedges.

Competitive market makers need high-resolution data and a low latency infrastructure, although typically the longer their trading horizon is, the less sensitive they are to these things, and a smart but slow model goes a long way.

For Implementation

Also, in order to process vast amounts of data quickly and handle concurrency, languages like python may not be suitable. Go/Rust would be a good choice for balance between ease of concurrency handling and processing speed, as well as functional languages like Erlang/OCaml or good old languages like C++.

Some high-level explanation of market making:

(5) Day Trading Automation

Background

Lots of day traders develop their trading strategies based on a mechanical set of conditions that are first based on intuition. Since manual day trading involves continuously assessing market conditions and making discretionary trading decisions on the spot, it can often be very physically and emotionally draining. Because the strategies are based on some rules or heuristics which can be codified, it is natural to think they can be automated, which is likely the case.

What It Is

One of the very well-known day trading strategies is the gap-up momentum strategy.

Suppose between the previous market close and next market open there is a positive earnings report. The market opens with a big gap, drawing lots of traders’ attention, and the price keeps going up for a while in the morning (but may not continue for long).

This strategy seeks to capture this follow-through momentum. The challenge here is that not all gap-up stocks keep going up, and among a handful of screened stocks, you need to watch each one’s price action simultaneously.

Some traders may enter on a price breakout from a certain price resistance level, while others may wait to see a chart pattern form to determine the first bottom before going higher. Day trading often relies on analyzing the stock’s price chart and fine-tuning the algorithm to capture the price action can be tricky. That said, once it’s well developed, you are letting your bot trade on your behalf as if you were trading manually, and now you don’t need to monitor the markets and you can also monitor more stocks at the same time without any emotions affecting your trade execution, which is very compelling.

For Implementation

The main thing you need for this is access to market data. You may not even need indicator calculations but instead, you may need a stock screening library such as pipeline-live. The latency typically isn’t so important, so you don’t need to write your system in C++. Python, as well as other lightweight languages, are likely sufficient.


(6) News/Event-Driven Trading

Background

Trump says something about Amazon, and the company’s share price drops. The FDA publishes an approval for an outstanding generic application, and one biotech company’s share price jumps up. Elon Musk tweets about taking Tesla private, and the Tesla stock quickly trades higher.

News can cause significant changes in a stock price, but it’s challenging to (a) identify such events and to (b) take the right actions as soon as they happen.

Possible Approach

For (a), it’s the era of data, and you can get historical news and tweets from several sources, and identify keywords or particular events that may have led to a material price movement. Machine learning, or more specifically natural language processing, might solve some of the problems here, too.

For (b), again, it may not make sense for you to keep monitoring Twitter, StockTwits, Bloomberg or Y! Finance and react to the news with a manual trade. Rather, with Alpaca Trading API, you can automate this if-then-that process into something that continuously scans for news or events and reacts accordingly.

For Implementation

All you need here is a news and/or Twitter feed, which you can constantly monitor for new actionable events. Twitter and StockTwits both provide APIs for personal use as well. Some cloud environment such as Amazon Lambda may be a good solution for this too.

Trigger Finance’s (now part of Circle) Trump Trigger:

(7) Using Machine Learning

Background

The evolution of AI and machine learning technology is also changing the landscape of algo trading.

While institutions have been doing massive experiments using terabytes of data and GPU clusters, due to the nature of secrecy in the industry, public discussion and research have often been limited to simple price predictions with bare minimal LSTM or ARIMA models.

Use Cases

But the power of ML allows the practitioner to find the optimal signal among a set of rules with varying parameters. Without ML, a trader might develop a rules-based system that is too inflexible to changing market conditions. Or a trader’s mechanical system might have suboptimal feature parameters that do not effectively capture the feature’s predictive value.

For example, ML can be used to choose the dynamic parameters of indicators like MACD for developing an exit strategy based on the context and other factors.

The application of machine learning in trading isn’t just for analyzing price data. Lots of new hedge funds are making use of satellite images to add fundamental information for better investment decisions. Natural language processing is another.

Data-driven trading is improving a lot with machine learning today. It is not just a coincidence that we at Alpaca are also seeing great interest among users for ML-based trading strategies.

For Implementation

You will certainly need a good set of tools such as scikit-learn and tensorflow, in addition to good data sources, and possibly may benefit from computer resources such as a GPU to build your trained model.

On the other hand, you may need less or even no market knowledge. Deep learning or the use of multi-layered neural nets has become possible to do even with a consumer laptop, and often it can be difficult for the practitioner to understand the logic behind the decisions generated from a deep learning model. Generally, it’s probably going to be helpful to have domain knowledge, no matter what industry you apply ML to, as ML and deep learning are by no means a silver bullet.

A public python notebook about stock prediction using LSTM:

(8) Exchange Arbitrage (N/A for Alpaca)

What It Is

The idea of exchange arbitrage is simple — you want to capture the price differences that occur when a certain fungible asset trades on more than one venue.

In Reality

This is not particularly applicable to the U.S. equities today as the markets are incredibly efficient. Rather, there still exist opportunities for individuals to engage in cryptocurrency exchange arbitrage, but even these are rapidly disappearing and involve other operational and counterparty risks not seen in U.S. stocks.

While exchange arbitrage sounds promising, it is not risk-free nor is it riskless and you should be aware of and consider all operational, technical, and legal issues that can arise. That said, exchange arbitrage is well understood and mechanical and hence much more suitable for automation.

Again, the US equity market is very efficient today, and regulations prohibit locked or crossed markets, so opportunities are extremely rare and short-lived. Further, Alpaca currently does not offer direct market access at this moment.

Great overview of crypto exchange arbitrage:

(9) Portfolio Rebalancing

Background

As the old saying goes, you may not want to put all your eggs into one basket. By diversifying your investment into multiple different assets, you can distribute risk, and your entire portfolio value can be more efficient in terms of the risk/return profile. It all sounds good, and this is what you can expect to hear from your financial advisors and asset managers. It’s based on the simple mathematics as follows:

Image for post

What we are talking about here is maximizing the return while keeping the risk (volatility) at the lowest possible point for the expected return.

In Reality

You can do research on the expected risk/return by looking into the historical data for each stock so that you can construct the portfolio from scratch.

Great. Now, you need to actually buy those stocks to make this happen, but what if we are talking about 50 different names? It’s error-prone and time-consuming to do it manually. OK, let’s say you managed to do so once, now time flies and weeks or months later, some stocks moved a lot more than the others, and risk profile of your portfolio might have been changed. You now need to do the calculation again and find out the optimal portfolio structure, then buy and sell stocks resulted by the calculation!

For Implementation

You may notice that this is all about numbers and pretty mechanical from a risk/return calculation to placing orders. This is a part of the reasons why there are now many Robo Advisors, which automated this work to charge fees for advisory and asset management.

With Alpaca’s commission-free REST trading API, there is nothing that prevents you from doing it yourself. You can even do it by using a Google Spreadsheet now.

Ref. some medium article about Modern Portfolio Theory:

(10) ETF/Index Arbitrage

Background

While there are many exotic ETFs that hold complicated structured products such as swaps and options, some ETFs are purely baskets of individual stocks.

Since an Index ETF and a basket of their underlying holdings are fundamentally the same things, there exist price arbitrage opportunities when the ETF price dislocates from the basket price.

In Reality

Super active ETFs like SPY (which tracks the S&P 500 Index) likely have no chance for individuals to take such arbitrage opportunities, but for some of the less liquid ETFs, individuals may have an opportunity. Any arbitrage opportunities are very short-lived, and again you need to keep monitoring the market activities to locate them.

Once you detect an opportunity, you may want to get in before it disappears. It would be likely to last somewhere between a few seconds to minutes. While a latency should not be a major issue here, it’s still not suitable to be manually traded either.

(11) Market/Social Sentiment Strategy

Background

It is a great era that such exotic data like social sentiment time series data is available for our personal use. It is similar to the news/event-driven strategy, but social sentiment can target a longer timeframe and can incorporate several different news as well as sentiment sources.

Anecdotally, we’ve seen the traders' sentiment turn negative right before the price starts rising, which is, in a way, very opposite to one’s intuition.

The great thing about making a use of data is that you can do the research and analysis to uncover patterns which may be very counterintuitive.

Where to get the data

StockTwits tracks bulls and bears among internet users for each stock name, and there is also more aggregated data such as the bull-bear ratio published by Investment Intelligence.

For this strategy to work, it may make sense to develop a model that scores sentiment and associates the score with future returns at various time-horizons. The algorithm itself may not be that computational heavy or latency sensitive because the strategy’s time horizon tends to be longer. Also, most likely you can prototype something lightweight using Python Jupyter Notebook.

Bull-bear ratio chart from YChart:

(12) Pairs/Long-Short

Background

A stock price moves up and down, no matter how strong the company’s financials are. Part of the reason for this is that no single stock is completely uncorrelated to the broader market movements or the movements of the sector and industry peers.

What it is

A long-short or market neutral strategy lowers a portfolio’s beta and focuses on capturing alpha, or excess returns, from the company-specific risk, that you take by being long or short the stock.

Some long-short strategies are based solely on fundamental analysis, while others are entirely quantitative and focus on statistical arbitrage.

For example

An example is this: you think that American Airlines is doing a better job than the rest of the airline sector. You buy AAL but also are concerned that the airline sector itself may go down, so you short an equal dollar amount of another airline stock that you do not like as much, for example, DAL (Delta Airlines). If the whole airline sector goes down, you profit from the DAL short position, while of course, you have some loss from AAL long position.

But if at the end of the day American performs better than Delta, you can profit from this pair no matter how the whole sector moves. The same thing can be done across sectors or asset classes over any time horizon.

Almost all assets have some degree of correlation, so whether you choose to focus on differences in the quality of companies’ fundamentals, or you just want to trade the correlation or cointegration of a pair or basket, you could apply a long-short strategy thought process.

For implementation

As you can see, in order to achieve this strategy, you may need to perform some statistical analysis. Consider using python’s statistics packages or R, along with research environment tools such as Jupyter Notebook. It takes work but if you can get it right, it works well.

There are many asset managers, quantitative and fundamental, long-term and short-term, who are trading long-short strategies today.

While Alpaca does not support short selling yet, it is on the roadmap. In the meantime, you can also make a quasi-short position using inverse ETFs in some cases.

Quantopian example code for long-short:

(13) HFT (High-Frequency Trading)

Background

The notion of HFT is very broad. The name just refers to the time horizon of trading strategies and does not mean much in terms of actual trading concepts. For example, some call minute-level trading as HFT, while others disagree and would not even call second-level trading as HFT.

In the US equity market, the battlefield of HFT can be in the microseconds (1/10^6 of a second) or nanoseconds (1/10^9 of a second, and opportunities disappear very quickly unless you are the very first to the market. In his famous book Flash Boys, Michael Lewis talks a lot about the hard wire (fiber), but as of today, HFT firms are utilizing microwaves since they can go straight at the minimum distance to the destination. Yes, that’s right, the real-life rocket science.

For individuals traders

The good news is that their battlefield is far away from any of the strategies we talk about here, and individual traders do not need to worry much about this.

As you can imagine, minute-level trading doesn’t affect long-term investors, and HFT does not have much impact on mid-frequency traders or longer time horizon base.

An interesting reddit post about microwave in HFT:

(14) Order Slicing (N/A for Alpaca)

Background

When you start talking about “algo trading”, many “industry” people start thinking about order slicing first.

Order slicing or order execution algorithm refers to a computer logic that executes large block orders in small pieces to try to minimize market impact and information leakage. Execution transaction costs are especially important to large asset managers, because they may suffer from significant return deterioration when trying to enter or exit a large position.

Smart order routing, which executes orders piece by piece, can reduce information leakage and can prevent others from panicking or front-running the large block order.

For individual traders

This is all about the large positions dealt by institutions and may not be applicable to individual traders. However, we wanted to mention this here because this is one of the oldest and most well-known areas of algorithmic trading and is something that many “industry” people think of when hearing the term “algo” or “algo trading.”

It’s a bit old, but this TED talk is quite helpfulto understand this:

(15) Synthetic Options Strategy (N/A for Alpaca)

Background

Not strictly algorithmic trading, but synthetic options strategies can benefit significantly from automation and the use of trading API.

The simplest and well-known method is to buy an in-the-money call and sell an in-the-money put with the same expiration for the same size, which makes a position that has the same profile as an underlying long position at a much lower cost. While it sounds easy, it can be tricky to determine the best combination of call and put options to use, and it requires tracking the full chains and calculating values for each option in the chain. But once you build your own model, it’s a matter of seconds to come up with the answer.

Options trading in the automated trading space can be much more diverse and interesting than just long or short trading of individual stocks, as you can build structures such as covered calls.

Please note that Alpaca Trading API currently does not support options, but it is on the roadmap.

More detailed explanation about synthetic long position:

Conclusion

This series composes a list of different styles in automated trading at a very high level. For us to write up a broad overview, some descriptions may have ended up to be vague and may need more details. We hope that this series gives you preliminary ideas on the automated trading space.

Some reference: