An introduction to the Trading revolution: How to deploy a trading strategy with Tradologics.

Ever since I announced Tradologics last week, it’s been getting a lot of interest from traders, and even from some brokers 🤩.

Over 1,700 people have already signed up for the waitlist, which is both exciting and humbling! 🎉

Alas — along with that interest, I received a lot of questions from people wanting to know more about the services and trading scope

While Tradologics has many services to address every phase in the trading strategy business lifecycle, in this article, I’m going to go over the 4 core components of Tradologics, which are Tradelets, Tradehooks, Pipelines, and the Universal API.

Furthermore, this article will focus on the strategy deployment stage (I will address research and backtesting in a future post).

Traditional Trading

You’ve conducted your research and came up with a brilliant trading strategy.

Good for you!

Now you just need to:

  1. Write a program to download real-time market data, store it, and feed it to your algorithm.
  2. Filter out candidates that don’t match your universe criteria.
  3. Have your algorithm work its magic and come up with trading signals.
  4. Decide on your order size, based on your account balance, margin, and open positions.
  5. Submit your orders to your broker, and monitor their status.
  6. Manage your positions and scale or exit them based on the strategy’s goals and market conditions.
  7. Get a server, configure it for maximum security, and put your code on it.
  8. Monitor your trading server for errors and make sure it’s running without a glitch.

It’s as simple as that!

Trading with Tradologics

As stated earlier, the 3 core components of Tradologics, aside from the Universal API, are Tradehooks, Tradelets, and Pipelines.

1. Tradehooks

At the heart of your Tradologics’ trading setup are Tradehooks. These are webhook-style calls that push relevant data to your trading server.

Tradehooks eliminate the need to proactively connect to your broker or market data feed provider and request for information.

Tradehooks can push several types of data to your server, including market data, account information, positions status, and order status.

You can have Tradehooks push data to a trading server you own and manage, or, if you love life, use Tradelets.

2. Tradelets

Tradelets are encrypted, serverless functions that run your trading code — saving you from obtaining, configuring, and monitoring a trading server.

One of Tradologics’ core principles is that trades know what works best for them. We won’t tell you what language to write your algo in, which framework to use, or which broker to trade with.

Based on this philosophy, Tradelets can run code written in Python, Node.js, C#, Go, Ruby, Java, PHP, or Shell script (with R, Matlab, and EasyLanguage in the roadmap).

3. Pipelines

Another cool component of Tradologics is Pipelines. Pipelines act like stock screeners that filter out unwanted stocks from your trading algorithm, so you only get data for assets that match your universe criteria.

Putting it all together

The data flows like this:

A scheduler invokes a Tradehook, which fetches market data and passes is to a Pipeline for filtration. The filtered universe is then being sent back to the Tradehook.

Then, the data is pushed to your Tradelet, which parses it and passes it over to your Strategy. Depending on your strategy’s logic, you submit orders to any of the supported brokers using the Universal API.


Tradologics — Strategy Flowchart

The only part of this flowchart you need to take care of is the green box representing your strategy logic. Tradologics will handle everything else.


Here’s an example strategy:

You have an algorithm, written in Python, that buys stocks when the 10-day moving average is above the 50-day moving average, and vice-versa (amazing strategy, I know — send me the check later).

We only want to run this strategy on stocks that are:

  1. members of the S&P500 index
  2. released an earnings report on the previous trading day after market close, or today before the market opened
  3. gapped up or down from the previous close

Now that we know what we want to do, let’s see how to do it…

To get this algo rolling we’ll need to:

  1. Spin up a Python-enabled Tradelet, and add our code to it
  2. Write our strategy logic (obviously)
  3. Create a Pipeline to find stocks matching the above criteria
  4. Setup a Tradehook to push market-data for filtered stocks every day, 5 minutes before the market opens, and select the broker accounts associated with it.

What would happen next, is that the Tradehook will send a JSON payload to our Tradelet, for the following events:

  • Market data (daily, 5 minutes before market open)
  • Account events (margin change, etc)
  • Position updates (P&L, etc)
  • Order status (for pending orders)

Here’s an example of the payload structure:

{
  /*
  event can be:
  - account, for account status events
  - position, position updates
  - order, order updates (filled, rejected, etc)
  - data, for market data
  */
  "event": "data",

  /* always sent, based on associated broker accounts */
  "accounts": [],

  /* always sent, based on associated broker accounts */
  "positions": [],

  /* pricing/pipeline data; sent when event == data */
  "data": {
    "AssetA": {...},
    "AssetB": {...},
    ...
  },

  /* order data; sent when event == order */
  "order": {...}
}

Let’s get started…

The first step would be to spin up a Python-enabled Tradelet. Here’s how to do it using our command-line tool, tctl (the Tradologics Controller).

Create a Tradelet named myalgo:

$ tctl tradelet create --name myalgo --lang python
Tradelet "myalgo" created with (req id: cb945f2d-103d-4092-95d4-a1024c9045dd)

Next, we’ll set up the Pipeline, this time using the dashboard:

Tradologics — Pipeline Setup PageTradologics — Pipeline Setup Page

The next step is to configure our Tradehook:

Tradologics — Tradehook Setup PageTradologics — Tradehook Setup Page

Finally, we’ll write the algorithm to handle the Tradehook’s payloads.

For example:

# mycode.py
import tradologics

def tradehook(payload):
  payload = tradologics.parse(payload)

  # is this a "data" payload?
  if payload.event == "data":

    for asset in payload.data:
      sma10 = asset.close.rolling(10).mean()
      sma50 = asset.close.rolling(50).mean()

      # buy signal ?
      if sma10 > sma50 and  # algo rule
         asset.last > asset.prev_close and  #  gap up
         data.positions[asset.id] <= 0:  # not in short position already
        tradologics.submit_order(
          asset=asset.id,
          qty=100,
          kind="market",
          side="buy",
          time_in_force="opg",
          accountId="my-ib-account",
          strategy="my amazing strategy"
        )

      # sell signal ?
      if sma10 < sma50 and  # algo rule
         asset.last < asset.prev_close and  # gap down
         data.positions[asset.id] >= 0:  # not in short position already
        tradologics.submit_order(
          asset=asset.id,
          qty=100,
          kind="market",
          side="buy",
          time_in_force="opg",
          accountId="my-ib-account",
          strategy="my amazing strategy"
        )

Notice how we didn’t have to fetch the data from anywhere or filter out any assets. It is all being taken care of by our Tradehook and Pipeline.

How cool is that? 😎

The final step is to push our code to the Tradelet. Again, we’ll use the tctl tool to do this:

$ tctl tradelet deploy myalgo --file mycode.py
File "mycode.py" was deployed to Tradelet "myalgo" (req id: 9d3e632e-7197-40d4-8d37-d0a34bf82171)

That’s it!

Your strategy is now live and you’ll be able to monitor its performance via the Tradologics dashboard or the tctl tool.

I’m really excited about all the innovations that Tradologics introduces and feel that it has the potential to help many traders who are "lost in the plumbing". But what’s more important is what do you think…

I'd love to get your feedback, questions, and ideas as we're getting ready to launch the platform. Also, please share this post to help us get the word out! 🙏

👨🏻‍💻 Finally, if you haven’t already, go to Tradologics.com and add yourself to the waitlist to be notified as soon as you can start using Tradologics.

Until then,

Happy trading 💪

- Ran

* Please note that actual syntax and UI may, and probably will, change a little by the time we launch.