API Support Forum
OEC API > API Support > Procedure written using OEC API
Author Topic: Procedure written using OEC API
(2 messages, Page 1 of 1)
Moderators: VPfau
Posts: 18

Posted: Dec 15, 2020 @ 07:39 AM             Msg. 1 of 2
Trying to figure out how to write the following procedure using the GF API COM???

Public Sub CancelActiveOrder(ByVal lPointer As Long)

Dim ActiveOrder As GF_Api_COM.ordersApi

On Error GoTo Err_CancelActiveOrder

' Find the Order that is still Active, then Cancel It
Set ActiveOrder = Glob.c.orders.Item(aryCommodities(lPointer).Trade_ModifyId)
If Not ActiveOrder Is Nothing Then
If Form_Login.GetAccount().ID = ActiveOrder.Account.ID Then
Glob.c.CancelOrder ActiveOrder
End If
End If

On Error Resume Next
Exit Sub

gParms = CStr(lPointer)
Call LogError(Err.Number, Err.Description, "NESClass", "CancelActiveOrder()", gParms)
Resume Exit_CancelActiveOrder
Anthony Sykes
Posts: 49
Joined: Aug 24, 2017

Posted: Jan 06, 2021 @ 10:37 AM             Msg. 2 of 2
I'm not sure if I have enough context to help you. What seems to be the issue?

I am wondering if this type is correct:
Dim ActiveOrder As GF_Api_COM.ordersApi

OrdersApi is an object that contains methods related to orders, not an order itself.