Sterling API Developer Thread

Discussion in 'Trading Software' started by mnx, Apr 25, 2008.

  1. I notice that it says in the sterling manual that if you are using .net. You should make sure that you use XML

    Like you don't want to have
    OnSTIOrderUpdate()

    You want to use
    ONSTIOrderUpdateXML()


    does this make a big difference?

    cause I was having trouble before using OnSTIOrderUpdate and I put in OnSTIOrderUpdateXML... haven't really tested it, but looking forward to hopefully it making a big difference
     
    #221     Jan 7, 2011
  2. Also,

    If someone would be so kinda to send me their program (of course the strategy take out) but just the structure of how to send / track / cancel orders, I'd love you forever.

    Thanks
     
    #222     Jan 7, 2011
  3. I'd also like to post my methodology for sending / tracking / cancelling

    Orders have (4) variable
    PlaceLong (boolean)
    LongSent (boolean)
    BuyOrder (string)
    CancelOrder (string)


    -----------------FOR SENDING IN ORDERS--------------------


    OnSTIQuoteUpdate()
    if ConditionForTrade = true and PlaceLong = false and LongSent = false then
    PlaceLong = false
    BuyOrder = GetCLOrderID()
    SendBuyOrder()
    end

    OnSTIOrderUpdate()
    Order = structUpdate.CLOrderID

    if Order = BuyOrder and structupdate.nNum = x then (x is the sent code)
    LongSent = true
    end


    ------------------FOR CANCELS-------------------------
    OnSTIQuoteUpdate()

    if ConditionForCancel = true and PlaceLong = true and LongSent = true then
    CancelOrder = GetCLOrderID()
    CancelOrder()
    PlaceLong = false
    end


    OnSTIQuoteUpdate

    Order = structUpdate.CLOrderID
    if Order = BuyCancel and structupdate.nNum = y then (y is the cancel code)
    LongSent = false
    end



    Notice I don't use OnSTIConfirm() is this necessary?
     
    #223     Jan 7, 2011
  4. Did you look at the PM I sent you? The video will show you how my software works.
     
    #224     Jan 7, 2011
  5. swifty2

    swifty2

    Hi, my first comment in this thread (great thread), I was hoping to learn about Sterling's API. I began with this code to get sending an order if some condition is true. But isn't working


    Anyone have an idea what I might be doing incorrectly?
    Thanks

    (I wrote it in the sterling basket excel example ):

    Private Sub Worksheet_Calculate()
    If Range("B15") = 8.5 Then
    Range("A15").Select
    Selection.ClearContents
    SentBuyorder
    End If
    End Sub

    (Sentbuyorder is a module to send orders that´s working fine. and the "clearcontents" is because I want to delete the contents of A15 cell in order to excel not continue sending more orders
    I tested calling another module instead of "Sentbuyorder" and works ok)
     
    #225     Jan 25, 2011
  6. dhride

    dhride

    From your code I assume that cell A15 is an input to the order method such as price or a symbol. If i am right your code should work if you re-write it as:

    Range("A15").Select
    SentBuyorder
    Selection.ClearContents
     
    #226     Jan 25, 2011
  7. swifty2

    swifty2


    dhride, Thanks for your answer.
    Cell A15 is not an input, I´ve attached a screenshot with the excel sheet. A15 is just an input for the formula in cell B15:
    B15:(=If(A15="buy";If(D8<C15;8.5;"no");"inactive"))

    That is, I want to send the buy order when cell B15 shows the value 8.5.
    Thanks
     
    #227     Jan 25, 2011
  8. dhride

    dhride

    When using the DDE the quotes you see changing in your spreadsheet do not have any effect on the worksheet events because this is dynamic data and therefore the Worksheet_Calculate is never called. Basically as far as Excel knows the cells never change. For example the worksheet_calculate will be called if you change the formula and then press ENTER.

    Try this:
    1. Setup a worksheet and add the worksheet_change handler in the vba code module and pop-up a MsgBox when an event is triggered;
    2. Add a dde reference into one of the cells in the worksheet

    Results: Message Box will NOT pop-up for dde; Now, manually change a cell and the Message Box WILL pop-up...
    In your case an order will not be generated using the dde and it will be generated when manually changing it.

    I suggest not using the DDE and using the Steling library and ActiveX.
     
    #228     Jan 25, 2011
  9. ron23

    ron23

    Heya,

    Im very new, and im trying to use sterling api to get some quotes.

    im using the demo version (i should recive an actual account in a week or so), vs2010 and c#.

    im able to send and cancel orders, but for some reason im unable to get quotes, what am i doing wrong?

    under form load

    q = new STIQuote();
    q.RegisterQuote("C", "*");
    q.RegisterQuote("C", "NYSE");
    q.RegisterQuote("C", "N"); // not sure about this.....


    q.OnSTIQuoteSnap += new _ISTIQuoteEvents_OnSTIQuoteSnapEventHandler(q_OnSTIQuoteSnap);
    q.OnSTIQuoteUpdate += new _ISTIQuoteEvents_OnSTIQuoteUpdateEventHandler(q_OnSTIQuoteUpdate);

    and im not getting any events raised.

    Thanks
     
    #229     Feb 28, 2011
  10. stiQuote.RegisterQuote(Stock, "*")
    that pretty much works for me :)
     
    #230     Mar 1, 2011