softwarespartan / IB4m

Interactive Brokers API for Matlab
GNU General Public License v2.0
62 stars 21 forks source link

added stop and stop limit orders to OrderFactory -- how to compile TWS package #4

Open roughtrader opened 7 years ago

roughtrader commented 7 years ago

Hello,

Fantastic work on this matlab IB API! After downloading TWS-master, I have added stop and stop limit orders to your OrderFactory.java source code. As I have not programmed in java before, I am not sure how to compile all the source code into class files.

From there, I know I can contain the compiled java code in a new TWS.jar, but I am getting errors when doing a javac *.java in each source code directory. Any tips?

Thanks,

Ken

softwarespartan commented 7 years ago

Hi Ken

Thanks for reaching out. You can make the order directly from within Matlab. Traveling internationally right now . Will show you easy example this weekend. No need to recompile jar!

Sent from my iPhone

On Apr 29, 2017, at 1:11 AM, roughtrader notifications@github.com wrote:

Hello,

Fantastic work on this matlab IB API! After downloading TWS-master, I have added stop and stop limit orders to your OrderFactory.java source code. As I have not programmed in java before, I am not sure how to compile all the source code into class files.

From there, I know I can contain the compiled java code in a new TWS.jar, but I am getting errors when doing a javac *.java in each source code directory. Any tips?

Thanks,

Ken

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

roughtrader commented 7 years ago

Thanks Abel, looking forward to it!

Ken

On Fri, Apr 28, 2017 at 4:28 PM, Abel Brown notifications@github.com wrote:

Hi Ken

Thanks for reaching out. You can make the order directly from within Matlab. Traveling internationally right now . Will show you easy example this weekend. No need to recompile jar!

Sent from my iPhone

On Apr 29, 2017, at 1:11 AM, roughtrader notifications@github.com wrote:

Hello,

Fantastic work on this matlab IB API! After downloading TWS-master, I have added stop and stop limit orders to your OrderFactory.java source code. As I have not programmed in java before, I am not sure how to compile all the source code into class files.

From there, I know I can contain the compiled java code in a new TWS.jar, but I am getting errors when doing a javac *.java in each source code directory. Any tips?

Thanks,

Ken

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/4#issuecomment-298128915, or mute the thread https://github.com/notifications/unsubscribe-auth/AZxnmJORcsrarW6nRX98TKTXHwekaazMks5r0nYFgaJpZM4NMDuU .

softwarespartan commented 7 years ago

Hi Ken

The order object can be created on demand in Matlab. No need for OrderFactory. Order factory just creates order object with specific (very common) configurations — there is nothing special going on.

You can create orders directly in Matlab with

order = com.ib.client.Order()

order =

com.ib.client.Order@456f7a09

Then ask for the associated fields/properties on the object (see fields highlighted in red)

fields(order)

ans =

104×1 cell array

'CUSTOMER'
'FIRM'
'OPT_UNKNOWN'
'OPT_BROKER_DEALER'
'OPT_CUSTOMER'
'OPT_FIRM'
'OPT_ISEMM'
'OPT_FARMM'
'OPT_SPECIALIST'
'AUCTION_MATCH'
'AUCTION_IMPROVEMENT'
'AUCTION_TRANSPARENT'
'EMPTY_STR'
'm_orderId'
'm_clientId'
'm_permId'
'm_action'
'm_totalQuantity'
'm_orderType'
'm_lmtPrice'
'm_auxPrice'
'm_tif'
'm_activeStartTime'
'm_activeStopTime'
'm_ocaGroup'
'm_ocaType'
'm_orderRef'
'm_transmit'
'm_parentId'
'm_blockOrder'
'm_sweepToFill'
'm_displaySize'
'm_triggerMethod'
'm_outsideRth'
'm_hidden'
'm_goodAfterTime'
'm_goodTillDate'
'm_overridePercentageConstraints'
'm_rule80A'
'm_allOrNone'
'm_minQty'
'm_percentOffset'
'm_trailStopPrice'
'm_trailingPercent'
'm_faGroup'
'm_faProfile'
'm_faMethod'
'm_faPercentage'
'm_openClose'
'm_origin'
'm_shortSaleSlot'
'm_designatedLocation'
'm_exemptCode'
'm_discretionaryAmt'
'm_eTradeOnly'
'm_firmQuoteOnly'
'm_nbboPriceCap'
'm_optOutSmartRouting'
'm_auctionStrategy'
'm_startingPrice'
'm_stockRefPrice'
'm_delta'
'm_stockRangeLower'
'm_stockRangeUpper'
'm_volatility'
'm_volatilityType'
'm_continuousUpdate'
'm_referencePriceType'
'm_deltaNeutralOrderType'
'm_deltaNeutralAuxPrice'
'm_deltaNeutralConId'
'm_deltaNeutralSettlingFirm'
'm_deltaNeutralClearingAccount'
'm_deltaNeutralClearingIntent'
'm_deltaNeutralOpenClose'
'm_deltaNeutralShortSale'
'm_deltaNeutralShortSaleSlot'
'm_deltaNeutralDesignatedLocation'
'm_basisPoints'
'm_basisPointsType'
'm_scaleInitLevelSize'
'm_scaleSubsLevelSize'
'm_scalePriceIncrement'
'm_scalePriceAdjustValue'
'm_scalePriceAdjustInterval'
'm_scaleProfitOffset'
'm_scaleAutoReset'
'm_scaleInitPosition'
'm_scaleInitFillQty'
'm_scaleRandomPercent'
'm_scaleTable'
'm_hedgeType'
'm_hedgeParam'
'm_account'
'm_settlingFirm'
'm_clearingAccount'
'm_clearingIntent'
'm_algoStrategy'
'm_algoParams'
'm_whatIf'
'm_notHeld'
'm_smartComboRoutingParams'
'm_orderComboLegs'
‘m_orderMiscOptions'

