Automating getting short locates

Discussion in 'Order Execution' started by Pochitito, Sep 21, 2024.

  1. Pochitito

    Pochitito

    Hello everyone,

    I stumbled upon a problem and would appreciate an advise.

    Background: trading through a prop firm, mostly US stocks, mostly short sale strategies. Using Sterling Trader Pro.

    Goal: to automate the execution part. Wanted to do that through the ActiveX API.

    Problem: based on my research, the API doesn't have any functionality to get current locate data and send request to buy the locates.

    I can consider switching to another platform/API if needed.

    Does somebody have experience in automating querying/requesting short locates?

    Unfortunately, IBKR doesn't work well with my strategies, so I can not consider switching to it, even if the API has the functionality.

    Will really appreciate any help.
     
  2. Sekiyo

    Sekiyo

    It sounds like you're trying to automate the process of locating shares for short selling, which is not fully supported through Sterling Trader Pro’s ActiveX API. While Sterling Trader Pro is highly regarded for fast and reliable execution, it lacks full coverage for managing short locates directly via their API.

    Potential Solutions:

    1. Check with your prop firm about integration options:

    Many proprietary trading firms provide separate tools or custom APIs for accessing locate data. Reach out to your firm to check if they offer a dedicated solution for querying and requesting short locates, which you could integrate with your existing automation setup. In some cases, you may be able to build an API bridge between your prop firm's locate system and Sterling Trader.

    2. Using Third-Party Locates Providers:

    There are third-party services and brokers like CenterPoint Securities and SpeedTrader, which specialize in providing short locates. Some of these brokers may have an API or an automated process to request locates. You might need to integrate their API with your trading platform or use scripting to automate the request process externally.

    For example:

    • CenterPoint Securities offers an automated way to access locates via their platform, and it may have API support for automation.
    • DAS Trader: Some traders switch to DAS Trader as it has more extensive support for APIs, including potential locate requests, and works well with prop firms.
    3. Automating via GUI Automation or Bots:

    If no direct API exists for locates, you could consider using automation tools like AutoHotkey, SikuliX, or UIPath. These tools can mimic user interactions, enabling you to automate the manual steps involved in requesting locates from within Sterling Trader Pro or another platform. Although not as robust as API-based solutions, GUI automation can often fill the gap when direct API support is unavailable.

    4. Explore Other Trading Platforms with Advanced API Support:

    Since IBKR doesn’t suit your strategies, here are a few other platforms you could explore that may have the API functionality you’re looking for:

    • TradeStation: TradeStation has a very comprehensive API that may allow querying for locate availability or sending locate requests.
    • Lightspeed Trading: Known for high-speed execution, Lightspeed also provides API functionality, although you’ll need to confirm whether their API supports locate management.
    • CQG: A high-end platform often used by prop traders and institutions, CQG’s API may allow more comprehensive order and locate management.
    5. Build a Custom Middleware:

    If none of the existing APIs fully meet your needs, you could consider building a middleware solution that ties together different services:

    • Use Sterling Trader Pro’s API for order execution.
    • Combine this with another system (via third-party broker or custom prop firm integration) to handle short locates.
    • A custom middleware would orchestrate requests to buy locates, query availability, and trigger execution based on pre-defined rules.

    Next Steps:

    1. Talk to your prop firm and ask if they have any existing integrations or APIs for managing short locates.
    2. Research third-party short locate providers and see if they offer APIs that fit your automation needs.
    3. Consider GUI automation for requesting locates if no API-based solution is available.
    4. Evaluate switching to a platform like DAS Trader, Lightspeed, or TradeStation if they offer better API access for your strategies.
    Feel free to ask for more information on any specific tools or workflows!
     
    Pochitito likes this.
  3. copy pasting from ChatGPT has become a skill
     
  4. Robert Morse

    Robert Morse Sponsor

    Correct. Even though Sterling Trader Pro offers a short locate tool (we currently offer 3 premium locates on that and Lightspeed Trader), STT never added the ability to query that through their Api or the Lightspeed Api. The function was never built in. We have a new Api we call The Lightspeed Connect API which should be on our website before the month’s end. As it was not built by STT, we have more flexibility and control. We do not have it today, but we have it on our list of improvements to Api. I have no eta, but we deem it a priority. If anyone would like information on the new Lightspeed Connect API, email me directly. I’m not ready for a public post yet.
     
    Last edited: Sep 21, 2024
    Pochitito likes this.
  5. Sekiyo

    Sekiyo

    I was waiting for you to help OP
     
    Drawdown Addict likes this.
  6. Unlucky enough that I can only use international brokers for trading.

    Can I ask what part of the strategy is not letting OP to use a different API?

    That will be key to recommend what API to use.
     
    Sekiyo likes this.
  7. anderscl

    anderscl

    For several years, I have been using DAS Traders CMD API to automate short locates and this works really well (fast and reliable). You can send an API request to ask for the price of the locate and/or send an API request to locate the shares. I am with Cobra Trading and they provide many different locate sources with different availability/pricing.

    I am extremely satisfied with Cobra + DAS Traders CMD API short locate capability and highly recommend this combination to anyone who wants to automate short locates via an API.
     
    d08, Pochitito and Lou Friedman like this.
  8. Pochitito

    Pochitito

    Thank you everyone for the answers. Probably, I will try my luck with DAS Trader.

    With regards to IBRK - my problem with them is that I am not satisfied with short locate availability, nothing to do with the API
     
    d08 likes this.
  9. Hi sir, I am also fully automated with Cobra + DAS CMD API. I would be every so grateful if you could help me with an issue. Some routes show max offer available (for example, 50356 shares when I inquire about 1500 shares), while other routes will only show you that the number of shares inquired about are available (for example, if I inquired about 1500 shares, the route would show 1500 shares offered/available--when the actual quantity is much higher).

    I cannot execute a locate for routes where the shares offered are equal to the amount inquired. (I have no trouble doing this successfully manually.)

    (Note:I tried once modifying the script to locate one share less than the amount inquired for those routes. That did not work.)

    I know there are two types of routes, where Type 0 routes use SLPRICEINQUIRE to receive a quote and the availability, and uses SLNEWORDER to locate the shares.
    Type 1 routes use SLNEWORDER to receive an offer, and then SLOFFEROPERATION to accept or reject the offer.
    The code is written to handle all Type 0 routes, which is tailored well to Cobra --all but one route at Cobra Trading are Type 0, see below. Type 2 operates the same as Type 0.

    CBRC LOCATE1 Type 0
    CBRC LOCATE2 Type 0
    CBRC LOCATE3 Type 0
    CBRC LOCATE4 Type 0
    CBRC LOCATE5 Type 1
    CBRC LOCATE6 Type 0
    CBRC LOCATE7 Type 2
    CBRC LOCATE8 Type 0

    I have been having my dev help with the locate portion of the the Python code and I am wondering if it has something to do with his wrapper?

    Here is what we are using for inquiry:

    responses, offer_prices, offer_sizes = \
    self.api_wrapper.sl_price_inquiry(instrument, abs(order_qty))

    And here is what we are using to accept:

    locate_response = \
    self.api_wrapper.place_short_locate_order(
    instrument, abs(route_size), route

    self.log(f'SLNEWORDER route {route} response: {locate_response}')

    (Log seems to indicate we are using an SLNEWORDER?)

    I know that the CMD manual gives suggestions on how to format (like below)?

    SLPRICEINQUIRE Symbol LocateShares Route/ALLROUTE/ ALLROUTEWTTYPE1
    Example: SLPRICEINQUIRE MSFT 100 LOCATE2

    SLNEWORDER Symbol LocateShares Route
    Example: SLNEWORDER MSFT 100 LOCATE2 SLNEWORDER MSFT 100 CLST

    Are you doing something similar? I wonder if we need to more explicitly follow the manual. We were converting code originally written for Interactive Brokers. So maybe the issue is tied to that.

    Again, no trouble inquiring, and no trouble locating when shares offered exceeds shares inquired. Thanks!
     
  10. anderscl

    anderscl

    I have not run in to the exact issue you describe, but I use the short locate a bit differently:

    In order to work around the behavior that some routes don't report the available volume (but the volume you asked for), I normally send a SLPRICEINQUIRE for a larger volume than I anticipate I will need to short. So if I send the inquiry for 20000 shares I may get back that 7543 shares are available. Then based on the price per share of the locate, I calculate the max number of shares I want to short and send the locate request (for example I may send "SLNEWORDER TNXP 3200 LOCATE1"). I follow the manual's format exactly and it has worked reliably.

    What is the exact error message you get when the short locate fails ?
     
    Last edited: Oct 15, 2024
    #10     Oct 15, 2024