Using VB.NET with API example

Discussion in 'Automated Trading' started by psytek, Aug 24, 2005.

  1. psytek

    psytek

    #21     Aug 29, 2005
  2. psytek

    psytek

    FYI... The latest AmiBroker 4.72 beta offers a GetRTDataForeign( "field", "symbol") function to access stock-specific data from IB.

    Now that I can access specific ticker prices from a loop I have no immediate reason to resort to custom API programming. Order placement is already fully covered by the AB IB-controller. If your needs are the same you may want to try this function.

    best regards,
    herman.
     
    #22     Sep 11, 2005
  3. HI. I moved my system from vb.6 to vb.net and am having problems displaying data in grid format .I used flexgrid in vb6 and was able to load it in .net but am encountering overflow errors. I have an array with 10 fields such as ticker/last/hi/lo/position and would like to disply it in an excel like manner. I tried using a list box but the fields don't line up as neatly as the flexgrid . Any suggestions on how to display an array into neat columsn wold be appreciated . Thanks
     
    #23     Oct 25, 2005
  4. Why don't you use the DataGrid control?
     
    #24     Oct 25, 2005
  5. I was under the impression that the datagrid control is solely used for linking onto a recordset in Access,etc.

    I have 3 books in vb.6 and .net and the examples in all 3 of the use of datagrid is in displaying Access records.

    For example if I have a structure called x holding ff values x.ticker=IBM and x.last=80 and x.position =-500. How would you use datagrid to see the ff. in your vb.net form?

    IBM 80 -500

    Thanks in advance
     
    #25     Oct 25, 2005
  6. The VB.net datagrid is generally used for binding to a dataset, but in .net anything can be databound if you write the binding code.

    Try putting your data into a dataset and then binding that to the grid. Using the built-in binding should be significantly faster than anything you or I can write.

    SSB
     
    #26     Oct 25, 2005
  7. SideshowBob , do you mean take the .net variable (i.e. x.ticker, x.last,etc) and commit it to an Access database then extract it back to vb.net using datagrid? Interesting angle... Thanks
     
    #27     Oct 25, 2005
  8. No, he means create a dataset object (I guess datatable object would work also) and stuff these objects with your incoming market data. Bind this object to a datagrid object.
     
    #28     Oct 25, 2005
  9. txuk

    txuk

    No need for a recordset/dataset -- you can use the .net grid in unbound mode. Doing so will allow you to get the values from the API, write them directly to column/table objects, and then bind this to a datagrid.

    This page has a simple example:
    http://www.codeproject.com/Purgatory/UnBoundDataGrid.asp
     
    #29     Oct 27, 2005
  10. Hi . I have an Excel sheet which fetched data using DDE from a charting program. I also have a vb.net program which takes these values and assigns them to an array in VB. The problem is in my timer. Occasionally, I get this message.

    first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

    Additional information: Call was rejected by callee.


    I think it is because an assigment statement such as

    vxl(rw).index = xlbook.Application.Cells(rw, 2).value
    vxl(rw).TrigrBuy = xlbook.Application.Cells(rw, 3).value
    vxl(rw).TrigSell = xlbook.Application.Cells(rw, 4).value

    which fetches the data from eXcel can't communicate to excel since Excel is in edit mode probably from a cell change thru the DDe. IS there a way to handle this error or a way to do the assignment statments ONLY when Excel is ready? Thanks
     
    #30     Oct 30, 2005