[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] downloading information



PureBytes Links

Trading Reference Links

Hi Anthony,

I created a DLL that does this, but as mentioned at the time, it was done with VS2005.NET, which means it is truly beta stuff.  However I did post the source, see attached email, so if someone wants, the can use that as template to create a dll or script that all can use.

 

This can be improved upon greatly to "scrape" data from any site by using a config file to define how to scrape the data and how to retrieve it. 

I was thinking about modifying to include a config file much like this:

 

URL = "" href="">http://finance.yahoo.com/q/ks?s=

DataItem = Float, (<\\s*td[^>]*>Float:.*?\\s*>.*?>)([\\d|\\.].*?[^a-zA-Z])([a-zA-Z]*)<"

DataItem = OutShares, (<\\s*td[^>]*>Shares Outstanding:.*?\\s*>.*?>)([\\d|\\.].*?[^a-zA-Z])([a-zA-Z]*)<"

 

This would tell me how to find and retrieve the float and outstanding shares from the URL specified and I could then access it by called Fundamentals.getData ("Float").  This code could also be converted to Jscript or VBScript I think.

 

I haven’t done any further work on this as I am currently in the process of setting up AB for use with eSignal (moving from DTN)…and I believe they provide fundamental data in their feeds.

 

-----Original Message-----
From: Anthony Faragasso [mailto:ajf1111@xxxxxxxx]
Sent
: Sunday, November 21, 2004 9:13 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] downloading information

 

See the attached image...it could be any ticker....I would like to download

some of this data enclosed by the red lines...this is yahoo

finance....anyone know how to do it...or has anyone created a utility to do

it....

 

Can URLget do it....if so ...How ?

 

Thank you

Anthony

 

 

------------------------ Yahoo! Groups Sponsor --------------------~-->

$9.95 domain names from Yahoo!. Register anything.

http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM

--------------------------------------------------------------------~->

 

Check AmiBroker web page at:

http://www.amibroker.com/

 

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html

Yahoo! Groups Links

 

<*> To visit your group on the web, go to:

    http://groups.yahoo.com/group/amibroker/

 

<*> To unsubscribe from this group, send an email to:

    amibroker-unsubscribe@xxxxxxxxxxxxxxx

 

<*> Your use of Yahoo! Groups is subject to:

    http://docs.yahoo.com/info/terms/

 



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

--- Begin Message ---
Title: RE: [amibroker] Re: Float Analysis Alerts

Brian, Good news and bad news
 
GOOD NEWS:  I was able to create a dll which could be passed a ticker/symbol
and return the Float (and other fundamentals).
 
BAD NEWS:  I don't think many will be able to use, because of what I was
using to create the DLL.  I used Visual Studio .NET to create the dll in
using C#.  It turns out the DLLs created by VS.NET are not true COM dlls,
but can be compiled in a way to allow them to work with software that
"accepts" COM objects.  The problem...you need to have the .NET framework
installed for it to work.
 
In any event, the important point is it can be done. I will post the code in
case someone wants to take a stab at converting to a VB6 COM dll (which most
should be able to use)...and maybe add or clean it up.
 
--------------------------------------------------------
HERE IS A SAMPLE AFL CODE ON HOW TO CALL IT FROM AMIBROKER:
 
fd = CreateObject( "SecurityFundamentals.Fundamentals" );
fd.setURL ("http://finance.yahoo.com/q/ks?s=");
fd.setTicker ("YHOO");
 
fd.scrapeFundamentals();
 
AddColumn( fd.getFloat( ) , "float" );
AddColumn( fd. getOutstandingShares( ) , "float" );
 
Filter = 1; //streak > 0;
 
---------------------------------------------------------
HERE IS THE SOURCE OF THE DLL
 
#region Using directives
using System;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
#endregion
 
namespace SecurityFundamentals
{
    public class Fundamentals
    {
        private string _url = "http://finance.yahoo.com/q/ks?s="; //default
        private string _ticker = "";
 
        private float _float;
        private long _outshares;
 
        public Fundamentals( )
        {
        }
 
        public void setURL( string url )
        {
            _url = url;
        }
 
