Sabtu, 23 November 2013

[smf_addin] Digest Number 2870

7 New Messages

Digest #2870

Messages

Fri Nov 22, 2013 3:27 pm (PST) . Posted by:

"PeteA" option2z

Hi Randy,
I have looked briefly at JSON, and it may be useful; will take me some time
to understand and test.

Thanks for the pointers on which to do first. I think I'll sit on this for
a while, and just brute force code the first few things to see how it works.
In another post Rex challenges the choice of php vs alternatives.

What I REALLY would like is a version of Excel that runs on a server.MS is
toying with it, but very limited at the moment.
Thanks,
Pete A
<http://www.sundognorth.com/TtP-S/>



RE:
Did you look at the jivedata.com resource mentioned earlier this week? It
may have some of what you want.

Also, be sure that PHP can do what you need. I used to grab AdvFN web pages
with PHP, but AdvFN changed something that stopped the PHP process from
being able to grab their source code. I'm no PHP expert, so I didn't have
any luck getting it fixed.

As far as the top three, RCHGetYahooQuotes(), RCHGetYahooHistory(), and
RCHGetTableCell(). smfGetTagContent() would give you more capability than
RCHGetTableCell().

But, basically, a CSV file converter and a web page extraction tool.

With JiveData.com, a JSON file conversion/extraction is needed. An XML
extractor would also be helpful, although I've been able to use
smfGetTagContent() for most of that type of data.

Fri Nov 22, 2013 3:44 pm (PST) . Posted by:

"PeteA" option2z

Hey Rex,
Good question (why php instead of R).
Well, I spent a LOT of hours on R I find it very awkward to build any sort
of system that is accessed by lots of folks.
It is an "awkward" language to me (but so is php). An odd mix of low level
and blindingly high level.
Mostly, I can't see how to run it on a commercial server to do what I need.

Php is easy for that, and free from my provider. I've already built two
working versions of TtP-S Alert service components. The second in response
to a request from a TtP-S partner. (php is piece of cake easy (except for
the dumb line terminator a ";" which I constantly forget :).)

