Profile Picture

Can RE do that?

Posted By Largo 7 Years Ago
Message
Posted Tuesday January 12 2010
Hi everybody,

I'm looking for platform for automated trading futures instruments through Interactive Brokers.
I tried to implement strategy in OpenQuant, but it lacks of basic functionalities!

So, please confirm if Right Edge allows:
1. Restoring strategy state after restarting platform: information about pending orders submitted before must be available as well as about filled orders.
2. Obtain yesterday close price for futures (ie. S&P 500 e-mini) from IB (it's official settlement price, seen in TWS by adding "Close" column to the instrument list).

Edited: Tuesday January 12 2010 by Largo
Posted Wednesday January 13 2010
We try to match things up as best as we can based on the data we have. We don't go out to the broker and synchronize, but we store what we did and ask you to confirm on startup that those positions are still the way we think they were. Try the trial to see if this suits your needs.

To get yesterday's close, you'd want to set lead bars and then you could go backwards and get prior close data.

Largo (1/12/2010)
Hi everybody,

I'm looking for platform for automated trading futures instruments through Interactive Brokers.
I tried to implement strategy in OpenQuant, but it lacks of basic functionalities!

So, please confirm if Right Edge allows:
1. Restoring strategy state after restarting platform: information about pending orders submitted before must be available as well as about filled orders.
2. Obtain yesterday close price for futures (ie. S&P 500 e-mini) from IB (it's official settlement price, seen in TWS by adding "Close" column to the instrument list).
Posted Tuesday January 19 2010
Thank you.

ad.2 I also can see that close price in "Live Data" Window -> "Close", so I think it will be available from strategy code too Smile
ad.1 If you do not synchronize positions and orders with broker after restarting RE then is one limitation: I can't do emergency trading from broker's platform (TWS). But probably I can live with thatSmile

I have another question: if RE could restart TWS after it closes? TWS has strange functionality that closes platform every day. I know there are third party programs that do that, but the more layers the more risk of error. For now there is much layers: Broker - Internet - VPS - Internet - TWS - RE

Edited: Tuesday January 19 2010 by Largo
Posted Wednesday January 20 2010
The previous day's close is sent as a tick with a TickType of PreviousClose. It is up to the broker plugin to send this tick. The TWS plugin does so, but I believe it only does so once for each symbol, which may be before your system starts processing ticks. So it may need to be modified to send this tick periodically. Fortunately we have released the source code to the TWS plugin, so it shouldn't be too hard to do this.

RightEdge doesn't have any functionality to restart TWS. There is a utility called IBController in the files section of the Yahoo TWS API group which I believe does a good job of keeping TWS up and running and should work with RightEdge.

Thanks,
Daniel
Posted Thursday January 21 2010
I installed IBController and it behaves quite good.

ProTrader MultiStation uses the same way to connect to IB (TWS API) and they provides function to get yesterday close price:
"You can get PrevClose value for IB S&P Futures via MarketInfo function (for example "MarketInfo("ES201003GLOBEX", 51) ")"

http://www.protrader.org/showthread.php?t=1922

So, I'll prefer that way, but I'll check how it's done in RE.

Edited: Thursday January 21 2010 by Largo
Posted Monday January 25 2010
ad.1
If you tells: "We don't go out to the broker and synchronize, but we store what we did and ask you to confirm on startup that those positions are still the way we think they were."
then it's not enough, because what if my pending order become market position meanwhile? - in strategy log it's still pending order but in real life this is filled market position!

The only professional solution is to get positions (both open and closed) and pending orders (both pending and cancelled) from broker during strategy startup!

That's the manner as ProTrader MultiStation works with IB and how is MetaTrader4 constructed by default.


ad.2
Getting yesterday close price for ie. S&P500 e-mini futures (symbol: ES) from broker.
Your anwsers are:
a) "To get yesterday's close, you'd want to set lead bars and then you could go backwards and get prior close data."
b) "The previous day's close is sent as a tick with a TickType of PreviousClose. It is up to the broker plugin to send this tick. The TWS plugin does so, but I believe it only does so once for each symbol, which may be before your system starts processing ticks. So it may need to be modified to send this tick periodically. Fortunately we have released the source code to the TWS plugin, so it shouldn't be too hard to do this."


ad a)
In RE GUI, "Live Data" window there is column called "Close" (available after right click -> Configure columns -> move "Close" to "Available")
It's the value I need in my strategy code. So, I think I don't need to collect any historical bars to read daily bar close price, because RE does not do that - this value is available in this window immediately.

So, can I read the same value from strategy code?

