AutoTrader Overview#

This page provides a high level overview of using AutoTrader.

User Inputs#

At a minimum, AutoTrader requires you to provide a trading strategy. Given some data, your strategy is expected to output trading signals in the form of Orders. This is normally enough for you to run a backtest on your strategy, but if you would like to trade live, you will also need to provide your trading account API keys in a keys.yaml file. It is also recommended that you bring your own data, but this isn’t essential.

Note

With AutoTrader v0.7, you can also click trade. This means you can connect to your broker without providing a strategy. See the tutorial here for more information.

General Deployment Process#

To make things go as smoothly as possible, you should generally set up your instance of AutoTrader by calling the methods in the following order.

  1. Create the AutoTrader instance

at = AutoTrader()
  1. Configure the AutoTrader instance

at.configure()
  1. (Optional) Add a trading strategy (or strategies)

at.add_strategy()
  1. (Optional) Add data

at.add_data()
  1. (Optional) Configure virtual account (for backtesting and paper trading)

at.virtual_account_config()
  1. (Optional) Configure backtest (for backtesting)

at.backtest()
  1. Run AutoTrader

at.run()

Trading Environments#

There are two trading environments: paper and live. The environment being used can be specified in the configure method, but it will be overwritten to paper any time you call the virtual account configuration method.

Paper Trading#

environment="paper"

Paper trading can fall into one of two categories:

  • fully simulated trading via the virtual broker, or;

  • demo trading via an exchange/broker’s dedicated demo API.

If the exchange you wish to use offers a “demo” trading API (or testnet on crypto-specific exchanges), this can be a good way to test that all the required functionality of your strategy is supported by the exchange. It should always be an intermediate step before deploying your strategy live. Simply make sure that you have provided the appropriate API keys in your account configuration file.

In some instances, the liquidity available on testnet API’s is not reflective of that on the live exchange. In this case, you will not get a good indication of your strategy’s performance. For this purpose, using the capabilities of the virtual broker to simulate trading is the way to go. To activate this functionality, simply configure a virtual trading account via the virtual account configuration method.

Live Trading#

When you are ready to deploy your strategy with real money, set the environment argument in the configure method to live. This will switch all of the API pointers to the live endpoints, and fire your orders to the live platforms. When Autotrader is running in livetrade mode, you will see this indicated as shown below.

../_images/livetrade-banner.png