¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date

Re: Looping the Historical ticks request

 

yes thank you!


On Mon, May 31, 2021 at 9:28 AM <erezkaplan90@...> wrote:
Hi,

It's done so:
start with one call

? ? ?self.reqHistoricalData(self.hisID, self.contract, self.lastxDay, "1800 S", "1 secs", BID_TYPE, 0, 1, False, [])

? ? ?def historicalData(self, reqId, bar):
? ? ? ? ?# do your stuff

Here come the magic
###################
? ? def historicalDataEnd(self, reqId: int, start: str, end: str):
? ? # once the data ends, you issue a new request, after altering the time?
? ? ?self.historicDate += datetime.timedelta(minutes=30)
? ? ?self.reqHistoricalData(self.hisID, self.contract, self.historicDate?, "1800 S", "1 secs", BID_TYPE, 0, 1, False, [])

Hope this helps


Re: back and glad for it

 

You run 6 instances for different accounts or for one account? Probably 3 accounts with paper and live?


On Mon, May 31, 2021, 10:25 AM Hartmut Bischoff <topofocus@...> wrote:


I run up to 6 instances on a single cloud instance.
Just install a window-manager there and x2-go (server) and you get a reasonable facsimile of a thin-client


Re: back and glad for it

 



I run up to 6 instances on a single cloud instance.
Just install a window-manager there and x2-go (server) and you get a reasonable facsimile of a thin-client


Re: Looping the Historical ticks request

 

Hi,

It's done so:
start with one call

? ? ?self.reqHistoricalData(self.hisID, self.contract, self.lastxDay, "1800 S", "1 secs", BID_TYPE, 0, 1, False, [])

? ? ?def historicalData(self, reqId, bar):
? ? ? ? ?# do your stuff

Here come the magic
###################
? ? def historicalDataEnd(self, reqId: int, start: str, end: str):
? ? # once the data ends, you issue a new request, after altering the time?
? ? ?self.historicDate += datetime.timedelta(minutes=30)
? ? ?self.reqHistoricalData(self.hisID, self.contract, self.historicDate?, "1800 S", "1 secs", BID_TYPE, 0, 1, False, [])

Hope this helps


back and glad for it

Stuart Cracraft
 

Hi everybody,

I¡¯m back and also wanted to express my thanks to folks here for helping me to stand-up
automated trading through IB.

I couldn¡¯t be more delighted.

My only nit is that having to run the TWS app on a full dedicated desktop instance and
not having been able to stand up any reasonable thin Linux client is, honestly, my only
disappointment.

Cheers,

Stuart


TWS vs Gateway at reconnections

 

Last week I was running the TWS and the gateway simultaneously when my internet connection suddenly disappeared. While the gateway attempted to reconnected many times until finally the connection was reestablished exited the TWS directly
and made no attempts to reconnect.
I'd prefer the TWS to behave like the gateway did (reconnect when the internet is available again). How can I change the behaviour of the TWS?


Re: Looping the Historical ticks request

Nick
 

That is not correct.

reqHistoricalTicks takes start and end times. You can specify the end time you want for the first request. Then subtract 1 from the oldest received timestamp and use that for the end time of the next request.

This will allow you to loop backwards and collect as many ticks as you want.

You can also use the start time and use the same approach to loop forward.

On 5/30/2021 10:11 AM, Sebastian wrote:
I understand you wanting to procure more then 1000 historical ticks (by somehow looping the request) - sorry, that is not possible by that IBKR API: seems you need a 3rd party data provider.


Re: Looping the Historical ticks request

 

Use?for acquiring live tick data ( as long as cancel- or API termination) - you may get a front run by parameter?numberOfTicks?for maximal 1000 historical ticks

I understand you wanting to procure more then 1000 historical ticks (by somehow looping the request) - sorry, that is not possible by that IBKR API: seems you need a 3rd party data provider.


Looping the Historical ticks request

 

Is there a good way to create a loop for the historical ticks request? ?This could help to bypass the 1000 line limit per request. ?


Re: Getting Option Call Open Interest (tickId 27) and Option Call Volume (tickId 29)

 

Same here.? I do receive OI and not Volume.? This issue is not a new one...


Re: OrderState Status Partial Fill

 

My vote is on since callbacks are messy and unreliable.

First of all you get many duplicates and there is a good chance that you don't get some that you really want. We have seen cases where orders change status while TWS had no connection with IB (during the maintenance window or during network issues) and none of the orderStatus messages that we would have expected were delivered after connection restauration But the execution reports and account updates did get delivered as soon as TWS reestablished connection.


