API Support Forum
User Profile

Viewing User Profile for: BGoyal9136


Sep 21, 2017 09:15 AM

Jun 03, 2020 11:14 PM

Jun 03, 2020 11:14 PM

Post Statistics
BGoyal9136 has contributed to 19 posts out of 4744 total posts (0.40%) in 988 days (0.00 posts per day).

20 most recent posts:

API Support » Issue with Symbol LookUp Jun 03, 2020 @ 11:14 PM (Total replies: 1)

Hi Team,

we are using below code for look up symbol :

new SymbolLookupRequestBuilder()
.WithBaseSymbol(symbol, TextSearchMode.StartsWith)

symbol is base symbol : YM,MES

but in GlobalSymbolLookupReceived we are getting only one contract in contract list.ideally all the contracts should come in contractList. noe YM i am getting only YMM20 and for MES , we are getting only MESM20 contract over here.

public void GlobalSymbolLookupReceived(IGFClient client, SymbolLookupEventArgs e)

var contractList = new List(e.Contracts);

in contractList i am getting only one contract, not more then one.

example :
if i am request symbolLookup for MES symbol so ideally MESM20,MESU20 .... etc. should come but still i am getting only one contract MESM20 in contractList

Could you please check the issue and let us know.

Kapil Goyal

Order Execution » Issue with OCO and OSO order May 20, 2020 @ 09:08 AM (Total replies: 3)

Thanks Jason for reply.

Please share with me the document, once you finish. i am stuck due to this.


Kapil Goyal

Order Execution » Issue with OCO and OSO order May 19, 2020 @ 08:40 AM (Total replies: 3)

Hello Team,

I hope you are doing great.

we are placing three type of orders:

Entry order(E)
Stop Loss Order(SL)
Take profit order(TP)
and after Entry order completed ,we will send bracket orders

Once Entry order complete or filled, we send SL1 and TP1 for bracket 1, if SL1 executed , we will not send Bracket 2 and 3 orders also cancel TP1 order. if TP1 order filled, send Bracket 2 orders(SL2,TP2) and cancel SL1 order.
same strategy goes with Bracket2 and 3 orders.

Below are Code we are using to send order in gain future :

_gfClient.Orders.SendOCOOrders( takeProfitOrder1, slOrder1 );
_gfClient.Orders.SendOSOOrders(takeProfitOrder1, takeProfitOrder2, slOrderD2, OSOGroupingMethod.ByFirstPrice);

_gfClient.Orders.SendOSOOrders(takeProfitOrder2, takeProfitOrder3, slOrderD3, OSOGroupingMethod.ByFirstPrice);

_gfClient.Orders.SendOCOOrders(takeProfitOrder3, slOrderD3);

can you please confirm, if it is works or not?
Note : we have doubt if we are sending OCO and OSO orders, it will place duplicate order on gain future.

Order Execution » Error In TrailingStopLoss order type Apr 27, 2020 @ 10:36 AM (Total replies: 1)

Hi Team ,

I hope you are doing well.
I am getting below error while I am placing order as TrailingStopLoss .Please let me know. what I am doing wrong:

TrailingStopData and either TrailingStopLimit or TrailingStopLoss must be defined together

Order Draft :

OrderDraft slOrder = new GF.Api.Orders.Drafts.OrderDraft(OrderSide.Buy,
order.Contract.ID, "comment", order.Account.ID, null, null, 2.0, OrderType.TrailingStopLoss,
_price, null, OrderFlags.GTC, ExecInst.None, null, null, null, null, null, null, SubmissionType.Automatic, null, null);

Kapil Goyal

API Support » Unabel to get tick data for 6BK20 Apr 22, 2020 @ 09:22 AM (Total replies: 1)

We are not abel to get tick data for 6BK20. Is there permission issue ? it's working for other instrument like NQM20

Is there any error handled which get called where we can track why we are not able to get this data.

API Support » How to Add Day Order Apr 20, 2020 @ 08:08 AM (Total replies: 1)

How we can add Day Order with New GF API since in OrderFlag there is noting as DAY ?

API Support » Unable to find VBS In new API Apr 20, 2020 @ 06:56 AM (Total replies: 1)

We are migrating from OLD OEC API to Gain API. We are unable to find following fields

1 New API don't have PIN field while Old api have that so which fields need to be used for that
2 Unable to find VBS data in New GF api . Please let me know how to set VBS data
3 Unable to find Base Contarct in Group contarct in new api

Can you please help me on this ?

API Support » Not able to connect with API Mar 31, 2020 @ 11:20 PM (Total replies: 5)

Hi ,

I have tried with both api verisons :
but still getting same error :

Connection Error

Kapil Goyal

API Support » Not able to connect with API Mar 31, 2020 @ 11:09 PM (Total replies: 5)


I am using GF api.

Kapil Goyal

API Support » Not able to connect with API Mar 31, 2020 @ 06:53 AM (Total replies: 5)

Hi CMicciche902,

Thanks for your reply.
when I am using advanceExample with my credential I am getting successful connection. but when I am using Gain Future api with my application code. still I am getting FailedReason as ConnectionError in LoginFailed method.

for your reference Below are the code I am using :

using GF.Api;
using GF.Api.Connection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace WpfApp1
class Class1

private static GF.Api.IGFClient gfClient;

public static void Main(String[] args)
gfClient = GF.Api.Impl.GFApi.CreateClient();

var runner = new GF.Api.Threading.GFClientRunner(gfClient);