Part 1 is completely autonomous (sample:
http://www.ttp-s.com/php/ttpBuyDayR.php). It runs on the server and is
accessed by a url, getting its own data from YAHOO as needed; and refreshing
every nMinutes, changing to green when conditions for a buy are met.
Part 2 r is a hybrid (sample: http://www.ttp-s.com/php/RSI.php), where an
automated process runs on my local machine, extracts a bunch of data I
already collect for my investment system operations, and ftp's it as a .csv
on the server, which is accessed by a php module when requested by the
investor.

I'd be curious as to how you might approach either one in R and make it
available to up to several thousand folks at any given time. (NOT quite the
problem of the ACA's web site :) )

If I had the time, energy and drive, I'd probably learn html5 and use c++ to
drive it all. Ok, maybe not :)

I do not use the php code to do computational finance things on the server.
The results of the Hoadley calcs and such are still done locally on my slave
PC server. php only facilitates sharing, and tidbits of automation with
periodic updates to the commercial server from my slave PC.

Thanks for the ideas & questions. I "FEEL" you pain at my choosing a weak
language to do complex things.but it is partly because php has been on my
plate for a couple of years.




RE:
<http://groups.yahoo.com/group/smf_addin/message/24597;_ylc=X3oDMTJzOW44NDZt
BF9TAzk3MzU5NzE1BGdycElkAzE4MDk0NjIwBGdycHNwSWQDMTcwNTYzMjE5OARtc2dJZAMyNDU5
NwRzZWMDZG1zZwRzbGsDdm1zZwRzdGltZQMxMzg1MTYxNzc2>; Re: Working on php version
of SMF

Fri Nov 22, 2013 3:09 pm (PST) . Posted by:

<mailto:rex@nosyntax.net?subject=Re%3A%20Working%20on%20php%20version%20of%2
0SMF> "rex" bios007a

PeteA <optionzz@gmail.com> [2013-11-22 10:31]:
> I'm starting work on building pieces of a baby version of Randy's
> magnificent SMF. Has anyone done anything like that? (I hate
> re-inventing wheels). If so might you share your efforts? My first shot
> at it gets some YAHOO data and presents a buy day signal to my TtP-S
> group.it looks like this: [3]http://www.ttp-s.com/php/ttpBuyDayR.php

Hi Pete,

Why PHP? As I'm sure you know, a hasty choice of language may cause
big problems later if it turns out to be poorly suited to the overall
task. Your TtP-S does some things that are in the realm of computational
finance, and PHP is utterly unsuited for that field. Why choose a language
that may make it easy to gather data at the cost of crippling development
of TtP-S?

As you know, I've essentially duplicated the functionality of TtP-S
using R. Unlike PHP, R is suited for computational finance due to
the many free finance packages available for it (R currently has ~4,800
free packages available, at least dozens of which are useful for
computational finance). For example, getting the data required to
test for buy signals is trivially easy with the quantmod package (and
several others). Mailing the alerts is also easy.

Duplicating some of the other functionalities of Randy's SMF in R
would not be so easy, but there are a number of R packages for web
scraping (e.g., RCurl), so you wouldn't be starting from scratch.

http://www.programmingr.com/content/webscraping-using-readlines-and-rcurl/

It's when you get into processing the data that R leaves PHP in the dust.
For example, TtP-S uses Hoadley's add-in to estimate sell targets. This
calculation can be done in R with no proprietary add-in. And so it goes...
many things that are difficult with PHP/Excel are easy with R packages.

You are already somewhat familiar with R. I'm baffled by you turning
to PHP for a task that is easy in R.

-rex

Fri Nov 22, 2013 9:31 pm (PST) . Posted by:

"rex" bios007a

PeteA <optionzz@gmail.com> [2013-11-22 15:44]:
> Good question (why php instead of R).
>
> Well, I spent a LOT of hours on R  I find it very awkward to build any
> sort of system that is accessed by lots of folks.

Building a system that is accessed by large numbers of people doesn't
sound like the Pete I know. Have you changed your spots? ;)

> Mostly, I can't see how to run it on a commercial server to do what I
> need. 

http://www.louisaslett.com/RStudio_AMI/

http://blog.yhathq.com/posts/r-in-the-cloud-part-1.html

So it's certainly possible, but it's not clear to me that it's
necessary. What _do_ you need, exactly?

> Php is easy for that, and free from my provider.

I don't know of any webhosts that provide free R, but it's not clear
to me that you need one. Do you have some new project in mind?

> I've already built two
> working versions of TtP-S Alert service components.  The second in
> response to a request from a TtP-S partner.  (php is piece of cake easy
> (except for the dumb line terminator a ";" which I constantly forget J.)
>
>
> Part 1 is completely autonomous (sample:
> [2]http://www.ttp-s.com/php/ttpBuyDayR.php).  It runs on the server and is
> accessed by a url, getting its own data from YAHOO as needed; and
> refreshing every nMinutes, changing to green when conditions for a buy are
> met.

But that's just a dynamic page that can be updated remotely w/o
running R on the server that serves the page. If you run a local box
during market hours it could update the page.

> Part 2 r is a hybrid (sample: [3]http://www.ttp-s.com/php/RSI.php), where
> an automated process runs on my local machine, extracts a bunch of data I
> already collect for my investment system operations, and ftp's it as a
> .csv  on the server, which is accessed by a php module when requested by
> the investor.

Of course this hybrid approach could be done via R on the local box as
well. If the hybrid is not enough, a pure R approach would be to use
Shiny on the server.

http://www.rstudio.com/shiny/

Since I run my own server, Shiny is easy to use. If you don't want
to run a server, RStudio will be offering commercial hosting and has
an open (free) beta now.

http://www.rstudio.com/shiny/

The support list is very active.

> I'd be curious as to how you might approach either one in R and make it
> available to up to several thousand folks at any given time. (NOT quite
> the problem of the ACA's web site J )

I've never run anything that is popular enough for bandwidth to be a
concern, plus I've run my own server since (at least) 2004, so I have
very limited experience installing stuff on commercial web hosts (I
installed MediaWiki on a web host that didn't offer it, and that's it).

But I still don't know what your needs are. Your TtP-S is, IMO, more
suited to alerts pushed to clients than it is to a web page that
people need to monitor. Do you foresee thousands of people frequently
visiting your web site to see if the indicator has turned green? Who
is likely to do that? Thousands of people? Or are you thinking of
offering some new service?

As we've discussed via email, your TtP-S is almost ideally suited to
an ATS because it enters GTC limit orders at the time of a buy and
your philosophy is to (almost) never sell at anything below that
price. This means the situation is "forgiving&quot; compared to an ATS
that constantly makes buy and sell decisions that are subject to
potentially devastating losses due to bugs or unanticipated
situations. OTOH, if a TtP-S ATS has a bug and buys by mistake,
you're long a high-quality stock that you can sell when you notice the
error and about half the time you'll have a profit. NBD. Buy quantity bugs
are easy to code against with independent code that checks for
excessive dollar amounts.

> I do not use the php code to do computational finance things on the
> server.  The results of the Hoadley calcs and such are still done locally
> on my slave PC server.  php only facilitates sharing, and tidbits of
> automation with periodic updates to the commercial server from my slave
> PC.
>
> Thanks for the ideas & questions.  I "FEEL" you pain at my choosing a weak
> language to do complex things…but it is partly because php has been on my
> plate for a couple of years.   

IMO, both Python and Ruby on Rails beat PHP for most things.

-rex
--
Computers run on smoke. If it leaks out, they stop running.

Fri Nov 22, 2013 5:05 pm (PST) . Posted by:

cere0003

http://www.zacks.com/stock/research/LPSN/brokerage-recommendations http://www.zacks.com/stock/research/LPSN/brokerage-recommendations
At the bottom of this link is a chart that shows EPS diluted quarterly and the price. It's the one that it says is provided by "Ycharts" How do I get this into an excel sheet? I tried searching around but this one is beyond my skill level. Thanks!


Kevin

Fri Nov 22, 2013 5:29 pm (PST) . Posted by:

"Randy Harmelink" rharmelink

It's a JavaScript presented interactive chart, so there's really not an
image to bring into EXCEL. Sorry.

On Fri, Nov 22, 2013 at 3:09 PM, <cere0003@yahoo.com> wrote:

>
> http://www.zacks.com/stock/research/LPSN/brokerage-recommendations
>
> At the bottom of this link is a chart that shows EPS diluted quarterly and
> the price. It's the one that it says is provided by "Ycharts" How do I
> get this into an excel sheet? I tried searching around but this one is
> beyond my skill level. Thanks!
>

Fri Nov 22, 2013 5:37 pm (PST) . Posted by:

ctgottapee

My broker trade king has an API where you send an auth with a id and key and requested item and it returns the results in XML.

Can an elements file be setup to scrape an xml file?

Fri Nov 22, 2013 6:19 pm (PST) . Posted by:

"Randy Harmelink" rharmelink

I've used the add-in to extract data from XML and JSON files as well as web
pages.

For XML, the smfGetTagContent() function can be very useful. Others you
might use would be smfStrExtr() and smfWord(), to parse out various
tidbits. It depends on the structure of the XML data.

For example, the (as yet undocumented) smfYahooAPIData() function pulls
data from various Yahoo XML files produced by their API feeds. This:

=smfYahooAPIData("GOOG", "Industry";, "e")
=smfYahooAPIData("GOOG", "Sector", "e")

...pulls the name of the industry and sector names of GOOG from this XML
file:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.stocks%20where%20symbol%20in%20(%22GOOG%22)&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys

...by basically issuing this function with that URL:

=smfGetTagContent(...URL...,"Industry&quot;, 1)
=smfGetTagContent(...URL...,"Sector&quot;, 1)

On Fri, Nov 22, 2013 at 6:32 PM, <ct_spam@gottapee.com> wrote:

>
> My broker trade king has an API where you send an auth with a id and key
> and requested item and it returns the results in XML.
>
> Can an elements file be setup to scrape an xml file?
>

Tidak ada komentar:

Posting Komentar