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

[amibroker] Additions to ABtool v0.0.5 beta



PureBytes Links

Trading Reference Links

Hi all,
the recent additions to ABtool.dll include among other also
the mentioned Table functions. Below is  also an  example 
on how to use the Table functions.
UM

     ...
     STRING QuoteCRC32(STRING ticker, STRING fieldid, 
                       NUMBER sYear, NUMBER sMonth, NUMBER sDay,
                       NUMBER eYear, NUMBER eMonth, NUMBER eDay);
        FieldId:
          D Date
          O Open
          H High
          L Low
          C Close
          V Volume
          I Open Interest          
        Return value: CRC32 value as Hex-String, or "Error"
        Example: this calculates the CRC32 for DELL's Close prices for
                 the given date range:
                   crcStr = QuoteCRC32("DELL", "C", 2000,1,1, 2003,5,2);
        Remerks: There must be at least 1 quote in the specified date range,
                 otherwise "Error" will be returned.
                 Using this the quote data of a stock can be tested for equality
                 among users and databases.


     VARIANT StockPropertyGet(STRING ticker, STRING property, NUMBER arg = 0)
       Get property type information about any ticker
       Returns: either NUMBER or STRING depending in the type of the returned data
                (use VarGetLastType() to determine the type)
       Args:
         property can be one of the following:
           FullName
           IsIndex
           IsFavourite
           IsContinuous
           IndustryID
           MarketID
           GroupID
           WatchListBits0to15
           WatchListBits16to31
           WatchListBits32to47
           WatchListBits48to63
           Code
           Issue
           BookValue
           NominalValue
           Address
           Alias
           WebID
           FinanceYear    (pass the quarter in the optional 3rd param)
           FinanceIncome  (pass the quarter in the optional 3rd param)
           FinanceEBT     (pass the quarter in the optional 3rd param)
           FinanceEAT     (pass the quarter in the optional 3rd param)
           IsDirty
           DataSource
           DataLocalMode
           MarginDeposit
           PointValue
           RoundLotSize
           TickSize
       See ABtool_Examples.txt for an example usage. 

     NUMBER VarGetLastType()
       Returns the type of the data returned by the last StockPropertyGet() call as follows:
         0 Type unknown or uninitialized yet
         1 Number
         2 Array (of Numbers)
         3 String
         4 ?
         Usually StockPropertyGet() uses only types 1 (number) and 3 (string).
       Attention: you can call this only once after each StockPropertyGet() call.
       See ABtool_Examples.txt for an example usage. 


    NUMBER TableCreate()
      Returns a table handle >= 0, else error
      This handle is required in for all operations on this table
      See TableXXX.afl for demo application. 
  
    NUMBER TableColumnAdd(STRING colname, NUMBER coltype, NUMBER tablehandle, NUMBER size = 0)
      Appends a column definition to the table definition
      ColType:
         1 float    (the default numeric data type in AB)
         3 String   (pass the size in the last optional param; default is 128 bytes)
        14 Int32    (signed 32 bit integer)
        more data types will soon be added

    NUMBER TableDataAddStr(STRING val, NUMBER row, NUMBER col, NUMBER tablehandle)
      The cell at position row,col will be filled with the passed string value

    NUMBER TableDataAddFloat(NUMBER val, NUMBER row, NUMBER col, NUMBER tablehandle);
      The cell at position row,col will be filled with the passed floating point value
 
    NUMBER TableDataAddInt32(NUMBER val, NUMBER row, NUMBER col, NUMBER tablehandle);
      The cell at position row,col will be filled with the int32 representation
      of the passed floating point value (AFL does not have int32, but float can be used)

    NUMBER TableExport(STRING filename, STRING seperator, NUMBER tablehandle, NUMBER fHdrline = true)
      Seperator is the field seperator (usually the comma ",");
      fHdrLine controls whether a hdr line containing the field names will be written to file
 
    NUMBER TableDelete(NUMBER tablehandle);
      Deletes the table from memory.
      Passing -1 deletes all tables (if any)
       
    NUMBER TableGetRowsCount(NUMBER tablehandle)
      Gets the highest filled row number

    NUMBER TableGetColumnCount(NUMBER tablehandle);
      Gets the number of defined columns
  
    NUMBER TableSort(NUMBER tablehandle, NUMBER col, NUMBER fAscending = 1, NUMBER fIgnoreStrCase = 1);
      Sorts a table


