Hedge Arbitrage: Difference between revisions

From SharpTrader Arbitrage Software Wiki: A Detailed Overview of High-Speed Trading Technology
Jump to navigation Jump to search
Formatting cleanup: section headings, parameter definition lists, whitespace
Formatting cleanup: fix section headings
Line 9: Line 9:
[[File:H.png|center|frameless|912x912px]]
[[File:H.png|center|frameless|912x912px]]


== Hedge strategy instruments and orders tab ==
== Instruments and orders tab ==


[[File:H2.png|center|frameless|824x824px]]
[[File:H2.png|center|frameless|824x824px]]
Line 101: Line 101:
: size of the order that will be used for trading.
: size of the order that will be used for trading.


== There are some differences in lot sizing depending on account type ==
== Lot sizing by account type ==
 
There are some differences in lot sizing depending on account type:


== FIX API accounts ==
== FIX API accounts ==

Revision as of 19:48, 21 October 2026

Hedge Arbitrage Strategy trading strategy is based on the latency difference and quote difference between liquidity providers across two different brokers or сrypto exchanges.

How it works

It compares prices between two exchanges/brokers and after an arbitrage difference detected (open difference) strategy opens 2 opposite orders, buy and sell (buy order on the exchange/broker with the lower price, sell order on the exchange/broker with the higher price), at the same time. After that it waits for the opposite price difference (close difference) when price on the broker/exchange with the sell order is now lower that on the broker/exchange with the buy order) and closes both positions. Then it is looking for new opening difference and starts the cycle it over.

Hedge arbitrage simplified working scheme

Instruments and orders tab

Description of parameters

Enabled
enables or disables trading on a selected instrument.
Offset Calc
allows to enable automatic offset calculation.
Label
allows to assign label to strategy.
Symbol 1
symbol name on side 1.
Symbol 2
symbol name on side 2.
Lots 1
lot size to be traded on side 1.
Lots 2
lot size to be traded on side 2.
Diff to open
price difference (can be expessed in points, currency or percents) between 2 brokers/exchanges for opening arbitrage deal
Diff to close
price difference (can be expessed in points, currency or percents) between 2 brokers/exchanges for closing arbitrage deal
Slippage 1
max allowed deviation from the price order is sent at for side 1. If price goes beyond allowed deviation order gets reject or requote. Works only for instant execution accounts and limit orders on FIX API accounts. For market execution accounts it has no effect.
Slippage 2
max allowed deviation from the price order is sent at for side 2.
Max Spread 1
maximum allowed spread for side 1. If actual spread is higher than Max spread 1 value, arbitrage signals are ignored.
Max Spread 2
maximum allowed spread for side 2. If actual spread is higher than Max spread 2 value, arbitrage signals are ignored.
Min Spread 1
minimal allowed spread for side 1. If actual spread is lower than Min spread 1 value, arbitrage signals are ignored.
Min Spread 2
minimal allowed spread for side 2. If actual spread is lower than Min spread 1 value, arbitrage signals are ignored.
Offset
constant shift between prices on both sides (in points).
Curr Diff 1
displays current difference between brokers/exchanges for side 1.
Curr Diff 2
displays current difference between brokers/exchanges for side 2.
Max Diff 1
displays maximum detected difference (after the software restart or parameter reset) between brokers/exchanges for side 1.
Max Diff 2
displays maximum detected difference (after the software restart or parameter reset) between brokers/exchanges for side 2.
Curr Spread 1
current spread on side 1 (in points).
Curr Spread 2
current spread on side 2 (in points).
By right clicking in on pair in hedging pair section you can open arbitrage pair management menu:

Hedging pair

Edit
open hedging pair properties window for editing.
Clone
clone selected hedging pair.
Add
add new hedging pair.
Remove
remove selected hedging pair.
Unblock
unblock selected hedging pair if is was blocked due to errors.
Close deal by market
manually close deal on selected pair by market price.
Open deal manually
allows to open deal manually.
Edit open close levels (crypto)
allows to set several diff to open/close levels for hedging pair.
Multi-level diff to open allows not to miss arbitrage situation if price difference between exchanges increased after opening first arb deal.
Reset max diff
reset max diff values for selected pair
Reset (un) profitable deals counter
reset profit indicator for selected pair.
Profit indicator uses a range of color shades from bright green (positive performance) to bright red (negative performance) for visual indication how profitable hedging pair is.
Record statistics
opens statistics recorder option window.

