Skip to content

Commit

Permalink
fix for mutli-data stream singals
Browse files Browse the repository at this point in the history
  • Loading branch information
NVentimiglia committed May 11, 2021
1 parent 14b5fc3 commit d0625cf
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions TDAmeritrade/Utilities/TDStreamJsonProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,36 @@ public void Parse(string json)
}
else if (job.ContainsKey("data"))
{
var service = job["data"].First.First.First.Value<string>();
var content = job["data"].First.Last.First.First as JObject;
var tmstamp = job["data"].First["timestamp"].Value<long>();
var data = job["data"] as JArray;
foreach (var item in data)
{
var service = item.First.First.Value<string>();
var content = item.Last.First.First as JObject;
var tmstamp = item["timestamp"].Value<long>();

if (content == null)
return;
if (content == null)
return;

if (service == "QUOTE")
{
ParseQuote(tmstamp, content);
}
else if (service == "CHART_FUTURES")
{
ParseChartFutures(tmstamp, content);
}
else if (service == "CHART_EQUITY")
{
ParseChartEquity(tmstamp, content);
}
else if (service == "LISTED_BOOK" || service == "NASDAQ_BOOK" || service == "OPTIONS_BOOK")
{
ParseBook(tmstamp, content, service);
}
else if (service == "TIMESALE_EQUITY" || service == "TIMESALE_FUTURES" || service == "TIMESALE_FOREX" || service == "TIMESALE_OPTIONS")
{
ParseTimeSaleEquity(tmstamp, content);
if (service == "QUOTE")
{
ParseQuote(tmstamp, content);
}
else if (service == "CHART_FUTURES")
{
ParseChartFutures(tmstamp, content);
}
else if (service == "CHART_EQUITY")
{
ParseChartEquity(tmstamp, content);
}
else if (service == "LISTED_BOOK" || service == "NASDAQ_BOOK" || service == "OPTIONS_BOOK")
{
ParseBook(tmstamp, content, service);
}
else if (service == "TIMESALE_EQUITY" || service == "TIMESALE_FUTURES" || service == "TIMESALE_FOREX" || service == "TIMESALE_OPTIONS")
{
ParseTimeSaleEquity(tmstamp, content);
}
}
}
}
Expand Down

0 comments on commit d0625cf

Please sign in to comment.