API Support Forum
OEC API > API Support > OECAPICOM::IOrderDraftPtr Contract
Author Topic: OECAPICOM::IOrderDraftPtr Contract
(5 messages, Page 1 of 1)
Moderators: VPfau
MDe las heras
Posts: 3
Joined: Mar 05, 2013


Posted: Oct 24, 2013 @ 05:12 AM             Msg. 1 of 5
Hi,

About send orders. When i want to send a new order, i must to put a determinate contrac inside OECAPICOM::IOrderDraftPtr, but, Do I should get the contract information before send the order? Can I send a new orden to 'ESZ3' sending only this instrument code?
OECAPI()->RequestContracts(OECAPI()->BaseContracts->FindBySymbol("ES"));


Regards

Miguel angel De las heras
MDe las heras
Posts: 3
Joined: Mar 05, 2013


Posted: Oct 24, 2013 @ 09:11 AM             Msg. 2 of 5
i've seen the solution.

OECAPICOM::IContractPtr contract = OECAPI()->Contracts->Item("ESH4");

Regards.

Miguel angel De las heras
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Oct 25, 2013 @ 09:35 AM             Msg. 3 of 5
Hi. There is a chance that OECAPI()->Contracts->Item("ESH4") will return NULL. OECAPI loads on start only previously traded contracts (for example, if you have a position or an order with such contract). A better way is to lookup a symbol via OECAPI()->SymbolLookup(..) method. Code sample can be found in CppCOMSample

Victor Vins
Lead Software Developer
MDe las heras
Posts: 3
Joined: Mar 05, 2013


Posted: Oct 28, 2013 @ 10:38 AM             Msg. 4 of 5
Thanks for your answer.

I've seen the sample in your ccp, and I have a small problem. Maybe, i know your answer, but i would like read your reply: "If i want to send a new order to a deteminate contract (i don't have any order or position. This is my first operation), Should i do the search and find the contract before new order's sending?"



Regards.

Miguel angel De las heras
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Oct 29, 2013 @ 01:18 PM             Msg. 5 of 5
This is correct.

Victor Vins
Lead Software Developer