API Support Forum
User Profile

Viewing User Profile for: ASykes4318


About

N/A

Nov 20, 2020 02:50 PM

Nov 20, 2020 02:50 PM



Post Statistics
ASykes4318 has contributed to 11 posts out of 4944 total posts

20 most recent posts:

API Support » Auto-cenceled on trade sent using "Sample COM Book.xls" Nov 20, 2020 @ 02:50 PM (Total replies: 1)

I'm testing the new GFAPI using the COM and Excel spreadsheet from Gain Futures...but when I send a "Marker if Touched" it is Auto-cancelled (All trade types are being Auto-canceled) . What are we doing wrong??

Completed Orders information:

Account,Order #,State,Avg.Price,Side,Qty,Filled Qty,Symbol,Price,Last.Cmd,Comments,Time,Post-Allocation,Fill Time,Completed Time
API010024,209453134,Cancelled,,Buy,1,0,GCLF21,MOC,Auto-cancelled,,13:41:47.889,,,13:41:50.036


Please advise

Anthony Sykes
User Name ASykes4318
Account API010024
Anthony Sykes


API Support » Trying to get contract Id Nov 05, 2020 @ 09:10 PM (Total replies: 0)

The following code is not returning Contract or Contract Id:


'---------------------------------------------------
'decleration
Private api As GF_Api_COM.IGFComClient

Dim Contract As GF_Api_COM.iContract
Dim myContract As Contract
Dim name As String
Dim ConID, requestID As Long

Dim builder As SymbolLookupRequestBuilder
Set builder = New SymbolLookupRequestBuilder

name = "GCLZ20"
Set myContract = api.Contracts.Get_2(name)

Debug.Print , ".builder.WithSymbol " & name & " My Contract ID:" & ConID
'builder.WithSymbol Name, TextSearchMode_StartsWith
If Not (myContract Is Nothing) Then
builder.WithSymbol name, TextSearchMode_Exact
ConID = Contract.ID
Set requestID = api.Contracts.lookup.BySymbol(name)

builder.WithResultCount 1
api.Contracts.lookup.ByCriteria builder.Build

End If

If Not (Contract Is Nothing) Then
'>>> Contract is nothing here !!!
'Stop
ConID = Contract.ID
End If
'---------------------------------------------------
Anthony Sykes


API Support » Error: -2146233079 Descr: Price server not connected Nov 02, 2020 @ 12:26 PM (Total replies: 3)

When using your example I'm not getting that error. Any thoughts as to why the remote host (GF server??) is forcibly closing??

Our application is saying that we are still connected
Anthony Sykes


API Support » Error: -2146233079 Descr: Price server not connected Nov 02, 2020 @ 09:21 AM (Total replies: 3)

We are connecting to the “Aggregate” server, however in the Public Sub SubscribeAll we are getting “Price server not connected” error.
What should we be doing different???

If client Is Nothing Then
Set client = New GFComClient
client.Threading.CreateRunnerFor(client).Start
Set connection = client.connection.Aggregate
Server = "api.gainfutures.com"
End If

Dim builder As ConnectionContextBuilder
Set builder = New ConnectionContextBuilder

builder.WithUserName(Name) _
.WithPassword(Pass) _
.WithUUID("5549126e-9866-488f-b7c8-156683f8eacc") _
.WithHost(Server) _
.WithPort (9210)

connection.Connect builder.Build
Anthony Sykes


API Support » COM sample code not working GF API Oct 27, 2020 @ 04:55 AM (Total replies: 1)

The following is a sample code from the Excel COM spreadsheet provided by GF. The Set bc not working, what should be done differently??
bc.Symbol is showing a runtime error

Is there some updated sample code that works??


Private Sub LookupRequest(ByVal Name As String)
If Len(Name) > 0 Then
api.contracts.lookup.BySymbol Name

Dim builder As SymbolLookupRequestBuilder
Set builder = New SymbolLookupRequestBuilder

Dim bc As BaseContract
Set bc = api.contracts.Base.Get_3(Name)

If Not (bc Is Nothing) Then
builder.WithBaseSymbol bc.Symbol, TextSearchMode_StartsWith
Else
builder.WithSymbol Name, TextSearchMode_StartsWith
End If

builder.WithResultCount 1
api.contracts.lookup.ByCriteria builder.Build
End If
End Sub
Anthony Sykes


API Support » Contracts.Lookup.BySymbol() - We are having a problem Oct 26, 2020 @ 08:53 PM (Total replies: 1)

