Interactive Brokers API Guarenteed Execution Help

Discussion in 'Order Execution' started by Sucat, Feb 3, 2017.

  1. Sucat

    Sucat

    I use the Interactive Brokers API and excel to send out orders to buy and sell stock. Years ago I used to have it send a buy order to the bid and sell order on the ask and wait to get filled. However, too many times the market would move (sometimes thin stocks) and the slippage would be too great 30min to hours later when I would finally give up and manually execute. I solved this by simply buying on the ask and selling on the bid which can lose me a penny on thick ETFs and 2c-5c on thinner stocks but it saves me from much bigger slippage when the market moves.

    My question is if there is a better way of doing this? I need guaranteed execution at some point that day but was hoping there an algo that I can use that will do better than buying the ask or selling the bid on average? And is that algo available through the API to send out over excel? Thanks for any help.
     
  2. Zzzz1

    Zzzz1

    Vwap or tvap comes to mind out of the head but it depends on how much market impact you currently experience, hence your order size relative to turnover and free float.

     
  3. Sucat

    Sucat

    Hmm. I see TWAP algo on IB isn't guaranteed but there is a guaranteed VWAP for large caps. I wonder if it betters better than simply buying the ask or selling the bid or is it just a way to smooth out orders over a longer period?
     
  4. tommcginnis

    tommcginnis

    It would be trivial to set up Excel logic to test elapsed time or price change (or volume traded, or specific time trigger (like 08:29:50 before a data announcement). It would be much more accessible, too, than within TWS.

    I would set up a column (assuming your data runs as rows) for each logic test, put a color on it (conditional; for your own visual cue), and then assess in a separate column whether the trade is a go/no-go, and when any conditional test gets lit, the trade is submitted.

    An idea, anyway.
     
  5. TraDaToR

    TraDaToR

    Also check PEG orders with IB. You can send them with the API.
     
  6. Sucat

    Sucat

    Thanks tommcginnis. I do have parameters to let me know when to submit the buy or sell order and turn green or red based on buy or sell. I don't trust my code (or the market or data feed) to have it automated so its a script connected to a button in excel. So I'm buying or selling at the right times.

    With that said, I'm only trying to figure out if I'm going about this the wrong way. While I had problems with slippage when buying on the bid, paying the extra penny also adds up. I wish there was an option where the order went out on the bid by adjusted at the last second to buy on the ask if the ask size was too small. I may be doing 500 shares when the bid/ask is 20,000 but I can't sit there and watch or react as quickly when the bid/ask is about to move up 1c.
     
  7. Sucat

    Sucat

    Thanks TraDaToR, I'm reading up on them now.
     
  8. tommcginnis

    tommcginnis

    I wonder if it might be worth your while to go through BookTrader, having set up a single-click trade system, and just work a 1-lot back and forth for a few days, and get a feel for
    1) different days -- like, "If Friday different?"
    2) different times -- like, "Is the Bid a viable entry on the last 45 minutes of cash market??"
    3) different conditions -- like "is a 'thin' market AS QUOTED, always so thin??"

    You'd be live, right there, and could enter/exit/go-to-cash as necessary, without having put the farm at risk. But there might be certain (let's call them) *realities* at work that might now be otherwise so plain.

    (Which, I think, is what you're getting at......)

    I'd be interested in finding out what you learn.
    (I too off-load data from IB, and I have learned just how *off* our static picture sometimes is. Wow.)
     
  9. Sucat

    Sucat

    Thanks tommcginnis. I will tell you about my experience on thin markets with small caps. I found that if I put out a buy order for an ask + a penny or two that it can yield better results than putting a bid 1 penny below the ask. Its like HFTs see the order and move the market if I'm below the ask thinking I will go higher. But if I will pay the ask its like they fight over the volume and give me a better price. Its a weird game the HFTs play.

    I'm looking into the BookTrader now. Thanks!
     
  10. tommcginnis

    tommcginnis

    FWIW, I generally use BookTrader when I'm trading something with a tight Bid/Ask.
    And when it goes more than a few ticks broad (5? 10?) I go with a QuoteMonitor set-up (also, single-click) where I can pause execution, spoof an inside order on the other side, etc. It's just personal psychology, but be aware that it might come up. Also, there is a BookTrader set-up choice about whether a new click closes one order and opens another, or whether it opens a new order entirely. I'd recommend against the multiple-order set-up, to begin with. (On the other hand, having a few multiple-price exits getting hit in a row?? Rather musical. Indeed....)
     
    #10     Feb 3, 2017