gfClient.Connection.Aggregate.LoginCompleted += OnLoginComplete;
gfClient.Connection.Aggregate.LoginFailed += onLogonFailed;
gfClient.Connection.Aggregate.Disconnected += OnDisconnected;
gfClient.Logging.ErrorOccurred += (client, e) => Console.WriteLine($"{e.Exception.Message}");

new GF.Api.Connection.ConnectionContextBuilder()

var timer = new System.Timers.Timer { Interval = TimeSpan.FromSeconds(2).TotalMilliseconds };
timer.Elapsed += (_, __) =>
// The timer callback is on a different thread than the GFClientRunner, so we must delegate to the runner thread
gfClient.Threading.Invoke(() =>
if (!gfClient.Connection.Aggregate.IsConnected)

var account = gfClient.Accounts.Get().First();
GF.Api.Balances.IBalance totalBalance = account.TotalBalance;

Console.WriteLine($"Account: {account.Spec}");
Console.WriteLine($"\tNetLiq: {totalBalance.NetLiq:c}");
Console.WriteLine($"\tCash: {totalBalance.Cash:c}");
Console.WriteLine($"\tOpen P/L: {totalBalance.OpenPnL:c}");
Console.WriteLine($"\tTotal P/L: {totalBalance.RealizedPnL + totalBalance.OpenPnL:c}");
Console.WriteLine($"\tInitial Margin: {totalBalance.InitialMargin:c}");
Console.WriteLine($"\tNet Options Value: {totalBalance.LongCallOptionsValue + totalBalance.LongPutOptionsValue + totalBalance.ShortCallOptionsValue + totalBalance.ShortPutOptionsValue:c}");
Console.WriteLine($"Average Positions: {account.AvgPositions.Count}");
Console.WriteLine($"Orders: {gfClient.Orders.Get().Count}, last one: {(gfClient.Orders.Get().Count > 0 ? gfClient.Orders.Get().Last().ToString() : string.Empty)}");

Console.WriteLine("Press any key to quit");


public static void OnDisconnected(IGFClient client, DisconnectedEventArgs e)
Console.WriteLine("Login Disconnected: " + e.Message);


public static void onLogonFailed(IGFClient client, LoginFailedEventArgs e)

Console.WriteLine("Login Failed: " + e.FailReason);

public static void OnLoginComplete(IGFClient client, LoginCompleteEventArgs e) {
Console.WriteLine("Login Success ");



Kapil Goyal

API Support » Not able to connect with API Mar 29, 2020 @ 11:07 PM (Total replies: 5)

Hi Team,

I hope you guys doing great.
I am using GF client in my application . I am using below code to connect with GF. but still getting connection error .

new ConnectionContextBuilder()

Can you please check this. where I am doing wrong .or why I am getting connection error.

Note : when I am using my credentials with advance example with GF api .I am able to login.

Kapil Goyal

API Support » Not Able to Build GF api Mar 29, 2020 @ 03:34 AM (Total replies: 4)

Hi Team,

while i am building the project i am getting below error :

CS0246 the type or namespace name 'TickReceivedEventArgs' could not be found (are you missing a using directive or an assembly reference?)

But i have already added GF api references in project.could you please let me know what i am missing here.

Kapil Goyal

API Support » Not Able to Build GF api Mar 26, 2020 @ 05:23 AM (Total replies: 4)

Hi Team,

I am trying to build GF 4..0.3.5 api version in my c# application. I am using 4.8.03753 .NET framework and Microsoft visual studio version is 16.1.1.

but i am not able to build my project. i am getting build issue in GF api. could you please help me out to solve this.

Kapil Goyal

API Support » What is AccountId in OrderDraft Mar 26, 2020 @ 03:17 AM (Total replies: 1)

HI ,

previously I am getting account information for OrderDraft from OECClient using below code line :


Now I am upgrading my application. with latest Gain future api how I can get AccountId Using IGFClient ?

Kapil Goyal

API Support » not able to login in myaccount.gainfutures.com Sep 16, 2019 @ 09:30 AM (Total replies: 0)

Hi Support,

i want to add balance in my developer account. i am getting error at a time of login.
username : BGoyal9136

The following validation errors are present:
UUID: Sorry, you do not have a Universally Unique Identifier (UUID) assigned to your account yet.
Your UUID is generated after your login to the 'My Account' section for the first time. When you login for the first time you are presented with a list of questions to pick from and a text box to provide your secret answer. After you submit this information, your UUID is generated.
Please contact our office for further assistance at GFSupport@gaincapital.com or call us at +1 614-792-2690.


API Support » add balance in developer demo account Sep 16, 2019 @ 09:21 AM (Total replies: 0)

Hi Support,

i want to add more balance in my developer demo account.could you please give me url where i can add balance.
username : BGoyal9136


API Support » Order status change response issue Sep 12, 2019 @ 10:37 AM (Total replies: 1)

HI Support,

I am facing issue for order response.i placed one order with SL1 comment. it was complated but i am getting 2 response for SL1 with different different order id. one was completed state and another was rejected. could you guys please let me know why i am getting 2 order response against one order. Order ids are mention below:



Order Execution » Order state change response Sep 10, 2019 @ 11:50 AM (Total replies: 3)

Hi Chris,

Thanks for reply. So GTC will work for limit order?

Order Execution » Order state change response Sep 10, 2019 @ 11:02 AM (Total replies: 3)

We are using OEC api. while placing market order With GTC Order Flag i am not getting order state change response on OEC.API.OnOrderStateChangedEvent.could you please help us to sort out this.