Initiate a Streaming Provider / Redirection to Login
Author: mjj3
Creation Date: 10/14/2013 2:21 PM
profile picture

mjj3

#1
Hi - 2 questions,

1) I'm creating my own tool using the MenuItemHook and was wondering how I can initiate a streaming data provider?

2) I'm creating a new streaming data provider using Tradestation data now that they have a webapi for accessing the data. (see http://tradestation.github.io/webapi-docs/en/getting-started/overview/#). The authentication requires redirecting to web page to login. I'm trying to figure out the best way to incorporate that into the wealthlab. Any suggestions?
profile picture

Eugene

#2
1. Why do you think you have to initiate a streaming provider? If you can tell us more, maybe it's not required or there's a different way.

2. Usually when authentication requires redirecting to web page to login, it means that a cookie is stored. As I'm not familiar with the WebAPI, can you confirm it's true and possibly provide more details? Because your link above only mentions token-based authentication, not redirection.

However, if it's true, you'll find a working example in Community Components:

CODE:
Please log in to see this code.
from ../Classes/Sentiment.cs. This class parses Google signup web form, redirects to another page to log in to Google account, and stores received authentication cookie in a static class.

This is how you avoid redirecting to a web page to login. For best convenience, serialize your login/password to a disk file and input them using a Data Manager tab as instructed here:

Create a Data Manager tab for your data provider using ExtendedBehaviors

You'll need a static provider for that, but if you only require streaming provider, then you can make the static one a hidden dummy. Look for a working example of ExtendedBehaviors in Google provider solution.
profile picture

mjj3

#3
Thanks Eugene. One of the first projects that a streaming provider would be useful was a quote tool (similar to RadarScreen if you are familiar with TradeStation). If not, it is a quote tool that allows you to add indicators to the grid. (There are other usages but I thought I would start with something simple).

Authentication does store a cookie as well as a security token that expires after a set period of time and needs to be refreshed. The API is a bit rigorous as it gives access to steaming data as well as account and order info on tradestation.
profile picture

Eugene

#4
QUOTE:
One of the first projects that a streaming provider would be useful was a quote tool (similar to RadarScreen if you are familiar with TradeStation).


1. I still don't see the point of initiating a streaming provider here. You'll be creating a streaming data receiver class anyway, so subscribe to its streaming update events in your tool. That simple.
profile picture

mjj3

#5
Sounds good. Is there an alternative other than a streaming provider? Perhaps a class that just sends an event at the end of a new bar? That would work as well and be more efficient.
profile picture

Eugene

#6
Well, for the purpose of applying indicators inside a RadarScreen analogue you would not need a streaming provider - rather a static provider. Not all indicators support partial bar updates, and you need static data to make Wealth-Lab calculate indicators.

I'm not sure if there is an unsupported Wealth-Lab class that sends such event, but you could create one yourself. Assuming your static provider keeps its data in BarDataStore, it would be trivial to loop through it, finding the necessary DataSet, periodically monitoring the data for updates, and firing an event when a new bar appears. If you pull the data from TS w/o storing it in .WL files, the process remains the same - just without the BarDataStore.