You can then set these object properties in Matlab just like you would fields in a struct

order.m_orderType = ‘STP' order.m_action=‘SELL'

and so on …

You can create contracts in the same way …

Let me know if this helps or you need anything additional. I am back on EST and should be around most of the week.

Do not hesitate to reach out if you have more questions.

Cheers -abel

On Apr 28, 2017, at 8:07 PM, roughtrader notifications@github.com wrote:

Thanks Abel, looking forward to it!

Ken

On Fri, Apr 28, 2017 at 4:28 PM, Abel Brown <notifications@github.com mailto:notifications@github.com> wrote:

Hi Ken

Thanks for reaching out. You can make the order directly from within Matlab. Traveling internationally right now . Will show you easy example this weekend. No need to recompile jar!

Sent from my iPhone

On Apr 29, 2017, at 1:11 AM, roughtrader <notifications@github.com mailto:notifications@github.com> wrote:

Hello,

Fantastic work on this matlab IB API! After downloading TWS-master, I have added stop and stop limit orders to your OrderFactory.java source code. As I have not programmed in java before, I am not sure how to compile all the source code into class files.

From there, I know I can contain the compiled java code in a new TWS.jar, but I am getting errors when doing a javac *.java in each source code directory. Any tips?

Thanks,

Ken

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/softwarespartan/IB4m/issues/4#issuecomment-298128915 https://github.com/softwarespartan/IB4m/issues/4#issuecomment-298128915>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AZxnmJORcsrarW6nRX98TKTXHwekaazMks5r0nYFgaJpZM4NMDuU https://github.com/notifications/unsubscribe-auth/AZxnmJORcsrarW6nRX98TKTXHwekaazMks5r0nYFgaJpZM4NMDuU> .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/4#issuecomment-298132900, or mute the thread https://github.com/notifications/unsubscribe-auth/AEWq1JAYCBhf9tUR2k3T--KCfp5BPSjwks5r0n9VgaJpZM4NMDuU.

roughtrader commented 7 years ago

Hi Abel,

Thanks so much for the tip, I tried it and it works beautifully. You are very generous to release this awesome code for free, it is much better than the trading toolbox in matlab!

Best,

Ken

On Mon, May 1, 2017 at 5:30 AM, Abel Brown notifications@github.com wrote:

Hi Ken

The order object can be created on demand in Matlab. No need for OrderFactory. Order factory just creates order object with specific (very common) configurations — there is nothing special going on.

You can create orders directly in Matlab with

order = com.ib.client.Order()

order =

com.ib.client.Order@456f7a09

Then ask for the associated fields/properties on the object (see fields highlighted in red)

fields(order)

ans =

104×1 cell array

