IB: GET_POSITION is sometimes invalid?

Posted By: AndrewAMD

IB: GET_POSITION is sometimes invalid? - 08/19/19 18:41

jcl,

With the IB plugin, GET_POSITION sometimes returns 0, even when a nonzero position exists! Apparently it returns 0 to indicate that there was a problem! So if it ever returns 0, I cannot rely on the output.

Perhaps the IB plugin can support a new command, GET_POSITIONISVALID? It indicates whether the previous GET_POSITION call output was an actual position or not. 0: not supported. 1: call was valid. 2: previous call resulted in an error.

This would be especially useful for pool management.

Thanks,
Andrew
Posted By: jcl

Re: IB: GET_POSITION is sometimes invalid? - 08/20/19 08:14

That command would probably not help much. If GET_POSITION wrongly returns 0, then GET_POSITIONISVALID could also wrongly return 1, due to the same error.

It is better to find out what error that was. For which assets does GET_POSITION return a wrong value and under which circumstances?
Posted By: AndrewAMD

Re: IB: GET_POSITION is sometimes invalid? - 08/20/19 10:52

Good question, I do not know if I can repeat the issue. There was one time where I was still connected, but every single GET_POSITION in my stock portfolio was returning 0 when there should have been positions. At least I think I was connected.

I will see if it comes up again.
© 2024 lite-C Forums