Automating Spread Trades Through the CQG API
Summary
The document considers how to automate a spread strategy when the charting platform does not execute the user’s full rules automatically. The example strategy buys one instrument and sells another when their spread falls below a lower Bollinger Band, then uses linked one-cancels-other orders for a stop and target. One answer frames the implementation as reacting to a platform condition trigger and issuing an API trade action, with additional conditions handled in the event logic.
Another response points to CQG’s data and trading API examples as possible starting material and notes that API use may be tied to the CQG Integrated Client. The discussion is preliminary: it offers no working code, sample selection, or details on order-state handling, spread leg execution, or risk controls. It also mentions other platform integrations, but does not compare them systematically or establish current compatibility.
Key ideas
- A spread strategy can be structured around a condition trigger followed by an API action.
- The example uses a Bollinger Band signal and linked stop-loss and target orders.
- CQG API samples are suggested as a starting point for implementation.
- The discussion does not provide complete code or resolve execution and risk-control details.
Tags
Full text
# How to build an execution trading system with CQG API? # How to build an execution trading system with CQG API? I am currently using CQG for spread trading and have a spread trading strategy in CQG chart. I am trying to automate my spread trading strategy in CQG, but CQG told me to look at CQG API samples to build my own system or get third party software. The CQG trade system doesn't allow you to automate your strategy in CQG IC. So, I need automated trading software to execute my strategy. CQG API should allow you to build your own execution system. Could you tell me which example in CQG API sample helps to start building a spread trading system? For example, buy A instrument and sell B instrument when the spread price goes below lower bollinger band, and put OCO limit order for stop loss and target exit. Would it be hard to make that kind of system using CQG's API? ## Answer by Matthew (score 1) https://quant.stackexchange.com/a/3925 Based on the conditions you set forth this would be relatively simple in the CQG API. You can, for example, set up condition triggers in the IC. All you're really asking is for an API action following one of the triggers. Pseudo code would be something like this: Handles event trigger: If (additional conditions) then execute trade. Are you just shopping for an API? ## Answer by Javier Ossa (score 0) https://quant.stackexchange.com/a/57361 I guess that you can implement with CQG APIs, an algo trading referring to this links: https://partners.cqg.com/api-resources/cqg-algo-orders-trading-apis https://partners.cqg.com/api-resources/overview and especially to this link: https://partners.cqg.com/api-resources/cqg-data-and-trading-apis in which shows some programming examples in different languages. https://www.cqg.com/products/cqg-apis it seems that the API can be used only in the "CQG Integrated Client" https://www.cqg.com/products/product-comparison I Have ninja trader 8 multy brokerage, but as being very powerful for me i see also some limitations about brokerage and is not been used any more in brokers like AMP and others. cannot integrate with MATLAB or python. there other ways to integrate MATLAB with other brokers like TT Technologies, Blumberg and Reuters, which seems more expensive options. I had Reuters light core version, "Thomson Reuters Eikon" which had stopped support for MATLAB, and on the data side, I like IQFEED but also no support anymore, the only solution is http://undocumentedmatlab.com/iqml API to connect IQFEED with MATLAB.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.