API Support Forum
User Profile

Viewing User Profile for: SRuscak


About

Aug 24, 2017 12:52 PM

Sep 13, 2022 10:06 AM

Sep 13, 2022 10:06 AM



Post Statistics
SRuscak has contributed to 48 posts out of 5432 total posts (0.88%) in 1858 days (0.00 posts per day).

20 most recent posts:

API Support » GF API COM: No DataFeedEntitlementSubscriptionType Inside of IDataFeedEntitlementPtr Sep 13, 2022 @ 10:06 AM (Total replies: 35)

Thank you for bringing this to our attention. We will add the property and release a new version.

Market Data » Get Margin Values Sep 08, 2022 @ 10:33 AM (Total replies: 1)

Hello,

The difference between the Trader calculation and yours is that you have added a HypoOrder, where Trader had none.

FIX Support » Instructions for FIX Sep 07, 2022 @ 03:09 PM (Total replies: 2)

Hello,

We have a FIX section in our online help file: https://gainfutures.com/GFAPI/

Market Data » multiple subscription Jun 16, 2022 @ 10:56 AM (Total replies: 6)

Perhaps you are looking for a complex symbol lookup expression using 'or'? There is an example here that may be useful:
https://gainfutures.com/GFAPI/html/0522b8f0-2870-43a9-ad0a-76a4421cbac1.htm

Maybe something similar to this:
_requestID = client.Contracts.Lookup.ByCriteria(
new SymbolLookupRequestBuilder()
.WithResultCount(50)
.WithExpression(new SymbolLookupExpressionBuilder()
.WithSymbol("ES", TextSearchMode.AnyInclusion)
.WithSymbol("NQ", TextSearchMode.AnyInclusion)
.WithSymbol("6E", TextSearchMode.AnyInclusion)
.Push(SymbolLookupExpressionOperator.Or)
.Push(SymbolLookupExpressionOperator.Or)
.Build())
.Build());


Market Data » multiple subscription Jun 13, 2022 @ 07:47 AM (Total replies: 6)

Hello,

The code you have posted does fetch contracts matching the criteria into the local cache.

However, usually when we say 'subscribe' we refer to a price, charts, or DOM subscription on one of those contracts. This will give you periodic updates for this data. Subscription is a separate call from symbol lookup. You can see code examples here:

https://gainfutures.com/GFAPI
https://gainfutures.com/GFAPI/html/4e2865e8-7ac9-457e-8d5a-6d930f3408a8.htm

API Support » Try to run a sample program from the documentaion get System.TypeLoadException error Sep 17, 2021 @ 02:48 PM (Total replies: 3)

Hello.

The answer is in the GF API assembly warning:
Package 'GFAPI 4.0.3.44' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
.NET Framework assemblies can't be called from .NET Core 3.1.

API Support » GAIN API COM Installer quirk Jan 07, 2021 @ 03:38 PM (Total replies: 1)

No, the behavior you see is correct :) It really is a quirk of the installer software we use, and nothing is supposed to happen. Sorry for the confusion.

API Support » Excel DOM example not working Jan 07, 2021 @ 03:30 PM (Total replies: 1)

Hello,

Yes, this code is pretty old. I improved the area around this function and it will be released in the next COM package.

SendLinkedOrders is no longer valid. You are looking for SendOSOOrders, and can see this in the C# documentation.
https://gainfutures.com/GFAPI/html/T_GF_Api_Orders_IOrdersApi.htm

Here is an improved VBA subroutine:

Sub SendOrder(side As OrderSide, row As Integer, qty As Integer)
On Error GoTo Err
Dim account As account
Set account = CurrentAccount
If account Is Nothing Then
MsgBox "Invalid account"
Else
Dim Price As Double
Price = CurrentTop - (row - TopRow) * CurrentContract.tickSize
If qty < 0 Then
DecreaseQty side, Price, -qty, account
Else
Dim Builder As OrderDraftBuilder
Set Builder = New OrderDraftBuilder
Builder.WithSide side
Builder.WithPrice Price
Builder.WithQuantity qty
Builder.WithContractID CurrentContract.id
Builder.WithComments "DOM"
Builder.WithAccountID account.id

If (side = OrderSide_Buy) And (Price CurrentContract.CurrentPrice.LastPrice) Then
Builder.WithOrderType (OrderType_Limit)
Else
Builder.WithOrderType (OrderType_Stop)
End If

Dim stopLoss As Integer
Dim takeProfit As Integer
Dim mainDraft As OrderDraft
Dim draftStopLoss As OrderDraft
Dim draftTakeProfit As OrderDraft

stopLoss = range("K6")
takeProfit = range("K7")
Set mainDraft = Builder.Build

If (stopLoss = 0) And (takeProfit = 0) Then
orders.SendOrder mainDraft
Else
If stopLoss 0 Then
If mainDraft.side = OrderSide_Buy Then
Builder.WithSide OrderSide_Sell
Builder.WithPrice mainDraft.Price - stopLoss * CurrentContract.tickSize
Else
Builder.WithSide OrderSide_Buy
Builder.WithPrice mainDraft.Price + stopLoss * CurrentContract.tickSize
End If
Builder.WithOrderType OrderType_Stop
Set draftStopLoss = Builder.Build
End If