        public void setTicker( string ticker )
        {
            _ticker = ticker;
        }
 
        public float getFloat( )
        {
            return ( _float );
        }
 
        public long getOutstandingShares( )
        {
            return ( _outshares );
        }
 
        public void scrapeFundamentals( )
        {
            scrapeFundamentals( _url + _ticker );
        }
 
        public void scrapeFundamentals( string url, string ticker )
        {
            scrapeFundamentals( url + ticker );
        }
 
        public void scrapeFundamentals( string fullUrl )
        {
            string html = getHtml( fullUrl );
            parseHtml( html );
        }
 
        private string getHtml( string url )
        {
            string result;
 
            WebResponse response;
            HttpWebRequest webRequest = ( HttpWebRequest )
WebRequest.Create( url );
 
            webRequest.KeepAlive = true;
            webRequest.Method = "GET";
            response = webRequest.GetResponse( );
 
            StreamReader reader = new StreamReader(
response.GetResponseStream( ), System.Text.Encoding.UTF7 );
            result = reader.ReadToEnd( );
            reader.Close( );
 
            return ( result );
        }
 
        private void parseHtml( string html )
        {
            string FLOAT_PATTERN =
"(<\\s*td[^>]*>Float:.*?\\s*>.*?>)([\\d|\\.].*?[^a-zA-Z])([a-zA-Z]*)<";
            string OUTSHARES_PATTERN = "(<\\s*td[^>]*>Shares
Outstanding:.*?\\s*>.*?>)([\\d|\\.].*?[^a-zA-Z])([a-zA-Z]*)<";
 
            Regex regx = new Regex( FLOAT_PATTERN );
            Match match = regx.Match( html );
            if ( match.Success )
            {
                string numb = match.Groups[ 2 ].Value;
                string unit = match.Groups[ 3 ].Value;
                _float = convertValue( numb, unit );
            }
        }
 
        private float convertValue( string numb, string unit )
        {
            long multiplier;
            float val = System.Convert.ToSingle( numb );
 
            switch ( unit )
            {
                case "M":
                    multiplier = 1000000;
                    break;
                case "B":
                    multiplier = 1000000000;
                    break;
                default:
                    multiplier = 1;
                    break;
            }
 
            return ( multiplier * val );
        }
 
    }
   
 
}
 
 
-----Original Message-----
From: Brian [mailto:cadvantag@xxxxxxxxxxxxxx]
Sent: Tuesday, November 16, 2004 7:08 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Float Analysis Alerts
 
 
 
 Dimension,
 
I would be very interested in getting data like "Float" from sites
like Yahoo or MoneyCentral.
 
Low Float stocks with Good Earnings/Revenue has been some of the
hottest stocks out there. (Right now that is)
 
Do you know how to create a dll that would extract "Float" data?
 
Thanks,
Brian
 
 
--- In amibroker@xxxxxxxxxxxxxxx, Dimension <dimension@xxxx> wrote:
> If you find nothing regarding this, let me know...i have an idea
of how to
> do this, but it would involve a script function or dll add-in to
pull the
> Float from some site like yahoo.  The system I was think off would
track
> when the volume traded over a certain period exceeds the float.  I
have
> found that when spikes in volume only low float stocks occur, the
tend to
> become ST momo plays.
>
> While I can pretty much figure out how to get the latest daily
float for a
> security, I don't know of any where that offers historical float
(or any
> other fundamentals), does anyone?
>
> -----Original Message-----
> From: Christoper [mailto:turkey@x...]
> Sent: Tuesday, November 16, 2004 12:07 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Float Analysis Alerts
>
>
>
> Try the Amibroker library...
> http://www.amibroker.com/library/
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, thechemistrybetweenus@xxxx wrote:
> >
> >
> > Has anyone been able to develop a method in AFL that allows
alerts
> for
> > a float analysis indicator? I have tried searching past
messages,
> with
> > no luck.
>
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
 
 
 
 
 
 
Check AmiBroker web page at:
http://www.amibroker.com/
 
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
 
 
 
 
 
 


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


--- End Message ---