Hedging pair properties window

Parameters list

Symbol
alows to select symbol from the session symbols list (only symbols that are activated in Symbols tab of the session are displayed in the dropdown list).
Lots
size of the order that will be used for trading.

Lot sizing by account type

There are some differences in lot sizing depending on account type:

FIX API accounts

For all FIX API accounts except Lmax full lot sizes for currencies are used without multiplier, i.e. 1000 (=0.01 in mt4), 10000, 100000 etc.; for indexes/commodities lots sizes depend on contract size, we recommend to check broker contract specifications before setting lot sizes.

Lmax FIX API accounts

For Lmax FIX API accounts lot sizes are used with multiplier 10, i.e. 0.1 (=0.01 in mt4), 1, 10 etc.; for indexes/commodities lots sizes are 1, 2...10 etc.

Crypto exchanges

On most crypto exchanges Lot size represents 1 unit of base currency. For BTC pairs base currency is BTC, for ETH pairs - ETH  etc. So 1 lot= 1 BTC or 1 ETH or 1 LTC depending on particular pair. On some of them it represents contracts.

Slippage open
maximum allowed slippage for opening orders (works for limit orders), if actual slippage is higher than allowed orders is rejected.
Slippage close
maximum allowed slippage for closing orders (works for limit orders), if actual slippage is higher than allowed orders is rejected.
Spread control
allows to set number of previous ticks for spread control.
Allow buy
allow buy orders for the selected side
Allow sell
allow sell orders for the selected side
Check Qty
check if there enough liquidity in TOB Top of the book to fill an order with the specified lot size, if not, arbitrage situation is ignored.
Virtual
open virtual order instead of real one on the selected side. Allows to use the software in 1-leg mode. Imrortant!!! Open and close methods should be set as open both/close both for this option to work properly.
Order management
calls trailing parameters management window for the selected side.
Trailing options window will appear only when editing existing hedging pair, you can't adjust these parameters when adding a new hedging pair.
Open Leverage
allows to set leverage for opening deal, used for crypto exchanges only.
Close Leverage
allows to set leverage for closing deal, used for crypto exchanges only.
0 – leverage trading disabled
1 – leverage trading enabled
On some exchanges actual leverage value can be set
Comment
allows to put comment for trade

Common parameters

Diff to open
price difference (can be expessed in points, currency or percents) between 2 brokers/exchanges for opening arb deal
Diff to close
price difference (can be expessed in points, currency or percents) between 2 brokers/exchanges for closing arb deal
Max diff to open
maximum difference allowed for opening arb deal. If actual difference is higher than allowed arbitrage situation will be ignored.
Max diff to close
maximum difference allowed for closing arb deal
Min profit
minimum distance in pips from entry point price should cover for diff to close parameters to come into effect (for crypto arbitrage can be set to 0)
Max profit
if one of the sides reaches Max Profit value, arbitrage deal will be closed automatically to prevent margin calls.
Offset
constant shift between prices on both sides
Max dev o
These parameters refer to offset caclulation, they allow to set max allowed offset deviation from 'Diff to open' value for opening deal. If offset change is higher than allowed by the parameters multileg/DAAS hedge will ignore arb signals.
Max dev c
same as above for closing deal.
Reverse open
open orders in opposite direction to arbitrage trigger on opening, i.e. sell low and buy high.
Reverse close
open orders in opposite direction to arbitrage trigger on closing, i.e. sell low and buy high.
Check direction
if more than 1 deal per pair is allowed it check sdirection of the first deal and opens subsequent one in the same direction.
Max accum. number of lots
maximum number of lots for 1 or several simultaneous deals allowed for hedging pair.
Max accum. number of deals
maximum number of simultaneous deals allowed for hedging pair. By default it is 1 deal per pair.
Emulator mode
allows to emulate trading in real time mode. Software will open virtual deals based on real price feed from brokers/exchanges.
Enabled
run hedging pair in emulation mode.
Slip.open 1
slippage to be added when opening virtual deal on side 1
Slip.open 2
slippage to be added when opening virtual deal on side 2
Slip.close 1
slippage to be added when closing virtual deal on side 1
Slip.close 2
slippage to be added when closing virtual deal on side 2
Profit (diff) calcualtion mode
allows to set profit display and calcualtion mode
Commission 1(%)
commission per trade charged by broker/exchnage on side 1 to be included in arb deal result calculation.
Commission 2(%)
commission per trade charged by broker/exchnage on side 2 to be included in arb deal result calculation.
Commissions can be set in points or percents, depending on selected profit mode.

