Lean  $LEAN_TAG$
QuantConnect.Util.CurrencyPairUtil Class Reference

Utility methods for decomposing and comparing currency pairs More...

Public Types

enum  Match { Match.NoMatch, Match.ExactMatch, Match.InverseMatch }
 Represents the relation between two currency pairs More...
 

Static Public Member Functions

static bool TryDecomposeCurrencyPair (Symbol currencyPair, out string baseCurrency, out string quoteCurrency)
 Tries to decomposes the specified currency pair into a base and quote currency provided as out parameters More...
 
static void DecomposeCurrencyPair (Symbol currencyPair, out string baseCurrency, out string quoteCurrency, string defaultQuoteCurrency=Currencies.USD)
 Decomposes the specified currency pair into a base and quote currency provided as out parameters More...
 
static bool IsForexDecomposable (string currencyPair)
 Checks whether a symbol is decomposable into a base and a quote currency More...
 
static bool IsDecomposable (Symbol currencyPair)
 Checks whether a symbol is decomposable into a base and a quote currency More...
 
static string CurrencyPairDual (this Symbol currencyPair, string knownSymbol)
 You have currencyPair AB and one known symbol (A or B). This function returns the other symbol (B or A). More...
 
static string CurrencyPairDual (string baseCurrency, string quoteCurrency, string knownSymbol)
 You have currencyPair AB and one known symbol (A or B). This function returns the other symbol (B or A). More...
 
static Match ComparePair (this Symbol pairA, string baseCurrencyB, string quoteCurrencyB)
 Returns how two currency pairs are related to each other More...
 
static bool IsValidSecurityType (SecurityType? securityType, bool throwException)
 

Detailed Description

Utility methods for decomposing and comparing currency pairs

Definition at line 27 of file CurrencyPairUtil.cs.

Member Enumeration Documentation

◆ Match

Represents the relation between two currency pairs

Enumerator
NoMatch 

The two currency pairs don't match each other normally nor when one is reversed

ExactMatch 

The two currency pairs match each other exactly

InverseMatch 

The two currency pairs are the inverse of each other

Definition at line 178 of file CurrencyPairUtil.cs.

Member Function Documentation

◆ TryDecomposeCurrencyPair()

static bool QuantConnect.Util.CurrencyPairUtil.TryDecomposeCurrencyPair ( Symbol  currencyPair,
out string  baseCurrency,
out string  quoteCurrency 
)
static

Tries to decomposes the specified currency pair into a base and quote currency provided as out parameters

Parameters
currencyPairThe input currency pair to be decomposed
baseCurrencyThe output base currency
quoteCurrencyThe output quote currency
Returns
True if was able to decompose the currency pair

Definition at line 39 of file CurrencyPairUtil.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecomposeCurrencyPair()

static void QuantConnect.Util.CurrencyPairUtil.DecomposeCurrencyPair ( Symbol  currencyPair,
out string  baseCurrency,
out string  quoteCurrency,
string  defaultQuoteCurrency = Currencies.USD 
)
static

Decomposes the specified currency pair into a base and quote currency provided as out parameters

Parameters
currencyPairThe input currency pair to be decomposed
baseCurrencyThe output base currency
quoteCurrencyThe output quote currency
defaultQuoteCurrencyOptionally can provide a default quote currency

Definition at line 69 of file CurrencyPairUtil.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsForexDecomposable()

static bool QuantConnect.Util.CurrencyPairUtil.IsForexDecomposable ( string  currencyPair)
static

Checks whether a symbol is decomposable into a base and a quote currency

Parameters
currencyPairThe pair to check for
Returns
True if the pair can be decomposed into base and quote currencies, false if not

Definition at line 101 of file CurrencyPairUtil.cs.

Here is the caller graph for this function:

◆ IsDecomposable()

static bool QuantConnect.Util.CurrencyPairUtil.IsDecomposable ( Symbol  currencyPair)
static

Checks whether a symbol is decomposable into a base and a quote currency

Parameters
currencyPairThe pair to check for
Returns
True if the pair can be decomposed into base and quote currencies, false if not

Definition at line 111 of file CurrencyPairUtil.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CurrencyPairDual() [1/2]

static string QuantConnect.Util.CurrencyPairUtil.CurrencyPairDual ( this Symbol  currencyPair,
string  knownSymbol 
)
static

You have currencyPair AB and one known symbol (A or B). This function returns the other symbol (B or A).

Parameters
currencyPairCurrency pair AB
knownSymbolKnown part of the currencyPair (either A or B)
Returns
The other part of currencyPair (either B or A), or null if known symbol is not part of currencyPair

Definition at line 143 of file CurrencyPairUtil.cs.

Here is the call graph for this function:

◆ CurrencyPairDual() [2/2]

static string QuantConnect.Util.CurrencyPairUtil.CurrencyPairDual ( string  baseCurrency,
string  quoteCurrency,
string  knownSymbol 
)
static

You have currencyPair AB and one known symbol (A or B). This function returns the other symbol (B or A).

Parameters
baseCurrencyThe base currency of the currency pair
quoteCurrencyThe quote currency of the currency pair
knownSymbolKnown part of the currencyPair (either A or B)
Returns
The other part of currencyPair (either B or A), or null if known symbol is not part of the currency pair

Definition at line 160 of file CurrencyPairUtil.cs.

◆ ComparePair()

static Match QuantConnect.Util.CurrencyPairUtil.ComparePair ( this Symbol  pairA,
string  baseCurrencyB,
string  quoteCurrencyB 
)
static

Returns how two currency pairs are related to each other

Parameters
pairAThe first pair
baseCurrencyBThe base currency of the second pair
quoteCurrencyBThe quote currency of the second pair
Returns
The Match member that represents the relation between the two pairs

Definition at line 203 of file CurrencyPairUtil.cs.

Here is the call graph for this function:

The documentation for this class was generated from the following file: