Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-19-2012, 10:13 PM   PM User | #1
ChrisTrader
New Coder

 
Join Date: Apr 2012
Posts: 34
Thanks: 11
Thanked 0 Times in 0 Posts
ChrisTrader is an unknown quantity at this point
Get stock symbol price

Hello

I'm looking to make my site a bit more dynamic with respect to its display. I have a section for which I share my trades. I'd like to have the real time price of the stock as well as the current p/l on each position display and calculate. Is this possible? the page that I'm looking to make more dynamic is http://stocksandstocks.com/index.php...g-results.html As I said before I would like to have the p/l change automatically instead of me having to place open as the entry. Right now this is just a simple table, but I'd like to tackle this. Can anyone point me in the right direction or have an example for which I may preview to ge me started. I really only know html well and I'd have to learn so please keep that in mind.

Thanks
Chris
ChrisTrader is offline   Reply With Quote
Old 04-19-2012, 10:48 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Real-time cannot actually be done in PHP at all (in the web world). Once its done with its request and delivered its response, there is no way to reuse the data. APC and sessions can be used to "remember" things though.
Semi-real time is certainly doable. I wouldn't even recommend pulling near real time data out either, although you could pull every say 5 - 30 seconds. Chances are you are using a service for this data, and if its soap the amount of data between the requests is actually pretty low.
To refresh, PHP can push a header for a Refresh meta. That is the only way PHP can do this in a web environment reliably; used to be you could flush buffered data, but since browsers tend to buffer nowadays, that doesn't really work like it used to.
AJAX, Flash or Java are what you want to use. All of these can be timed, can communicate with PHP (or straight to originating site), and can make updates appear seamless.
Fou-Lu is offline   Reply With Quote
Old 04-19-2012, 11:16 PM   PM User | #3
ChrisTrader
New Coder

 
Join Date: Apr 2012
Posts: 34
Thanks: 11
Thanked 0 Times in 0 Posts
ChrisTrader is an unknown quantity at this point
Thanks for the quick reply! Yeah I wasn't real sure on which code I needed to approach it with. You understand what I mean though. I thought maybe data could be grabbed from yahoo which would probably be the easiest way to do this. I just have no idea how to do it. Is there a way for me to move this to the appropriate category in the forum that you know of? I don't want to re post a duplicate.
ChrisTrader is offline   Reply With Quote
Old 04-19-2012, 11:42 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
I can move it to the JS forums.
More information would be better, how is this getting the data currently? That would likely be done from a server side language, although could be done from a client one (server side would let you log information as well, or compare, trend etc).
Fou-Lu is offline   Reply With Quote
Old 04-19-2012, 11:55 PM   PM User | #5
ChrisTrader
New Coder

 
Join Date: Apr 2012
Posts: 34
Thanks: 11
Thanked 0 Times in 0 Posts
ChrisTrader is an unknown quantity at this point
I simply enter the data manually. I like the control of that. These picks are specific to the site thus I am okay with entering the data manually.

Edit: I'm not looking to make anything anymore complicated I simply want to have the ability for up to date p/l to show.

Last edited by ChrisTrader; 04-20-2012 at 04:17 AM.. Reason: Clarification
ChrisTrader is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:42 AM.


Advertisement
Log in to turn off these ads.