If takeProfit 0 Then
If mainDraft.side = OrderSide_Buy Then
Builder.WithSide OrderSide_Sell
Builder.WithPrice mainDraft.Price + takeProfit * CurrentContract.tickSize
Else
Builder.WithSide OrderSide_Buy
Builder.WithPrice mainDraft.Price - takeProfit * CurrentContract.tickSize
End If
Builder.WithOrderType OrderType_Limit
Set draftTakeProfit = Builder.Build
End If

If (takeProfit 0) Then
If stopLoss 0 Then
orders.SendOSOOrders mainDraft, draftTakeProfit, draftStopLoss, OSOGroupingMethod_ByPrice
Else
orders.SendOSOOrders mainDraft, draftTakeProfit, Nothing, OSOGroupingMethod_ByPrice
End If
ElseIf stopLoss 0 Then
orders.SendOSOOrders mainDraft, draftStopLoss, Nothing, OSOGroupingMethod_ByPrice
End If
End If
End If
End If
Exit Sub
Err:
MsgBox Err.Description
End Sub


API Support » GAIN API COM installation and version query Jan 06, 2021 @ 12:50 PM (Total replies: 3)

Sorry, I was mistaken about item 1. You can use the "/verysilent" argument for this.

Order Execution » Getting real time position value Jan 06, 2021 @ 12:12 PM (Total replies: 1)

One change in GFAPI is that you need to subscribe to the contracts in the position in order to get an accurate position. Perhaps this is the issue?

Here is a sample for doing so: https://gainfutures.com/GFAPI/html/de577afb-edad-4021-a3cc-1fd943896903.htm

API Support » PriceTick vs SubscriptionTick Jan 06, 2021 @ 11:05 AM (Total replies: 1)

Hello.

Are you asking about the difference between price subscriptions and tick subscriptions?https://gainfutures.com/GFAPI/html/T_GF_Api_Subscriptions_Price_IPriceSubscriptionApi.htm https://gainfutures.com/GFAPI/html/T_GF_Api_Subscriptions_Ticks_ITicksSubscriptionApi.htm
A tick is something that you would put on a graph, representing the smallest time unit, while a price subscription will give you full price data.

Probably you want to call gfClient.Subscriptions.Price.Subscribe(contractID), and listen to the PriceTick or PriceChanged events. It may not give you price data every second, but prices don't update every second anyway. When the price changes, an event will be raised.

API Support » Procedure written using OEC API Jan 06, 2021 @ 10:37 AM (Total replies: 1)

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.
https://gainfutures.com/GFAPI/html/T_GF_Api_Orders_IOrdersApi.htm

API Support » GAIN API COM installation and version query Jan 06, 2021 @ 09:47 AM (Total replies: 3)

Hello,

1) No, there is currently no silent install option.

2) There is also no way to specify a different directory.

3) The version is in the dll File Version metadata, so you could programmatically inspect that.

We will keep these in mind for future development.

API Support » Runtime 13 Type Mismatch error - cancel All Jan 06, 2021 @ 08:07 AM (Total replies: 1)

Hello,

Probably you are getting a Type Mismatch error because you are passing a long instead of OrderID.
https://gainfutures.com/GFAPI/html/M_GF_Api_Orders_IOrdersApi_CancelOrder.htm

-Seth

API Support » Open position P/L issue Dec 02, 2020 @ 07:41 AM (Total replies: 9)

Mauro,

You are correct, this is a difference between OEC API and GF API. In GF API the client chooses how to use the limited number of subscriptions available to it.

API Support » Open position P/L issue Dec 01, 2020 @ 10:31 AM (Total replies: 9)

>GF API version is the very latest available with Gain Trader Developer 4.0.
I will note that there is no GF API available with Gain Trader. The public version we support is available on nuget: https://www.nuget.org/packages/GFAPI/

Market Data » LastDateTime is old Oct 14, 2020 @ 09:00 AM (Total replies: 3)

The DateTime is UTC, it's just that the DateTime.Kind is set to DateTimeKind.Unspecified when the message from the server is deserialized. But you are right, it would be more correct as DateTimeKind.Utc, and we plan to address this in a future release.

Market Data » LastDateTime is old Oct 13, 2020 @ 12:28 PM (Total replies: 3)

The time is already in UTC, so I suspect you just need to remove the ToUniversalTime call.

API Support » GAIN API COM Example problem Aug 05, 2020 @ 01:51 PM (Total replies: 2)

An update has been pushed to the comapisamples repo to fix x64 event argument references. Please try again.

API Support » GAIN API COM Example problem Jul 24, 2020 @ 11:46 AM (Total replies: 2)

Hello,

We have reproduced your issue. It looks like in x64, COM is not sending event arguments pointers correctly. We will investigate a fix.

Regarding 4b -- I suspect this is happening when you are debugging long enough that the API fails the heartbeat and disconnects.