Python Code Example

No 2rosy's was just a code. jj1111 do you mind sharing a small piece of code doing what I intend to achieve. I feel I am working in a totally wrong direction coming from mostly Matlab coding.
 
I did the following but it didn't work at all:

z = list( tws_conn.reqAccountUpdates(True,'DU15211') )

Any suggestions ?

I don't know ibpy works, but in swigibpy you'd need to do this:

Instead of:

Code:
def updateAccountValue(self, key,  value,  currency,  accountName):
        showmessage('updateAccountValue', vars())

you'd have

Code:
updateAccountValue(self, key,  value,  currency,  accountName):
        self._store_account_value.append(vars())

then

Code:
import time
setattr(tws_conn, "_store_account_value", [])
tws_conn.reqAccountUpdates(True,'DU15211') 

## after waiting for a while - use the accountDownloadEnd to do this properly
time.sleep(30)
print tws_conn._store_account_value

GAT
 
import time setattr(tws_conn, "_store_account_value", []) tws_conn.reqAccountUpdates(True,'DU15211') ## after waiting for a while - use the accountDownloadEnd to do this properly time.sleep(30) print tws_conn._store_account_value

Is this really supposed to work as you have coded ? I get an empty array on the print statement.
 
i updated the github gist to display accountUpdates

gist.github.com/audubon/b14eeda1c2cad704b333

I was able to make your code work with some modification and got an education in abstract classes in the process. I almost forgot C++ rules.

But I have two questions regarding that:
(1) I am still not able to save the position information in a variable
(2) reqAccountUpdates seems updates account information every 3 min (based on a google group thread). How do I make it update only once and stop.
 
Is this really supposed to work as you have coded ? I get an empty array on the print statement.

Like I said I don't use Ibpy, so this was a punt. If you're willing to switch to swigibpy then you can, as I said, get a complete working example from here http://qoppac.blogspot.co.uk/2014/05/getting-accounting-data-out-of.html. That also means if you have any other problems then I can probably help with them.

Otherwise, you're on your own, unless there is someone willing and able to get an ibpy version working.

GAT
 
Like I said I don't use Ibpy, so this was a punt. If you're willing to switch to swigibpy then you can, as I said, get a complete working example from here http://qoppac.blogspot.co.uk/2014/05/getting-accounting-data-out-of.html. That also means if you have any other problems then I can probably help with them.

Otherwise, you're on your own, unless there is someone willing and able to get an ibpy version working.

GAT

I would have used swigibipy but I dont have permission to install it on the machine I am working on.

Is there a way to implement swigibipy without installation ?
 
I would have used swigibipy but I dont have permission to install it on the machine I am working on.

Is there a way to implement swigibipy without installation ?

Not as far as I know. Weird you can install ibpy but not swgibpy

GAT
 
I was able to make your code work with some modification and got an education in abstract classes in the process. I almost forgot C++ rules.

But I have two questions regarding that:
(1) I am still not able to save the position information in a variable
(2) reqAccountUpdates seems updates account information every 3 min (based on a google group thread). How do I make it update only once and stop.

For your second question
tws_conn.reqAccountUpdates(False,'DU15211')

GAT
 
Back
Top