//--------------------------------------------------------------------------
// TableXXX.afl

    Filter = 1;
    AddColumn(C, "dummy");

    //--------------------------------------------------------------------------------
    // TableXXX operations from within AFL:
    //
    // The table is "in-memory" only yet (visualizing will maybe come sometime later).
    // The table can also be sorted and also be exported to a CSV file. Excel can
    // be used to view such CSV files, or any texteditor.
    // 
    // The main purpose of the TableXXX functions is for doing fast table operations
    // programamatically from within native AFL.
    //
    // You need to save the TableHandle returned by TableCreate() for any 
    // subsequent TableXXX calls on this table.
    // 
    // Column types: 1=float, 3=string, 14=int32  (more to come)
    // 
    // Rows and Columns start with 0 (ZERO based)
    //

    // table1:
    th1 = TableCreate();               // you need to save the returned table handle
    TableColumnAdd("A",      1, th1);  // column 0 is of type float (default type in AFL)
    TableColumnAdd("B",      3, th1);  // column 1 is of type string
    TableColumnAdd("MyCol", 14, th1);  // column 2 is of type int32 and has name "MyCol"
    for (i = 0; i < 10; i++)           // fill the first 10 rows
      { 
        flVal = 123.456 * i;            // testvalue as float

        TableDataAddFloat(flVal, i, 0, th1);  // fill cell i,0
        TableDataAddStr("Wow!",  i, 1, th1);  // fill cell i,1
        TableDataAddInt32(flVal, i, 2, th1);  // fill cell i,2 (in table it will become an int32)
      }
    // export table1 to a CSV file (in AB directory):
    // (omitting a hdrline is possible with the last optional param)
    TableExport("Table_Test_1a.csv", ",", th1, true);


    // table2: another table but with different field order
    th2 = TableCreate();                // you need to save the returned table handle
    TableColumnAdd("1st col", 3, th2);  // column 0 is of type string and has name "1st col"
    TableColumnAdd("2nd",    14, th2);  // column 1 is of type int32 
    TableColumnAdd("3rd",     1, th2);  // column 2 is of type float
    for (i = 0; i < 25; i++)            // fill the first 25 rows
      {
        flVal = 456.789 * i;            // testvalue as float

        rc = TableDataAddStr(  "bla", i, 0, th2);  // fill cell i,0
        rc = TableDataAddInt32(flVal, i, 1, th2);  // fill cell i,1 (in table it will become an int32)
        rc = TableDataAddFloat(flVal, i, 2, th2);  // fill cell i,2
      }
    // export table2 to a CSV file (in AB directory):
    TableExport("Table_Test_2a.csv", ",", th2);


    // sorting table1 in descending order on column 2 (ie. 3rd column; remember zero based!):
    TableSort(th1, 2, false);
    TableExport("Table_Test_1b.csv", ",", th1);

    // sorting table2 in descending order on column 1:
    TableSort(th2, 1, false);
    TableExport("Table_Test_2b.csv", ",", th2);

    // sorting table1 in ascending order on column 2:
    TableSort(th1, 2, true);
    TableExport("Table_Test_1c.csv", ",", th1);

    // sorting table2 in ascending order on column 1:
    TableSort(th2, 1, true);
    TableExport("Table_Test_2c.csv", ",", th2);


    // clean up:
    TableDelete(th1);
    TableDelete(th2);
 // TableDelete(-1);  // deletes all tables (if any)
//--------------------------------------------------------------------------


----- Original Message ----- 
From: <amibroker@xxxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, May 05, 2003 3:23 PM
Subject: [amibroker] New file uploaded to amibroker


> 
> Hello,
> 
> This email message is a notification to let you know that
> a file has been uploaded to the Files area of the amibroker 
> group.
> 
>   File        : /ABtool/ABtool_dll_v0_0_5_beta.zip 
>   Uploaded by : anty3de <uenal.mutlu@xxxxxxxxxxx> 
>   Description : ABtool.dll AFL plugin v0.0.5 beta 
> 
> You can access this file at the URL
> 
> http://groups.yahoo.com/group/amibroker/files/ABtool/ABtool_dll_v0_0_5_beta.zip 
> 
> To learn more about file sharing for your group, please visit
> 
> http://help.yahoo.com/help/us/groups/files
> 
> Regards,
> 
> anty3de <uenal.mutlu@xxxxxxxxxxx>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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