New issue 508 by frantajosh: barlisttracker throws an exception when
accessing a bar from GotNewBar
http://code.google.com/p/tradelink/issues/detail?id=508
public class BLTExcept : ResponseTemplate
{
BarListTracker _blt = new BarListTracker(new BarInterval[] {
BarInterval.Hour });
public Tops()
{
Indicators = new string[] { "Time", "Price", "dx", "d2x" };
}
void _blt_GotNewBar(string symbol, int interval)
{
// this is throwing an exception, should never happen
Bar bar = _blt[symbol, interval].RecentBar;
}
public override void GotTick(Tick k)
{
_blt.newTick(k);
}
public override void Reset()
{
_blt = new BarListTracker(new BarInterval[] {
BarInterval.Hour});
_blt.GotNewBar += new SymBarIntervalDelegate(_blt_GotNewBar);
}
}
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
this has partly to do with requesting a barlist from tracker which already
exists,
see line 92 :
public BarList this[string sym, int interval]
{
get
{
BarListImpl bl;
if (_bdict.TryGetValue(sym, out bl))
return (BarList)bl;
bl = new BarListImpl(sym, _requested, _reqtype);
bl.DefaultCustomInterval = interval;
bl.GotNewBar += new SymBarIntervalDelegate(bl_GotNewBar);
_bdict.Add(sym, bl);
return bl;
}
}
this :
if (_bdict.TryGetValue(sym, out bl))
return (BarList)bl;
should instead be :
if (_bdict.TryGet())
{
bl.DefaultCustomInterval = interval
}
it's defaulting to 300 which if it isn't present, is messing up several
things.