This chapter describes some of the building blocks of AutoTrader’s design. We strongly recommend reading it, but those in a hurry can skip it.
What is Broker Independence?
In the world of software, it is considered a good practice to build loosely coupled components. This helps the software to be highly flexible and adaptable to new changes.
Let us understand this with an example:
Tightly Coupled Trading System
A trader decides to use stock broker (Name: ABC) provided API to automate his trading strategy.
Scenario 1: (Not happy with stock broker ABC)
Later he decides to change stock broker, which is a realistic scenario. Example, may be the trader is not happy with:
- New brokerage rates
- Customer support
- Outage in broker’s trading systems etc.
He selects a new broker (Name: XYZ). Now he has a problem, all of his strategy code is using API functions which are specific to stock broker ABC. His trading strategy will not work with the new broker XYZ. As a result, he has to do the changes everywhere in the code to use functions provided by the new broker XYZ. He has to test everything again.
As you could see, the trader ended up doing so much of technical work which is not what he should be doing. He should rather spend his time on improving his trading strategy.
If he had used a Broker Independent API instead of broker specific API; then all he needed to do to switch stock broker is simply change a setting.
Scenario 2: (Trade with multiple brokers)
In this scenario, the trader wants to trade with multiple brokers. This is again a realistic scenario. The reasons could be:
- To safeguard himself, if one stock broker’s trading system is having an outage
- To trade same strategy in spouse’s account
- He just wants to reduce his risk by distributing funds across many brokers
Again same problem, his trading strategy is coded using a broker specific API. It means it will not work with any other broker. As a result, he needs to write different copies of the same trading strategy (one per stock broker). It involves so much programming and testing efforts.
If he had used a Broker Independent API instead of broker specific API; then all he needed to do to was to add more trading accounts in the settings.
Loosely Coupled Trading System
A loosely coupled trading system does not depend on the stock broker specific API. Instead, it uses a broker independent API. It has many advantages:
- Change stock broker from settings (No code change required)
- Trade in multiple accounts (No code change required)
- No need to test API functions across different brokers (it is taken care by API provider)
- Allows traders to focus on improving the trading strategy
AutoTrader
Broker independence offered by AutoTrader makes it easy for users to build flexible trading systems. Internally, StocksDeveloper team has put in a lot of efforts to make the magic of broker independence possible. It involves following components:
- Broker Independent API Functions
- Broker Independent Trading Accounts (Pseudo Accounts)
- Broker Independent Stock/Derivative Symbols
We will look at each one of these components in the next section.