Announcement

Collapse
No announcement yet.

Delphi and Active X Time and Sales

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Delphi and Active X Time and Sales

    Is there anyone using Delphi to get Time and Sales data by Active X?
    I don't have any problem to get historical data, but there's no way to obtain the Time and Sales data.
    Call to RequestTimeSales succeed and after a while the event OnTimeSalesChanged occur. When NumBars is > 0 the code call GetTimeSalesBar but the data returnd are strange. The field DataType seems to be good because it is ina a range 1-4, but the other field are strange. Size field is huge and price is something like (1e150).
    Furthermore after the call to GetTimeSalesBar the application do not execute the subsequent line of code (in "debug" mode or in normal execution mode).
    Hope someone could help me.
    Thank you.

  • #2
    time&sales and delphi - problem

    hi afastexit,

    i have a similar problem with delphi to archive time&sales data of the desktop api.

    you might have a look at my source code below.

    after running my programm in borland delphi 7.0 environment i got an error "not enough memory" after requesting time&sales data.
    when running outside delphi's enviroment no error msg occurs.

    the onTimeSalesChanged event occurs but i get nonsense data like this :

    __________________________________________________ __________________________________________

    30.12.1899 0,000 1085226762 1447356
    30.12.1899 0,000 1085226675 1442924
    30.12.1899 0,000 1085226782 1461660
    30.12.1899 0,000 1085226757 1461684
    30.12.1899 -1,78354589502429865E259 1085226792 1461708
    30.12.1899 -9,25596535868417454E061 1085226828 1461732
    30.12.1899 9,07095112467007296E135 1085226767 1443372
    30.12.1899 1,90359967295465575E185 1085226726 1442948
    30.12.1899 0,000 1085226731 1442972
    30.12.1899 0,000 1085226762 1442996
    30.12.1899 -4310086196308,306 1085226997 1443020

    __________________________________________________ __________________________________________


    hope someone could help me, (am liebsten in deutsch ;-)
    afaestexit, maybe you are interested in know-how exchange - just contact me: [email protected]

    thx for help,

    Fortuna


    __________________________________________________ __________________________________________


    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, OleServer, IESignal_TLB;

    type
    TForm1 = class(TForm)
    Hooks1: THooks;
    Button1: TButton;
    Memo1: TMemo;
    Label1: TLabel;
    Label2: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Hooks1TimeSalesChanged(ASender: TObject; lHandle: Integer);
    private
    public
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    Hooks1.SetApplication('myaccountname');
    end;

    procedure TForm1.Button1Click(Sender: TObject);
    var tsFilter:TimeSalesFilter;
    tsHandle:integer;
    begin
    tsFilter.sSymbol:='$DAXI';
    tsFilter.bQuotes:=1;
    tsFilter.bTrades := 1;
    tsFilter.lNumDays := 1;
    tsFilter.bFilterPrice:=0;
    tsFilter.dminPrice:=0;
    tsFilter.dmaxPrice:=0;
    tsFilter.bFilterVolume :=0;
    tsFilter.bFilterQuoteExchanges :=0;
    tsFilter.bFilterTradeExchanges :=0;
    tsHandle := Hooks1.RequestTimeSales[tsFilter];
    end;

    procedure TForm1.Hooks1TimeSalesChanged(ASender: TObject; lHandle: Integer);
    var lNumRtBars,lNumBars: integer;
    tsItem: timesalesData;
    i: integer;
    s:string;
    begin
    lNumRtBars := Hooks1.GetNumTimeSalesRtBars[lHandle];
    lNumRtBars := -1*lNumRtBars;
    lNumBars := Hooks1.GetNumTimeSalesBars[lHandle];
    for i:=lNumRtBars to 0 do
    begin
    tsItem := Hooks1.GetTimeSalesBar[lHandle, i];
    s:=format('%7.3f %7.3d %7.3s %7.3d',[tsItem.dPrice,tsItem.lSize,tsItem.sExchange,tsItem .lFlags]);
    s:=DateTimeToStr (tsItem.dtTime)+' '+s;
    memo1.Lines.add(s);
    end;
    end;

    end.

    Comment


    • #3
      Seems we have the same trouble.
      I've tried your code and to made it work I had to move some variable declarations from local to global scope.
      I don't have your memory problem, but the returned data continue to be strange.

      Comment


      • #4
        I try to ask again, in particular to the ESignal people.
        I'd like to know (it will be very usefull and time saving) if you can confirm that your ActiveX works with applications developed by Borland Delphi (7.0).

        Comment


        • #5
          I have been out of town and am trying to catch up, so please excuse the delay. I cannot confirm (nor deny) that Borland Delphi can be used with API, since we use Microsoft products here.

          What is your system's RAM and CPU specifications?

          Comment


          • #6
            You don't have to apologize, Robi.

            I work on a Athlon 2800+, 512 MB, Windows XP Pro SP1

            What seems to me interesting is the presumable correctness of the first field of the data structure (dataType) and erroneusnees (hope this word exists in English) of the remaining data.

            Just minutes ago I was reading (on another thread) the possibility to develop under .NET environment.
            Don't know, maybe I could try this new and more Microsoft friendly way.

            Comment


            • #7
              hi,

              I tested it on two systems:
              - intel pentium 4 - 2 Ghz with 512 MB RAM + windows XP
              - intel pentium 4 - 2,7 Ghz with 512 MB RAM + windows XP

              there is someone else having problems with esignal´s api and delphi:
              nedibe wrote about a similar problem.

              Comment


              • #8
                Personally, I stopped using Borland in the late 90s. I've personally just had much more success in developing with Microsoft development tools because of their support and large development community. I am also really impressed with .NET (which works great with the Desktop API). I know people have used WebServices, ASP, and XML, features all part of .NET. So, if you have the choice, using .NET would be my recommendation.

                BTW - I am working on creating a Knowledge Base repository for defects and their corrections concerning this API. There needs to be some things set up internally first, but this will eventually really help you all out on the problems you are having. I ask for your patience.

                Comment

                Working...
                X