Automated strategy trading. Tip #6 - broker APIs are unique

Discussion in 'Automated Trading' started by Trade Prophet, May 5, 2022.

  1. Eventually, after all is backtested and optimized ,the strategy has to connect to a broker to pull data and execute trades.
    This part of the strategy is often overlooked, but is very significant because some brokers allow to implement some strategy logic using their API.
    A simple example would be a trailing stop loss, if the strategy contains that logic, you don't have to implement it, just use the right order type and the trailing stop loss logic is taken care of, you could implement it, of course, but that means this would be a potential place for bugs while this part of the strategy is already there for you to use. Another example would be precise timing of entry and expiration duration for limit orders, when a specific order has to be executed at a specific time, and wait to be executed for a specific time period, this logic may be tricky to implement correctly while a broker already has that as part of the API (interactive brokers API for ex.).
    Broker APIs are unique, not all provide the same services, not all use the same technology (REST, socket,...), some are pending in nature, others asynchronous.
    Transfer as much load as possible to the broker, saving you the time of development, the broker connection is a significant part of the strategy and should be treated as such, that means that broker selection should be on top of the list when designing a strategy.
    For example, Interactive brokers can't implement grid trading strategies because it does not allow long and short on the same underlying simultaneously, but metatrader and most crypto platform APIs allow that,

    Trade smart.
     
    bitcuration likes this.
  2. so is this something we don't know, cannot see and cannot measure, much less control or act upon?
     
  3. Bad_Badness

    Bad_Badness

    Of course you can know it. What he is saying it is a significant part of the architecture.

    Once one realizes the actual implementation details of the API, one designs the system so that it avoids bugs, and not wade knee deep into areas that are not viable, unsupported or simply poorly executed at the API level.

    A good developer knows this. Any programmer can cobble together a system. A skilled developer know how to architect a system that is reliable, scalable, portable, testable, and high performance: an elegant solution.

    For example, I am writing an Easy Language to IB system as a prototype. The main goal is two fold: Can I create a system that works within the constraints, and second, discover all the constraints between the two. Once this work is done, I will rewrite in an actual programing language and do the production system.
     
    Last edited: May 5, 2022
    Trade Prophet likes this.
  4. Nope. Anything can be done via software. You can superpose any number of opposite positions in your software and just trade the algebraical result. And not only you can superpose opposite positions in one layer, but you can also do it on multiple layers.