Important!!! Commissions are charged twice per arbitrage round (for opening arbitrage deal and for closing arbitrage deal) on each side (4 commissions in total).

Profit mode

Points – profit will be displayed in points

Currency – profit will be displayed in currency

Currency field – allows to set base currency in which profit will be displayed for hedging pair

Diff input
price differences calculation mode (applied to diff to open/to close, curr diff 1,2 and max diff 1,2)
Points – difference will be calculated in points
Currency – difference will be calculated in currency
Percents – difference will be calculated in percents
Slipp. input
allows to select slippage calculation mode.
Points – slippage will be displayed in points
Percents – slippage will be displayed in percents
Current difference calculation formulas depend on selected diff input mode:

Diff input in points

hedgingPair.CurrDiff1 = (Bid1 - Ask2 - offset_in_pips) / Math.Min(Symbol1.PointValue, Symbol2.PointValue);

hedgingPair.CurrDiff2 = (Bid2 - Ask1 + offset_in_pips) / Math.Min(Symbol1.PointValue, Symbol2.PointValue);

Diff input in currency

hedgingPair.CurrDiff1 = (Bid1 hedgingPair.Lots1 - 0.01 Bid1 hedgingPair.Lots1*hedgingPair.TradeComission1 - Ask2*hedgingPair.Lots2 - 0.01 Ask2 * hedgingPair.Lots2*hedgingPair.TradeComission2);

hedgingPair.CurrDiff2 = (Bid2 hedgingPair.Lots2 - 0.01 Bid2 hedgingPair.Lots2 hedgingPair.TradeComission1 - Ask1 hedgingPair.Lots1 - 0.01 Ask1 hedgingPair.Lots1 hedgingPair.TradeComission1);

Diff input in percents

hedgingPair.CurrDiff1 = 100 * (Bid1 - Ask2 - offset_in_pips) / Math.Max(Bid1,Ask2);

hedgingPair.CurrDiff2 = 100 * (Bid2 - Ask1 + offset_in_pips) / Math.Max(Bid2, Ask1);

Open/close diff table
allows to apply different open/close differences for specified time frames during the day
Add
add new rule
Edit
edit selected rule
Remove
remove rule
Start hour
start time for rule to be applied (server/machine local time is used)
End hour
stop time for rule to be applied (server/machine local time is used)
Diff to open
diff to open to be applied during specified period
Diff to close
diff to close to be applied during specified period
Dynamic close
the idea of dynamic close feature, but calculate close difference dynamically depending on the profit you want to get for the deal instead of using fixed diff to close specified in pair properties.
Enabled
apply dynamic close feature for this pair
Profit target in currency
profit you want to get from the arbitrage deal (can be dispayed in points or currency depending on selected profit mode).
Open diff (approx)
approximate diff to open to be entered to get target profit
Close diff (approx)
approximate diff to close to be entered to get target profit
Trade Only Available Qty
Checks TOB on both brokers/exchanges and if there is not enough liquidity to open deals with lots specified software opens trades with max available on both sides amounts. For example if you set it to trade with lot 1, but one of the brokers/exchanges has insufficient liquidity in TOB, let's say 0.5 lot, software will open trades with 0.5 lot size on both exchanges.
Allow close if disabled
allows closing hedging trades if pair is disabled but there are hedging trades left.
Close multiply deals
close all deals on diff to close trigger (if more than 1 arbitrage deal per pair allowed), if disabled only last deal will be closed.
Show profit indicator
enables/disables profit indicator for this hedging pair.
Offset recalculation
enables automatic offset calculation.
Offset group
assign offset group pair belongs to (can be selected fro dropdown menu). To remove group association just erase the value
Label
allows to assign label to strategy. Used for sorting hedging pairs in the hedging pair section. Each time on the software start pairs are sorted by label names in alphabetical order.