ranaroussi / ezibpy

ezIBpy, a Pythonic Client for Interactive Brokers API
Apache License 2.0
324 stars 116 forks source link

order type and destination #12

Closed mcg88 closed 7 years ago

mcg88 commented 7 years ago

Hello,

I'm trying to figure out if it is possible to set the order type and the order destination explicitly when sending an order.

Line 1375 in ezibpy.py defines the params for the order but I'm not sure those two items are available to be modified.

Thanks

ranaroussi commented 7 years ago

Of course you can :)

The default order type is set to MKT if price is either 0 or not set, and LMT if price is set.

That, being said, if you want to use a different order type, simply add the orderType parameter to the createOrder(...) method with any of the supported order types and you're good to go.

For Stop/Target orders, I suggest you check out createStopOrder(), createTrailingStopOrder(), createTargetOrder()and createBracketOrder().

ranaroussi commented 7 years ago

Closing this for now. Please re-open if needed