ad b)
I added code to the NewTick() event method but I couldn't see PreviousClose.
if(tick.tickType.ToString().Equals("PreviousClose")) { ....


It's most important thing for me to have this information in my strategy. I hope it's last missing thing after implementing it I can buy RE.

So, there are two ways to get this price? One, from your Live Data window, second, after adding by you information to tick data, for example each minute?



Edited: Monday January 25 2010 by Largo
Posted Tuesday January 26 2010
I misunderstood, I did not see that you were using tick data.  Yes, you should get the PreviousClose tick assuming the broker supports it.  It is possible that this tick is coming in before the system starts, but I ran a quick test with IB.  I screenshotted the PreviousClose tick (attached).  Here is my system code that monitored if that's useful to you.

public override void NewTick(BarData partialBar, TickData tick)

{

      OutputMessage(tick.tickType + ": " + tick.price);

      OutputMessage(partialBar.Close.ToString());

}

Posted Tuesday January 26 2010
Billb,
Yesterday I ran the same code against ES instrument (S&P500 future with expiration 20100319) and I had no PreviousClose entry.
How often do you see it on MSFT?
And PartialBar.Close I think has nothing to do, because I use 1 minutes bars, not daily bars.

(My strategy uses yesterday settlement price for calculations entry/exit prices for intraday trading)

But how you get Close (it's yesterday close price) to the Live Data instrument table window? Couldn't I get it from this place in my strategy?

Edited: Tuesday January 26 2010 by Largo
Posted Tuesday January 26 2010
I thought I posted this yesterday, but it looks like it either got deleted accidentally or I never actually did post it

Largo (1/25/2010)
ad.1
If you tells: "We don't go out to the broker and synchronize, but we store what we did and ask you to confirm on startup that those positions are still the way we think they were."
then it's not enough, because what if my pending order become market position meanwhile? - in strategy log it's still pending order but in real life this is filled market position!

The only professional solution is to get positions (both open and closed) and pending orders (both pending and cancelled) from broker during strategy startup!

That's the manner as ProTrader MultiStation works with IB and how is MetaTrader4 constructed by default.

When we reconnect, TWS should send updates for orders that were filled while the system was disconnected. So if an order was filled while disconnected, we should get that notification and process it correctly when the system reconnects. TWS will only send this information once though, so if you start a different system, or select different symbols, you may miss the fill information. Also, RightEdge will only know about orders that were active when the system was disconnected, so if you submit an order yourself it won't be picked up.

I added code to the NewTick() event method but I couldn't see PreviousClose.
if(tick.tickType.ToString().Equals("PreviousClose")) { ....

What do you mean by "I couldn't see PreviousClose"? The code should be:
if (tick.tickType == TickType.PreviousClose) { ...

It's most important thing for me to have this information in my strategy. I hope it's last missing thing after implementing it I can buy RE.

So, there are two ways to get this price? One, from your Live Data window, second, after adding by you information to tick data, for example each minute?


The strategy doesn't have direct access to the live data window, so you will need to use the NewTick() event.

Thanks,
Daniel
Posted Wednesday January 27 2010
dplaisted (1/26/2010)

When we reconnect, TWS should send updates for orders that were filled while the system was disconnected. So if an order was filled while disconnected, we should get that notification and process it correctly when the system reconnects. TWS will only send this information once though, so if you start a different system, or select different symbols, you may miss the fill information. Also, RightEdge will only know about orders that were active when the system was disconnected, so if you submit an order yourself it won't be picked up.


Thank you. Good thatTWS sends order updates. The problem may occurs when:
- I have two or more strategies running the same time (which one will receive valid orders updates?)
- when I submit order from TWS by myself - could you add full sync which will import such a orders to the strategy? (full position sync with broker).


I added code to the NewTick() event method but I couldn't see PreviousClose.
if(tick.tickType.ToString().Equals("PreviousClose")) { ....

What do you mean by "I couldn't see PreviousClose"? The code should be:
if (tick.tickType == TickType.PreviousClose) { ...


It means that I only can see: Bid, Ask, Trade, DailyVolume in Output log. There is no PreviousClose. Yesterday, about 21:10 CET (central european time) I once saw that information, but I think that was because TWS restarted itself.
I modified code as you mentioned, but it's the same. TWS doesn't sends PreviousClose in NewTick() too often.
I need this price immediately after strategy restarts.

It's most important thing for me to have this information in my strategy. I hope it's last missing thing after implementing it I can buy RE.

So, there are two ways to get this price? One, from your Live Data window, second, after adding by you information to tick data, for example each minute?


The strategy doesn't have direct access to the live data window, so you will need to use the NewTick() event.


Ok, but in NewTick() there is no possibility for now (as described above).

Edited: Wednesday January 27 2010 by Largo


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems