dvasdekis / ib-gateway-docker-gcp

Leaner and Faster Interactive Brokers Docker Trading Gateway
MIT License
68 stars 19 forks source link

added environment variable (argument to docker run) to control IBC Re… #15

Closed ghost closed 1 year ago

ghost commented 3 years ago

…adOnlyApi flag exposed in IBC 3.8.1+.

I hope I did this a reasonable way! In order to edit IBController.ini at runtime, I had to move the "main logic" into a separate shell script and add a 'sed -i' command to it. If there is a better way to do this, I'm all ears! (If only IBController.ini interpreted environment variables on its own, this would be trivial...)

If the -e READ_ONLY_API=[yes|no] argument is not passed to docker run, the READ_ONLY_API environment variable will remain empty, and the READ_ONLY_API string in IBController.ini will be replaced with an empty string, which is the default in IBC 3.8.1+ and means "don't change the current TWS read-only API configuration" (see https://github.com/IbcAlpha/IBC/releases/tag/3.8.1).

Thanks!!

ghost commented 3 years ago

Uhh, should I be merging this into a new branch instead of v978?

dvasdekis commented 3 years ago

Thanks for the commit! Let me have a read and get back to you.

dvasdekis commented 3 years ago

Given that Read-Only API access is just not very valuable relative to a Read-Write API (and I use a similar method to yourself to override the parameter to yes), I might just change the whole approach to set both ReadOnlyLogin and ReadOnlyAPI to no.

Does this suit your use case? You've taken the approach I would in using sed at runtime to change the parameter, but maybe we can just set it to no. Let me know within a week or two if that breaks things for you!

ghost commented 3 years ago

It suits my use case fine, and is definitely a simpler and easier thing to do, but I had thought for some users the read-only setting might be a useful safety measure. Not sure though! Maybe it's unnecessary!

dvasdekis commented 3 years ago

I would normally agree with you and not make a 'deliberately insecure' change like this, but I think most users would start their algos with paper trading anyway!

I'll make a new branch for this change with new tags. Hopefully there's been a new release of IB's gateway that I can align it to.

On Fri, Jan 15, 2021 at 1:59 AM Doug Swanson notifications@github.com wrote:

It suits my use case fine, and is definitely a simpler and easier thing to do, but I had thought for some users the read-only setting might be a useful safety measure. Not sure though! Maybe it's unnecessary!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dvasdekis/ib-gateway-docker-gcp/pull/15#issuecomment-760289133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETC4JPADRNDRABUEGXHOM3SZ4IFBANCNFSM4U5ZTNBA .

ghost commented 3 years ago

Ah, right, fair enough! OK, thanks!! Feel free to close this PR.

On Thu, Jan 14, 2021 at 11:13 PM dvasdekis notifications@github.com wrote:

I would normally agree with you and not make a 'deliberately insecure' change like this, but I think most users would start their algos with paper trading anyway!

I'll make a new branch for this change with new tags. Hopefully there's been a new release of IB's gateway that I can align it to.

On Fri, Jan 15, 2021 at 1:59 AM Doug Swanson notifications@github.com wrote:

It suits my use case fine, and is definitely a simpler and easier thing to do, but I had thought for some users the read-only setting might be a useful safety measure. Not sure though! Maybe it's unnecessary!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/dvasdekis/ib-gateway-docker-gcp/pull/15#issuecomment-760289133 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AETC4JPADRNDRABUEGXHOM3SZ4IFBANCNFSM4U5ZTNBA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dvasdekis/ib-gateway-docker-gcp/pull/15#issuecomment-760536920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALZHVPP5KFDRNPV5G5BER3SZ53CHANCNFSM4U5ZTNBA .