Millet Porridge

English version of https://corvo.myseu.cn

0%

Semi-Automated Trading System (VI)

This is the sixth post in the trading system series, mainly recording recent optimizations to options strategies and system features. I consolidated part of the combination functionality, with the focus on the bull spreads I use often; I also record errored orders separately, convenient for later review and optimization.

Implementing Combination Orders

As described in the earlier post “Options Strategy - A Variant Ratio Spread“, I currently mainly trade STAR 50 ETF options spread strategies. The benefit of a single underlying: pages and flows can be made more focused and efficient. In the last post “Semi-Automated Trading System (V)“ I mentioned managing holdings by month. Each month’s positions basically consist of single-leg options and combinations like ratio spreads.

1767180027632.png

I found myself frequently building and releasing spread combinations. For example, creating a spread requires these three steps every time:

  1. Buy the lower-strike call option
  2. Sell the higher-strike call option
  3. Build the spread combination

Implementation Details

This process can be fully automated, and can avoid short-term price fluctuations as much as possible. When liquidity is good enough, slippage can also be controlled within an acceptable range. So I integrated these three steps into an independent service, made into a very simple combination order with roughly this structure:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[
{
"method_name": "buy_open_with_executor",
"params": {
"code": "10011349.SHO",
"count": 6,
"price": 0.0,
"wait": true,
"timeout": 30.0
},
"status": "completed",
"description": "买入权利仓: 10011349.SHO x 6",
},
{
"method_name": "sell_open_with_executor",
"params": {
"code": "10011350.SHO",
"count": 6,
"price": 0.0,
"wait": true,
"timeout": 30.0
},
"status": "completed",
"description": "卖出义务仓: 10011350.SHO x 6",
},
{
"method_name": "make_option_combination",
"params": {
"combination_type": 50,
"contracts": {
"10011349.SHO": 48,
"10011350.SHO": 49
},
"quantity": 6,
"strategy_name": "认购牛市价差 1.4-1.45"
},
"status": "completed",
"description": "创建组合: 认购牛市价差 1.4-1.45",
}
]

Such instructions go into a message queue, consumed by a separate service that interacts directly with the trading system. Here, to fill as fast as possible, I place orders directly at the counterparty’s first level. STAR 50 ETF options themselves have decent liquidity — trades usually complete within seconds, with very small actual slippage; execution efficiency and quality are both fairly high.

Note: what’s used here is the counterparty’s first level — the price prioritizing immediate fill. If a contract’s liquidity is poor, doing this is very risky and the profit margin gets noticeably compressed.

Combination Order Management

AI code writing is really useful now. After requirements are clearly stated, page prototypes come out quickly; I then tie the frontend and backend together and tidy the details, and it can basically go live fast. Below is a screenshot of the combination order management page:

1774533798939.png

I also added “step-by-step retry” capability for errored orders. It doesn’t matter which step gets stuck — check manually, and once confirmed fine, continue from the next step. Later, adding AI for the checks would save even more effort. Even when there are many opening orders, this combination-order form allows batch processing — the operator’s manual workload for opening/closing positions becomes much smaller.

Spread Rolling

After finishing this combination-order set, I began thinking more systematically about one question: how much does it really cost to roll bull spreads between different months, and is rolling worth it? For example, if I hold a bull spread composed of OTM calls and the current month’s opportunity is already small, would rolling the whole combination forward one month improve the profit probability?

So I also made a chart continuously recording the prices of the spreads I watch across different months, to evaluate “how much rolling cost I need to pay to maintain profit opportunities”.

1774534300695.png

As long as the contract’s time value hasn’t been completely eaten, rolling costs are usually fairly low — in most cases within 100 yuan. That is to say, for no more than 100 yuan you can usually roll a near-expiry spread combination to the next month, or switch to a lower strike, thereby clearly improving the profit probability. Adding the single-leg options that can later be sold, this cost isn’t high, yet the improvement to win rate and returns is obvious.

Order Records

Stock trading order records are relatively simple, because frequency is low. But options differ — dozens of orders a day is not an exaggeration. So I wanted to “calendarize” orders, convenient for later analysis of trading habits and monthly P&L. Thus I also made an order record page, directly persisting every order’s details.

1774534653930.png

Green blocks indicate trading days. Click into any day to see all that day’s orders and statuses — trading habits become very intuitive this way.

Summary and Outlook

I’ve always viewed options as a tool for “working for the market”. As long as you’re willing to do risk-controllable arbitrage, there’s a chance to earn continuously and steadily in this market. This differs from stocks, where you often must bear systemic risk and single-stock risk simultaneously.

The combination-order feature introduced in this article is essentially for executing spread strategies and rolling operations more efficiently, letting me “work and earn in the market” more steadily. You can also see that most of my options operations don’t rely on directional prediction. If the market moves as expected I earn more; if not, things don’t spiral out of control — I still retain the right to continue operating next month.

Also, my goal in doing these things is clear: standardize the operation flow, and finally hand it to other people or AI to execute.