I definitely agree that it is Eugene's project and am very grateful that he
made
it available for all of us. It is quite a gift. What makes it even more useful
is experience, suggestions and QA that all of the user's group have
contributed.
Creating another variant is certainly possible, but it ( the other variant)
will
not have the benefit of that group input. That is why JArbitrager, which is
such
a variant, appears to be largely DOA.
The code to trade multiple instruments is very simple. It is available from the
IB API guide ( I have pasted it below). A more difficult question is where in
the JBT code it belongs. That requires a very detailed understanding of JBT
architecture, which at this point I do not have. If anyone has suggestions,
please post them.
Here is the code from IB API. This example provides step by step instruction
(3
steps in all) for creating a spread for Google options:
//First leg
Contract con1 = new Contract();
con1.m_symbol = "GOOG";
con1.m_secType = "OPT";
con1.m_expiry = “200909”;
con1.m_strike = 150.0
con1.m_right = “C”
con1.m_multiplier = “100”
con1.m_exchange = "SMART”;
con1.m_currency = "USD";
.reqContractDetails(1, con1);
//Second leg
Contract con2 = new Contract();
con2.m_symbol = "GOOG";
con2.m_secType = "OPT";
con2.m_expiry = “201101”;
con2.m_strike = 150.0
con2.m_right = “C”
con2.m_multiplier = “100”
con2.m_exchange = "SMART”;
con2.m_currency = "USD";
.reqContractDetails(2, con2);
//All conId numbers are delivered by the ContractDetail()
static public String contractDetails(int reqId, ContractDetails
contractDetails)
{
Contract contract = contractDetails.m_summary;
/*Base on the request above,
reqId = 1 is corresponding to the first request or first leg
reqId = 2 is corresponding to the second request or second leg*/
if (reqId == 1)
{ Leg1_conId = contract.m_conId;} // to obtain conId for first leg
if (reqId == 2)
{ Leg2_conId = contract.m_conId;} // to obtain conId for second leg
}Step 2:
ComboLeg leg1 = new ComboLeg(); // for the first leg
ComboLeg leg2 = new ComboLeg(); // for the second leg
Vector addAllLegs = new Vector();
leg1.m_conId = Leg1_conId;
leg1.m_ratio = 1;
leg1.m_action = "SELL";
leg1.m_exchange = "SMART";
leg1.m_openClose = 0;
leg1.m_shortSaleSlot = 0;
leg1.m_designatedLocation = "";
leg2.m_conId = Leg2_conId;
leg2.m_ratio = 1;
leg2.m_action = "BUY";
leg2.m_exchange = "SMART";
leg2.m_openClose = 0;
leg2.m_shortSaleSlot = 0;
leg2.m_designatedLocation = "";
addAllLegs.add(leg1);
addAllLegs.add(leg2);
STEP 3:
Contract contract = new Contract();
Order order = new Order();
contract.m_symbol = "USD"; // For combo order use “USD” as the
symbol value all the time
contract.m_secType = "BAG"; // BAG is the security type for COMBO
order
contract.m_exchange = "SMART";
contract.m_currency = "USD";
contract.m_comboLegs = addAllLegs; //including combo order in contract object
order.m_action = “BUY”;
order.m_totalQuantity = 1;
order.m_orderType = “MKT”
.placeOrder(OrderId, contract, order);Invoke the placeOrder() method with the
appropriate contract and order objects:Once the program has acquired the conId
value for each leg, include it in the ComboLeg object:
________________________________
From: ShaggsTheStud <[email protected]>
To: [email protected]
Sent: Mon, November 15, 2010 9:15:53 PM
Subject: Re: [JBookTrader] Re: Live Trading Journal
The best thing for Eugene to do is to work on JBT in the form that he likes
it. If he no longer likes working on it anymore, then his progress will
stop.
I don't think he will be upset if anyone uses it as a base for some other
variant (although you should give proper credit, as this code that he has given
us is quite a gift!) You just have to be willing to get your hands dirty.
On that note, I am now putting out a formal challenge for someone to fork the
project to handle multiple instruments! Who has what it takes to see that
through from start to finish? I know I have the skill, but I personally do not
have the time.
On Mon, Nov 15, 2010 at 4:30 PM, Astor <[email protected]> wrote:
Eugene, it is hard to prove the benefit of combining spread trading with book
trading without actually doing it. I think spread strategy can benefit from
some of the indicators available in JBT and vice versa. It does not make sense
to keep the two types of approaches separate, because they are complimentary.
All JBT indicators zoom in on market sentiment. Spread trading indicators zooms
in on relative valuation. When both types of indicators say "buy", the security
is both, undervalued and market sentiment is turning in its favor - should be a
far more consistent performer than separately.
>
>Ability to maintain a market neutral exposure is also very important.
>
>In any event, I will stick around.
>
>
________________________________
From: nonlinear5 <[email protected]>
>To: JBookTrader <[email protected]>
>Sent: Mon, November 15, 2010 9:06:49 AM
>Subject: [JBookTrader] Re: Live Trading Journal
>
>> Eugene, now that the JBT performance is so good, can you update Jarbitrager
or
>> add spread trading capability to JBT?
>
>Astor, I know that you've been advocating merging the capabilities of
>JA and JBT into a single framework, but I believe they are
>conceptually different enough to evolve independently. Over the life
>cycle of JBT, I've quite religiously resisted the functionality which
>I believe to be "bells and whistles". That includes support for other
>brokers, database storage, command line and batch processing,
>portfolio management, and various third-party packages for web
>console. You can browse these features here:
>http://code.google.com/p/jbooktrader/source/browse/#svn/tags/jbooktrader-fg-0.3
>
>I am a big proponent of simplicity. Reducing the JBT code base makes
>me happier than adding to it. I'd much prefer to have JBT defined and
>developed in a narrow scope, with the small, compact, and well-
>understood set of features. In the end, my purpose is not to maximize
>the user base, but to maximize the code efficiency in the sense that
>would allow me to use JBT to accommodate my trading strategies with
>the smallest effort required to maintain and evolve the code base.
>
>Now, I fully understand that everyone's approach to trading is
>different. It may be well be the fact that combining spread trading
>with the limit book trading is beneficial. However, until proven so, I
>am not willing to put my efforts into it. I hope you stick around,
>Astor, as you contributions to both JBT and JA have been valuable.
>
>
>
>
>
>--
>You received this message because you are subscribed to the Google Groups
>"JBookTrader" group.
>To post to this group, send email to [email protected].
>To unsubscribe from this group, send email to
>[email protected].
>For more options, visit this group at
>http://groups.google.com/group/jbooktrader?hl=en.
>
>
>--
>You received this message because you are subscribed to the Google Groups
>"JBookTrader" group.
>To post to this group, send email to [email protected].
>To unsubscribe from this group, send email to
>[email protected].
>For more options, visit this group at
>http://groups.google.com/group/jbooktrader?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"JBookTrader" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jbooktrader?hl=en.
Step 1: Get the Contract IDs for both leg definitions:
--
You received this message because you are subscribed to the Google Groups
"JBookTrader" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jbooktrader?hl=en.