AlgoTraderAlgoTrader Documentation

Chapter 16. Forex Handling

16.1. Currency Handling
16.1.1. Futures
16.1.2. Forex
16.1.3. Currency Attribution
16.2. Forex-Hedging
16.2.1. Virtual FX Positions (IB only)
16.2.2. FX Future

The System provides full Forex and Currency Exchange Management. FX Rates can be retrieved in real-time. All portfolio figures are calculated based on up-to-date FX-Rates.

FX conversion is provided through the MarketDataService. When subscribing for a non-base currency instrument the system will automatically subscribe the Forex instrument necessary to convert the non-base currency balance (e.g. realized PnL and market value) into the base currency. In some cases multiple Forex / Currency Pairs are available in the system which are traded through different brokers / venues. For those cases one of those instruments needs to have the default_forex column set to true so that the system knows which instrument to subscribe for base currency conversion. Automatic subscriptions for Default Forex will always use the default Feed Type defined through VM argument:

-Dmisc.defaultFeedType=CNG 

In most cases securities are attributed in their currency (as defined by SecurityFamily). Their market value is attributed towards Market Value.

There are however the following exceptions.

The system provides automatic Forex-Hedging by the Service ch.algotrader.service.ForexService. This service will maintain multiple FX Positions to hedge all non base currency balances. For actual Forex-Hedging the following two options exist