'CUSTOMER' 'FIRM' 'OPT_UNKNOWN' 'OPT_BROKER_DEALER' 'OPT_CUSTOMER' 'OPT_FIRM' 'OPT_ISEMM' 'OPT_FARMM' 'OPT_SPECIALIST' 'AUCTION_MATCH' 'AUCTION_IMPROVEMENT' 'AUCTION_TRANSPARENT' 'EMPTY_STR' 'm_orderId' 'm_clientId' 'm_permId' 'm_action' 'm_totalQuantity' 'm_orderType' 'm_lmtPrice' 'm_auxPrice' 'm_tif' 'm_activeStartTime' 'm_activeStopTime' 'm_ocaGroup' 'm_ocaType' 'm_orderRef' 'm_transmit' 'm_parentId' 'm_blockOrder' 'm_sweepToFill' 'm_displaySize' 'm_triggerMethod' 'm_outsideRth' 'm_hidden' 'm_goodAfterTime' 'm_goodTillDate' 'm_overridePercentageConstraints' 'm_rule80A' 'm_allOrNone' 'm_minQty' 'm_percentOffset' 'm_trailStopPrice' 'm_trailingPercent' 'm_faGroup' 'm_faProfile' 'm_faMethod' 'm_faPercentage' 'm_openClose' 'm_origin' 'm_shortSaleSlot' 'm_designatedLocation' 'm_exemptCode' 'm_discretionaryAmt' 'm_eTradeOnly' 'm_firmQuoteOnly' 'm_nbboPriceCap' 'm_optOutSmartRouting' 'm_auctionStrategy' 'm_startingPrice' 'm_stockRefPrice' 'm_delta' 'm_stockRangeLower' 'm_stockRangeUpper' 'm_volatility' 'm_volatilityType' 'm_continuousUpdate' 'm_referencePriceType' 'm_deltaNeutralOrderType' 'm_deltaNeutralAuxPrice' 'm_deltaNeutralConId' 'm_deltaNeutralSettlingFirm' 'm_deltaNeutralClearingAccount' 'm_deltaNeutralClearingIntent' 'm_deltaNeutralOpenClose' 'm_deltaNeutralShortSale' 'm_deltaNeutralShortSaleSlot' 'm_deltaNeutralDesignatedLocation' 'm_basisPoints' 'm_basisPointsType' 'm_scaleInitLevelSize' 'm_scaleSubsLevelSize' 'm_scalePriceIncrement' 'm_scalePriceAdjustValue' 'm_scalePriceAdjustInterval' 'm_scaleProfitOffset' 'm_scaleAutoReset' 'm_scaleInitPosition' 'm_scaleInitFillQty' 'm_scaleRandomPercent' 'm_scaleTable' 'm_hedgeType' 'm_hedgeParam' 'm_account' 'm_settlingFirm' 'm_clearingAccount' 'm_clearingIntent' 'm_algoStrategy' 'm_algoParams' 'm_whatIf' 'm_notHeld' 'm_smartComboRoutingParams' 'm_orderComboLegs' ‘m_orderMiscOptions'

You can then set these object properties in Matlab just like you would fields in a struct

order.m_orderType = ‘STP' order.m_action=‘SELL'

and so on …

You can create contracts in the same way …

Let me know if this helps or you need anything additional. I am back on EST and should be around most of the week.

Do not hesitate to reach out if you have more questions.

Cheers -abel

On Apr 28, 2017, at 8:07 PM, roughtrader notifications@github.com wrote:

Thanks Abel, looking forward to it!

Ken

On Fri, Apr 28, 2017 at 4:28 PM, Abel Brown <notifications@github.com mailto:notifications@github.com> wrote:

Hi Ken

Thanks for reaching out. You can make the order directly from within Matlab. Traveling internationally right now . Will show you easy example this weekend. No need to recompile jar!

Sent from my iPhone

On Apr 29, 2017, at 1:11 AM, roughtrader <notifications@github.com mailto:notifications@github.com> wrote:

Hello,

Fantastic work on this matlab IB API! After downloading TWS-master, I have added stop and stop limit orders to your OrderFactory.java source code. As I have not programmed in java before, I am not sure how to compile all the source code into class files.

From there, I know I can contain the compiled java code in a new TWS.jar, but I am getting errors when doing a javac *.java in each source code directory. Any tips?

Thanks,

Ken

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/softwarespartan/IB4m/issues/4# issuecomment-298128915 https://github.com/softwarespartan/IB4m/issues/4# issuecomment-298128915>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AZxnmJORcsrarW6nRX98TKTXHwekaazMks5r0nYFgaJpZM4NMDuU https://github.com/ notifications/unsubscribe-auth/AZxnmJORcsrarW6nRX98TKTXHwekaa zMks5r0nYFgaJpZM4NMDuU> .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ softwarespartan/IB4m/issues/4#issuecomment-298132900, or mute the thread https://github.com/notifications/unsubscribe-auth/AEWq1JAYCBhf9tUR2k3T-- KCfp5BPSjwks5r0n9VgaJpZM4NMDuU.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/4#issuecomment-298326717, or mute the thread https://github.com/notifications/unsubscribe-auth/AZxnmNuYEGW_P-lmkq3YS4FEQKoHbQnpks5r1dBUgaJpZM4NMDuU .