Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FX and Crypto Trading
#1
FX and Crypto Trading
This guide explains how to trade FX and Crypto with APM. We will refer to both FX and Crypto trading as Currency Trading from here on out.
Available with APM version 3.0.0+

You should be familiar with APM before reading this guide.

How Currency Pairs are Represented
Our goal was to make Currency trading as similar to stock trading as possible, so that you can enjoy all the same features as with stocks. The main idea here is that for an Currency trading strategy, you choose a base currency to trade in, where any currency you trade will be paired with the base currency. For example, you might choose USD as the base currency for your strategy and trade CAD, GBP, and EUR on that strategy. This means you would be trading CAD-USD, GBP-USD, and EUR-USD pairs. Note that some exchanges/brokers use a different convention and call this the "quote" currency, while calling the left currency in the pair the "base" currency.

You should also note that even though your broker might only support the CAD-USD pair (in that order), APM allows you trade both CAD-USD and USD-CAD by automatically converting to the pair supported by your broker. This means that when you view your portfolio for a strategy, you will see all the pairs in the same direction (i.e. XXX-USD when USD is the base currency).

Also note that when you select a base currency for a strategy, that currency can no longer be traded by any other strategy.

Currency Signals
Behavior is very similar to stock signals. Your signals must only contain the non-base pair. i.e., if your base currency is USD, and you want to trade CAD-USD, then the ticker in your signal must be CAD (not CAD-USD).

Also, the unit types are slightly different. Instead of DOLLARS/$ and SHARES, you should use PRIMARY and the currency name itself, respectively. The other unit types remain the same.

# instead of BTO USD 10000 SHARES DAY                       
BTO USD 10000 USD DAY 

# instead of BTO USD 500 $   
BTO USD 500 PRIMARY
         
# other examples
BTO BTC 5 BTC LMT 9000 GTC    # bitcion
LONG USD 10 %PORTFOLIO MKT

Quantity and Price Precision
Since it's possible to purchase fractional quantities with currencies, each currency trading pair has its own unique min tick size designated by the broker. Since the pairs we are trading are fixed, e.g. we can BTC-USD (and not USD-BTC), there is a precision specified on the quantity of BTC (8 decimal places) and a precision specified on price in USD (2 decimal places). You can view both the quantity and price precision for each trading pair in the currency info tab in your account settings (when you are connected to your broker).

Min Currency Quantities for Positions
In Currency trading, it is often not possible to completely close your position in a currency (i.e. it's hard to make your position exactly 0). However, when you close your position, APM will consider your position neutral if the final balance is small enough. For Crypto trading, this threshold is when your position is less than $1 USD. For FX trading in IB, this threshold is when your position is less than $50 USD.

Note that sometimes in IB, a close order may not be able to shrink a position past this $50 threshold. This is rare, but when it does happen, you will have to enter another CLOSE or close the position manually in order to free up the ticker from the strategy.

Brokers
Interactive Brokers
  • You can use the same IB gateway as for stock trading, just make sure the client IDs are different in APM if you want to trade both stocks and FX at the same time. By default stock trading has client ID 0 and FX has client ID 1.
  • Base currencies: USD, AUD, EUR, GBP, CAD

Binance and Binance US
  • Only non-margin trading as of now
  • STPLMT and LIT orders are converted to LMT orders if the target price is already met. Otherwise, Binance rejects these orders if we leave them as STPLMT/LIT
  • Alera STP and TGT orders cannot both be in the market at the same time because of margin restrictions. To resolve this, APM will swap between STP and TGT orders depending on which is closer to being executed.
  • No fee for cancelling orders, so we can get around any potential problems caused by the above points by internally managing orders
  • Base currencies: USD (only Binance US), EUR (only Binance), USDT, BTC
Reply
#2
(08-28-2020, 01:36 PM)I am looking at using Alera for Binance but I have systems with different base currencies. USDT, BTC Bnb. Can I have a different base currency for each system or is the base currency set at the account level?admin Wrote: FX and Crypto Trading
This guide explains how to trade FX and Crypto with APM. We will refer to both FX and Crypto trading as Currency Trading from here on out.
QL Available with APM version 3.0.0+

You should be familiar with APM before reading this guide.

How Currency Pairs are Represented
Our goal was to make Currency trading as similar to stock trading as possible, so that you can enjoy all the same features as with stocks. The main idea here is that for an Currency trading strategy, you choose a base currency to trade in, where any currency you trade will be paired with the base currency. For example, you might choose USD as the base currency for your strategy and trade CAD, GBP, and EUR on that strategy. This means you would be trading CAD-USD, GBP-USD, and EUR-USD pairs. Note that some exchanges/brokers use a different convention and call this the "quote" currency, while calling the left currency in the pair the "base" currency.

You should also note that even though your broker might only support the CAD-USD pair (in that order), APM allows you trade both CAD-USD and USD-CAD by automatically converting to the pair supported by your broker. This means that when you view your portfolio for a strategy, you will see all the pairs in the same direction (i.e. XXX-USD when USD is the base currency).

Also note that when you select a base currency for a strategy, that currency can no longer be traded by any other strategy.

Currency Signals
Behavior is very similar to stock signals. Your signals must only contain the non-base pair. i.e., if your base currency is USD, and you want to trade CAD-USD, then the ticker in your signal must be CAD (not CAD-USD).

Also, the unit types are slightly different. Instead of DOLLARS/$ and SHARES, you should use PRIMARY and the currency name itself, respectively. The other unit types remain the same.

# instead of BTO USD 10000 SHARES DAY                       
BTO USD 10000 USD DAY 

# instead of BTO USD 500 $   
BTO USD 500 PRIMARY
         
# other examples
BTO BTC 5 BTC LMT 9000 GTC    # bitcion
LONG USD 10 %PORTFOLIO MKT

Quantity and Price Precision
Since it's possible to purchase fractional quantities with currencies, each currency trading pair has its own unique min tick size designated by the broker. Since the pairs we are trading are fixed, e.g. we can BTC-USD (and not USD-BTC), there is a precision specified on the quantity of BTC (8 decimal places) and a precision specified on price in USD (2 decimal places). You can view both the quantity and price precision for each trading pair in the currency info tab in your account settings (when you are connected to your broker).

Min Currency Quantities for Positions
In Currency trading, it is often not possible to completely close your position in a currency (i.e. it's hard to make your position exactly 0). However, when you close your position, APM will consider your position neutral if the final balance is small enough. For Crypto trading, this threshold is when your position is less than $1 USD. For FX trading in IB, this threshold is when your position is less than $50 USD.

Note that sometimes in IB, a close order may not be able to shrink a position past this $50 threshold. This is rare, but when it does happen, you will have to enter another CLOSE or close the position manually in order to free up the ticker from the strategy.

Brokers
Interactive Brokers
  • You can use the same IB gateway as for stock trading, just make sure the client IDs are different in APM if you want to trade both stocks and FX at the same time. By default stock trading has client ID 0 and FX has client ID 1.
  • Base currencies: USD, AUD, EUR, GBP, CAD

Binance and Binance US
  • Only non-margin trading as of now
  • STPLMT and LIT orders are converted to LMT orders if the target price is already met. Otherwise, Binance rejects these orders if we leave them as STPLMT/LIT
  • Alera STP and TGT orders cannot both be in the market at the same time because of margin restrictions. To resolve this, APM will swap between STP and TGT orders depending on which is closer to being executed.
  • No fee for cancelling orders, so we can get around any potential problems caused by the above points by internally managing orders
  • Base currencies: USD (only Binance US), EUR (only Binance), USDT, BTC
Reply
#3
Yes you can have a different base currency for each system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)