Symbol USDCAD = MarketData.GetSymbol("CADUSD"); Return?
Symbol USDCAD = MarketData.GetSymbol("CADUSD"); Return?
24 Oct 2013, 20:43
That case where the GetSymbol method is called and the parameter is an invalid string (see title for example), what would the return be? null?
Replies
Hyperloop
25 Oct 2013, 22:13
Thanks for the help. I appreciate it. Coming from a Python/C background into C# so still getting used to this side of things. :)
@Hyperloop
Hyperloop
30 Oct 2013, 01:00
string CurrencyOne = "CAD"; string CurrencyTwo = "USD"; try { Symbol USDCAD = MarketData.GetSymbol(CurrencyOne + CurrencyTwo); Print("USDCAD {0}", USDCAD); } finally { Symbol USDCAD = MarketData.GetSymbol(CurrencyTwo + CurrencyOne); Print("USDCAD {0}", USDCAD); }
I am trying to make use of the try...finally block. Upon testing it, it seems like the finally block isn't executing. The above shows an example of what I am doing. Where am I going wrong?
Thanks. :)
@Hyperloop
fzlogic
25 Oct 2013, 16:56
RE:
Hyperloop said:
No, the method will crash:
Crashed in OnBar with ArgumentException: Symbol "CADUSD" does not exist
use try... catch block
@fzlogic