Re: OrderState Status Partial Fill

 

I don't think there is a status text specifically for partially filled orders. Such working orders will have the status "Submitted" and change to "Filled" once completely executed.

Every change in the status of the order is communicated with the OrderStatus callback. It conveys information about filled and remaining amounts amongst other things. Alternatively, you can count order executions with the ExecDetails callback.


OrderState Status Partial Fill

 

All,

Having some difficulty simulating this, when requesting a filled order, what is the "status" in the OrderState class if it is partially filled?? Is there a way to tell if the order is completely or only partially filled?

Mike


Re: Adding Attributes to Order Object

 

JR,

Thank you for the input and your suggestions.? Much appreciated.

Mike


Re: Adding Attributes to Order Object

 

There is no way to add fields to the Order object that travel all the way to IB and back to you. That would be a scary thought from a security point of view.
But depending on what you are trying to achieve, here a couple thoughts:
  • There is the string field that you are free to assign.
  • You can always define your own ExtendedOrder object locally.
For the second option you'd do these steps:
  • Define the extended order class as a wrapper that has your custom fields plus a field that carries the original IB order object
  • Maintain a map (indexed by, say, orderId, permId or orderRef) that remembers the wrapper for each order
  • Define your versions of the order related request methods that transmits only the IB order object
  • Define your versions of the order related callbacks that wrap the IB order objects you receive with the corresponding wrapper you kept in the map
There are not that many order related methods, so that this does not sound like a huge task.

JR


Adding Attributes to Order Object

 

All,

I am wondering if there is any way to add an attribute to an Order object placed at IB, then return the order object from IB with that attribute.? Currently when I try this, the attribute I added to the order is simply not in the returned object I receive from IB.? My understanding of the IB EWrapper/Eclient system is that this is likely impossible, but I wanted to see if there was any similar way to store customized information in the order object that will be stored.

Thanks,

Mike


Re: Getting Option Call Open Interest (tickId 27) and Option Call Volume (tickId 29)

 

Thanks a lot Nick,

It worked for?Option Call Open Interest (tickId 27) but for some?reason it doesn't get any?Option Call Volume (tickId 29). Maybe I should calculate the volume requesting historical data of the day for the option contract.

Regards.


El vie, 28 de may. de 2021 a la(s) 09:41, Nick (news1000@...) escribi¨®:
Tick types 27 and 29 come back in tickSize instead of tickString.



On 5/28/2021 10:20 AM, Pirro Trader wrote:
> I'm trying to get?Option Call Open Interest (tickId 27) and Option
> Call Volume (tickId 29) with the following code, but I only get
> "TickerId: 99 TickType: 49 Value: 0.0" in?TickGeneric function?all the
> time, no matter the option contract I specify.
>







Re: Getting Option Call Open Interest (tickId 27) and Option Call Volume (tickId 29)

Nick
 

Tick types 27 and 29 come back in tickSize instead of tickString.

On 5/28/2021 10:20 AM, Pirro Trader wrote:
I'm trying to get?Option Call Open Interest (tickId 27) and Option Call Volume (tickId 29) with the following code, but I only get "TickerId: 99 TickType: 49 Value: 0.0" in?TickGeneric function?all the time, no matter the option contract I specify.


Getting Option Call Open Interest (tickId 27) and Option Call Volume (tickId 29)

 

Hello,

I'm trying to get?Option Call Open Interest (tickId 27) and Option Call Volume (tickId 29) with the following code, but I only get "TickerId: 99 TickType: 49 Value: 0.0" in?TickGeneric function?all the time, no matter the option contract I specify.

? ? contract = Contract()
? ? contract.symbol = "DIS"
? ? contract.secType = "OPT"
? ? contract.exchange = "CBOE"
? ? contract.currency = "USD"
? ? contract.lastTradeDateOrContractMonth = "20210604"
? ? contract.strike = 152.5
? ? contract.right = "C"
? ? contract.multiplier = "100"
? ? print('*** Invoking reqMktData')
? ? #client.reqMarketDataType(29)

? ? client.reqMktData(99, contract, "100,101", False, False, [])

Any idea of what I'm doing wrong?

Regards

Best regards


Re: using reqAccountUpdates to create pandas dataframe for each new update

 

Thanks Trevor, that's true - I coded this up in a scratch file without the usual other code that would go along with it.?