Our applicaton (developed in Microsoft Access), which connects to the API successfully, but we are having difficulties in setting the contract portion. Ou r main goal is to retrieve Contract details such as ContractSize, PriceFomat etc once we can connect.
?? We also have the Excel, that uses the same API and works successfully.
Our function initilized the GF_Api_COM.GFComClient , but following lines does not help to reacing the Contract
'WaitSeconds is a function that waits timer to loop x seconds.
'api = GF_Api_COM.GFComClient ' was already set

'(a)
Set Contract = api.Contracts.Get_2(Name)
WaitSeconds 5

'(b)'If fails, try by .Contracts.Base.Get_3
If Contract Is Nothing Then
Set Contract = api.Contracts.Base.Get_3(Name)
End If

'(c)'If fails: .Contracts.Lookup.BySymbol()
If Contract Is Nothing Then
If lookup Then
Set requestID = api.Contracts.lookup.BySymbol(Name)
' we have told to wait for system to return requestID, meaning contract is set
WaitSeconds 3
Set Contract = api.Contracts.Base.Get_3(Name)
End If
End If
'Contract is NOT set !!!

'Contract spossed to be set at this point, but it never works
If Not Contract Is Nothing Then
'Step (3) set the bc now
'GF_API_COM.GFComClient.Contracts.Base.Get_3()

'(3-a)
Set bc = api.Contracts.Base.Get_3(Name)
'(3-b)
If (bc Is Nothing) Then
Set bc = api.Contracts.Get_2(Name)
End If

If Not (bc Is Nothing) Then
'bc is set Subscribe now
Dim conID As String
conID = Contract.ID
'api.Subscribe Contract
'Set SubscribedContracts(i) = Contract
Dim subscription As PriceSubscription
end if
Anthony Sykes


API Support » = api.BaseContracts.FindBySymbol(Name) in OECAPICOM Sep 07, 2020 @ 05:31 AM (Total replies: 4)

I'm trying to find a way in GF API COM to find the base symbol when the contract name is provided???

Public Sub SubscribeAll(oecApi As OECAPICOM.IOECClient)
Dim Contract As OECAPICOM.iContract, bc As OECAPICOM.IBaseContract
Dim i As Integer, Name As String, t As Integer

On Error GoTo Err_SubscribeAll

Set api = oecApi
t = UBound(aryCommodities()) + 1
For i = 1 To t
With aryCommodities(i - 1)
Name = .Base_Contract
Set Contract = api.Contracts.Item(Name)
If Contract Is Nothing Then
'Set Contract = Glob.FindNearest(Name)
If Not (Contract Is Nothing) Then
ElseIf Len(Name) > 3 Then
Set bc = api.BaseContracts.FindBySymbol(Name)
If Not (bc Is Nothing) Then
.Base_ContractSize = bc.ContractSize
.Base_Margin = Round(bc.InitialMargin / 2, 2)
.Base_PriceFormat = bc.PriceFormat
.Base_PriceMultiplier = bc.PriceMultiplier
.Base_TickSize = bc.TickSize
api.RequestContracts bc
Set Contract = api.Contracts.Item(Name)
End If
End If
Else
Set bc = api.BaseContracts.FindBySymbol(Name)
If Not (bc Is Nothing) Then
.Base_ContractSize = bc.ContractSize
.Base_Margin = Round(bc.InitialMargin / 2, 2)
.Base_PriceFormat = bc.PriceFormat
.Base_PriceMultiplier = bc.PriceMultiplier
.Base_TickSize = bc.TickSize
End If
End If
End With

If Not (Contract Is Nothing) Then
api.Subscribe Contract
Set SubscribedContracts(i) = Contract
Else
Set SubscribedContracts(i) = Nothing
End If

Next i

Exit_SubscribeAll:
On Error Resume Next
Exit Sub

Err_SubscribeAll:
gParms = "OECAPICOM.IOECClient"
Call LogError(Err.Number, Err.Description, "Quotes", "SubscribeAll()", gParms)
Resume Exit_SubscribeAll
Resume Next

End Sub
Anthony Sykes


API Support » api.gainfutures.com Sep 19, 2019 @ 09:52 AM (Total replies: 4)

The issue was with our application...thanks for your response.
Anthony Sykes


API Support » api.gainfutures.com Sep 19, 2019 @ 08:37 AM (Total replies: 4)

Contract
GCLX9
Anthony Sykes


API Support » api.gainfutures.com Sep 19, 2019 @ 08:23 AM (Total replies: 4)

API appear to be not sending prices since yesterday. Is api.gainfutures.com offline as of 09-18-19??
Anthony Sykes


API Support » Excel DDE Add-in not found Aug 27, 2019 @ 03:27 PM (Total replies: 1)

When trying to run OEC Trader Developer Setup Wizard I'm getting the following error:
Cannot find the file Excel DDE Add-in.exe

under select components the Others - Excel DDE Add-in was selected.

What can I do different?
Anthony Sykes