Sterling API Developer Thread

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

  1. Renmauzuo

    Renmauzuo

    So, I've read this entire thread, and while it has been quite informative I still have an issue I'm hoping I can find help with.

    I have little experience with trading, but I'm a reasonably experienced programmer making an app using the API for a trading firm in my city. All is going well except for getting quotes, as I need my program to behave slightly differently based on current price.

    When I try to get quotes, the OnQuoteUpdate and OnQuoteSnap events are never triggered. I thought I might be doing something wrong, but I downloaded their VB sample projects and those didn't seem to work either. I saw some posts from a few months ago mentioning problems with quotes: is that still the case now?

    I'm doing it in C# using Visual Studio 2008. Some of the revelant code bits and my concerns:

    quote = new STIQuoteClass(); (should I be using the interface version?)

    quote.OnSTIQuoteUpdate += new _ISTIQuoteEvents_OnSTIQuoteUpdateEventHandler(OnQuoteUpdate);
    quote.OnSTIQuoteSnap += new _ISTIQuoteEvents_OnSTIQuoteSnapEventHandler(OnQuoteSnap);

    OnQuoteUpdate and OnQuoteSnap aremy handling functions. Right now they just show me some information about the quote struct (I put breakpoints in both of them so I know they are never getting called)

    When the user enters a symbol and exchange and presses a submit button:
    quote.RegisterQuote(order.Symbol, order.Destination);

    I also used SubmitQuote and SubmitQuoteStruct but they didn't seem to have any effect. I'm also not sure what the "bstrKey" argument they want is. I assume the bstr is Systems Hungarian notation carried over from VB but I have no idea what sort of "Key" it is. I took a guess that this refered to "Exchange Definitions (Quotes)" on page 17 of the API guide and entered 'N' for NYSE but I might be totally wrong.

    Anyway, this problem is the main roadblock preventing me from finishing this app. Any insight at all from those who know more Sterling than I would be much appreciated, heh.
     
    #191     Oct 31, 2009
  2. Renmauzuo

    Renmauzuo

    Ugh, I feel silly. For anyone who has the same problem, it worked when I used "*" instead of a specific destination in RegisterQuote.
     
    #192     Nov 2, 2009
  3. foible

    foible

    Is there a way to submit GoodUntilDate or GoodAfterDate orders using Sterling? I see STIOrder has StartTime and EndTime but docs don't say what they do, nor what format they're in.

    Anyone tried these and got them working?
     
    #193     Nov 12, 2009
  4. dhride

    dhride

    CyborgAdmin,

    I contacted Sterling and yes they have been experiencing problems with order types, specially server side order types such as the T-stops and S-Stops.

    I have created my own trailing/stop orders to limit the use of sterling's order types.

    Thank you for the feedback.



     
    #194     Nov 15, 2009
  5. bespoke

    bespoke

    i don't use t-stops but i find that using s-stops in the first 3-5 minutes of the day is a real crap shoot. sometimes they work, sometimes they don't. it has cost me thousands. i just have in-program stops instead
     
    #195     Nov 16, 2009
  6. Anyone notice how Sterling's (base.exe) RAM usage creeps up slowly over the course of the day? If you register more stocks to the API program you've written, the RAM usage increases accordingly.

    Does anyone know anything about this? It's as if base.exe is caching quote updates. If this is so, can we access this cached data?
     
    #196     Dec 7, 2009
  7. Hi. My code fails to trap "Not available for borrow" errors (please see below). Note that I'm using VBA on a spreadsheet.

    It's a minor annoyance, but I'm stumped for the error(s) that I'm sure are in my code.

    Thanks in advance for any feedback,

    Elvis

    =========================

    'Flag stocks not available for borrow

    If STIOrderStatus.osSTIRejected = 38 Then
    'Set a flag in the corresponding row
    rngLockRange(RowNum) = 1
    Range("E64").Value = ReturnCode
    Else
    Range("E64").Value = ReturnCode
    Range("D65").Value = GetStatusString(ReturnCode)
    End If

    Set Order = Nothing

    End Sub
     
    #197     Mar 8, 2010
  8. DEBUG.PRINT is your friend:
    debug.print "reject status=";STIOrderStatus.osSTIRejected

    Perhaps the code returned is different than your "trap".

    Also, you are using bad form...you should be trapping with an enumeration.

    if STIOrderStatus.osSTIRejected = eREJECT_FailedToBorrow Then

    .... etc.

    where eREJECT_FailedToBorrow is set to 38.
     
    #198     Mar 8, 2010
  9. Hi. Yes, these look like good ideas. I'll try that code.

    Thanks a lot for the help and for taking the time to reply: it is much appreciated.

    Elvis
     
    #199     Mar 10, 2010
  10. Hi everyone, I have a quick question. I just had a program developed for me and when I try to connect to sterling, I get a message saying there was an "error while creating Sterling objects." I am not able to get a hold of the programer for another 2 weeks due to his vacation, so I was hoping someone here could help me out with the issue. Thanks.
     
    #200     Apr 24, 2010