Closed vdzoba closed 3 years ago
Can you me in layman’s terms what you’re trying to buy? Are you just trying to buy a call contract?
On Fri, Aug 14, 2020, at 16:41, vdzoba wrote:
Hi. I'm trying to place an option order. But, get errors from TD: Non 200 response: [400 - { "error" : "Following parameters are not allowed when placing an order: optionDeliverables" }] Here is how i submit an order. I do not set optionDeliverables. There is no setter for it. Order order = new Order(); order.setOrderType(OrderType.LIMIT); order.setSession(Session.NORMAL); order.setDuration(Duration.DAY); order.setPrice(new BigDecimal("1")); order.setOrderStrategyType(OrderStrategyType.SINGLE);
` OrderLegCollection olc = new OrderLegCollection(); order.getOrderLegCollection().add(olc);
olc.setInstruction(OrderLegCollection.Instruction.BUY_TO_OPEN);
olc.setOrderLegType(OrderLegCollection.OrderLegType.OPTION);
olc.setQuantity(defaultOptionQuantity);
OptionInstrument instrument = new OptionInstrument();
instrument.setSymbol(symbol);
instrument.setAssetType(Instrument.AssetType.OPTION);
olc.setInstrument(instrument);
`
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/studerw/td-ameritrade-client/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQHJA5IAA3AGBIE57YC463SAWVSLANCNFSM4P74JPVQ.
Yes. I'm trying to buy a call. Looks like I need to properly set symbol, which includes date, strike price and type (call/put). Do I need to set anything else?
In Debug I just set to null optionDeliverables variable and order was successfully placed. But, there is no setter for this field. Can you introduce a setter there?
I can confirm I see the same issue. optionDeliverables should be null when an order is placed. Worked around by: FieldUtils.writeField(instrument, "optionDeliverables", null, true);
but yeah, a setter is needed (and default to null).
Added setters to all the fields in OptionInstrument in case they're used in creating Option Orders (and must be set null or otherwise).
Hi. I'm trying to place an option order. But, get errors from TD: Non 200 response: [400 - { "error" : "Following parameters are not allowed when placing an order: optionDeliverables" }] Here is how i submit an order. I do not set optionDeliverables. There is no setter for it. Order order = new Order(); order.setOrderType(OrderType.LIMIT); order.setSession(Session.NORMAL); order.setDuration(Duration.DAY); order.setPrice(new BigDecimal("1")); order.setOrderStrategyType(OrderStrategyType.SINGLE);