API Support Forum
OEC API > API Support > Placing an order
Author Topic: Placing an order
(2 messages, Page 1 of 1)
Moderators: VPfau
BFeddish
Posts: 7
Joined: Aug 07, 2015


Posted: Sep 29, 2015 @ 09:49 AM             Msg. 1 of 2
I see your sample code for placing an order, i.e.:

private static void PlaceOrder(OEC.API.Contract contract, OEC.Data.OrderSide orderSide, double limitPrice, string comments)

but is there a way to create the contract within this function, i.e. one for MSFT or do I need to call the "SymbolLookup" then wait for a "oecClient1_OnSymbolLookupReceived" to get my contract value?

Thanks,
Bryan

Brayn Feddish
NShine
Posts: 36
Joined:


Posted: Sep 29, 2015 @ 11:37 AM             Msg. 2 of 2
Contract data is more than just a string (e.g., "MSFT"). It contains a lot of information about the properties of that individual contract, as well as potential properties of its base contract. To place an order (through the API SendOrder function), you must have a Contract type variable in your OrderDraft. Initially, you can only find these through a lookup, but you can save them locally if you don't want to be repeating lookups.

Also, you can check your OECClient.Global.Contracts to see if the contract you want is already available.

Contract c = OECClient.Global.Contracts["MSFT"];
if (c == null)
// do lookup

Edited by NShine on Sep 29, 2015 at 11:39:24