Hi I am interested in augmenting some of my strategies with the capability to interact with web pages from Fidelity. One example would be to enter an option name into a quote window and receive the values.
Can you please tell me the best envirnment in your opinion to do this work? The language usedwould be C#.
Thanks and Regards,
Size:
Color:
Receiving values and parsing results is quite typical, just see our Wealth-Lab 5 Wiki - Knowledge Base section.
Submitting data e.g. entering an option name, is somewhat more complex, but you should be able to interact with web pages using the WebRequest class:
How to: Send Data Using the WebRequest ClassWebRequest Class > Post data to a server
For more code examples and tutorials, google for
C# WebRequest POST.
Size:
Color:
Hi, thanks for the tips. I wrote the following code borrowing from the pointers you provided. The first part succeeds i.e. in the debug window I can see the Yahoo finance page. However, the second part gives a run time error. Can you please see what the error is? Many Thanks and Regards!
CODE:
Please log in to see this code.
// Here is the error message from WL:
// Runtime error: This property cannot be set after writing has started
// at WealthLab.Strategies.MyStrategy.Execute()
// at System.Net.HttpWebRequest.set_ContentLength(Int64 value)
Size:
Color:
Let's start with answering "what for" i.e. what's the task of the 2nd part?
Size:
Color:
The first part accesses http://finance.yahoo.com. Calling this page puts the Yahoo server in the correct state (I think) to received the quote request in the second part.
The second part sends "/q?^spx" to get a quote on the S&P composite. If a browser was used, the user would have entered ^SPX in the quote box on the Yahoo finance front page.
The goal is accomplished if the page carrying the quote arrives at the client.
Thanks,
Size:
Color:
Hmm. Is there a point to partially replicate the Quotes window functionality? Did you mean to use Wealth-Lab to open up a browser window to display a snapshot quote? If so, I'd suggest a better way:
1. Community.Components > Input - an interactive window to input a ticker
2. Use a specially formatted request URI to get the most current quote for the entered symbol, greatly simplifying the task -- example:
http://download.finance.yahoo.com/d/quotes.csv?s=^SPX&f=nl13. Community.Components > Commentary Window
Size:
Color:
Thanks. It seems that this prescription creates an input window (1) for the user to make an entry and after obtaining the result (2) it creates a display window (3). Step (1) would be useful to enter an option ticker at the beginning of the day. Step (3) would be useful to continually display results. I will use both sample programs at the Wiki site.
However, there still remains the question of having multiple interactions with a web site. The single line in (2) would not quite solve my problem. Ideally, this is what I would like to accomplish (as one example) with a strategy:
a) login to my account at fidelity by presenting my Credentials
b) enter a ticker at a quote window
c) keep repeating this quote and comparing it to some indicators
d) open a trade form when an event happens
e) fill out the trade form and submit it
During the course of this strategy there will be multiple interactions with the Fido web site.
It seems that I am having a problem between two accesses. If this issue can be resolved then I can have multiple accesses.
Thanks,
Hal
Size:
Color:
Hal,
I don't have a solution for this. Firstly, note that Wealth-Lab's strategy execution model isn't meant for "interaction with a...". A Strategy is executed once every bar. There's no room for multiple interactions for a given bar. Having said that, I fail to see how Step (3) could be useful to continually display results. and what does the Welath-Lab Strategy element has to do with the web page interaction - it all seems quite discretionary.
Size:
Color: