FX Carry Trade Strategy (Python). StockSharp

Author: StockSharp
N: 2019
v5.0.0 (6/5/2026)
Downloads: 561

This currency strategy ranks a universe of currency instruments by the interest rate differential between the base and quote currencies. At the start of each month it goes long the [b]TopK[/b] highest‑carry symbols and shorts the [b]TopK[/b] lowest. Profits aim to capture positive carry on longs while paying the negative carry on shorts. Interest rate differentials are gathered from each security’s yield data. Positions are sized equally and rebalanced monthly; any instrument leaving the top or bottom groups is closed and replaced. [list] [][b]Entry Criteria[/b]: [list] []On the first trading day of the month, compute the interest rate differential for each currency. []Go long the [b]TopK[/b] currencies with the highest carry and short the [b]TopK[/b] with the lowest carry if order values exceed [b]MinTradeUsd[/b]. [/list] [][b]Long/Short[/b]: Long top carry, short bottom carry. [][b]Exit Criteria[/b]: Positions are closed when a currency leaves the selected sets at the next rebalance. [][b]Stops[/b]: None. [][b]Default Values[/b]: [list] [][b]Universe[/b] – list of currency securities. [][b]TopK[/b] = 3. [][b]CandleType[/b] = 1 day. [][b]MinTradeUsd[/b] – minimum trade value. [/list] [][b]Filters[/b]: [list] []Category: Carry. []Direction: Long & short. []Timeframe: Monthly. []Rebalance: Monthly. [/list] [/list]