API Support Forum
User Profile

Viewing User Profile for: BGoyal9136


About

Sep 21, 2017 09:15 AM

Aug 25, 2020 05:04 AM

Aug 25, 2020 05:04 AM



Post Statistics
BGoyal9136 has contributed to 27 posts out of 5245 total posts (0.51%) in 1582 days (0.00 posts per day).

20 most recent posts:

API Support » Trail Stop Order issue Aug 25, 2020 @ 05:04 AM (Total replies: 2)

For Placing Trail Order we need to use this . is there any way we give ticks to trail so it decide automatically trail Price like we used to in old api . Since if we give price trail is getting made invalid due to the market moving faster than the order can execute (We want to trail with one tick only )

new OrderDraftBuilder()
.WithOrderType(OrderType.TrailingStopLoss)
.WithTrailingStop(new TrailingStopData(contract.CurrentPrice.LastPrice, (10 - 1) * contract.TickSize))
.Build();

API Support » Issue with OrderConfirmation Aug 20, 2020 @ 11:03 AM (Total replies: 5)

Chris,

i cant see this order on GAIN platform as well.

Thanks

API Support » Issue with OrderConfirmation Aug 20, 2020 @ 10:45 AM (Total replies: 5)

Chris,

this issue is not coming in developer account. only i can see this issue with Live account


Thanks

API Support » Issue with OrderConfirmation Aug 20, 2020 @ 08:48 AM (Total replies: 5)

Hi Team,

we are using Gain future api. yesterday night we have placed orders for MGCV20 symbol from my live account. but for 1 order i did not get confirmation on gfClient.Orders.OrderConfirmed method. below are my account username and order id for your reference:

username : Avai*******deTM
order Id : 17******17
comment : B-1-TP

Could you please let me know the reason.

Thanks
Edited by CMicciche902 on Aug 20, 2020 10:04 AM

Order Execution » Data Issue with Dummy Account Jul 17, 2020 @ 04:47 AM (Total replies: 1)

Hi Team,

I just want clarify one thing, for every contract chart data will be same or not for demo account and live account?

API Support » Getting Error if application has no internet access Jul 01, 2020 @ 07:51 AM (Total replies: 2)

Hi Support,

I am getting error from GF api when application doesn't has internet access.
Below are the stack trace for your reference. could you Please help me out to solve this :

Exception Info: System.InvalidOperationException
at GF.Api.Impl.Connection.Machine.States.ClosedConnectionState.OnDisconnect(GF.Api.Impl.Connection.Machine.DisconnectionContext)
at GF.Api.Impl.Connection.Machine.ConnectionStateMachine.Transition(System.Func`1)
at GF.EnumerableTExtensions.ForEach[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral,


Thanks

FIX Support » No Getting Charts for 1 min or 15 min Jun 22, 2020 @ 08:02 AM (Total replies: 2)

Hi Team,

after subscribe MESU20, I am not getting data feed or chart data for 1 min and 15 min.could you please tell me the issue


Thanks
Kapil Goyal

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 :



_gfClient.Contracts.Lookup.ByCriteria(
new SymbolLookupRequestBuilder()
.WithBaseSymbol(symbol, TextSearchMode.StartsWith)
.Build());



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.

Thanks
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.

----------------------------------------

Thanks
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.SendOCOOrders(takeProfitOrder2,slOrderD2);
_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);


Thanks
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
https://gainfutures.com/api/?topic=html/T_OEC_API_ContractGroup.htm

Can you please help me on this ?

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

Hi ,

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

Connection Error

Thanks
Kapil Goyal

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

Hi,

I am using GF 4.0.3.5 api.

Thanks
Kapil Goyal

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

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);
runner.Start();

Console.WriteLine("Connecting...");

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}");


gfClient.Connection.Aggregate.Disconnect();
gfClient.Connection.Aggregate.Connect(
new GF.Api.Connection.ConnectionContextBuilder()
.WithUserName("BGoyal9136")
.WithPassword("Test1234!")
.WithUUID("9e61a8bc-0a31-4542-ad85-33ebab0e4e86")
.WithPort(9210)
.WithHost("api.gainfutures.com")
.WithForceLogin(true)
.Build());


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)
return;

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();
});
};

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

timer.Stop();
runner.Stop();
}


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 ");
}

}





}




Thanks
Kapil Goyal

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

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 .

_gfClient.Connection.Aggregate.Disconnect();
_gfClient.Connection.Aggregate.Connect(
new ConnectionContextBuilder()
.WithUserName(uid)
.WithPassword(pass)
.WithUUID(UUID)
.WithPort(9210)
.WithHost(GFApis)
.WithForceLogin(true)
.Build());


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.


Thanks
Kapil Goyal

API Support » Not Able to Build GF api 4.0.3.5 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.


Thanks
Kapil Goyal

API Support » Not Able to Build GF api 4.0.3.5 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.

Thanks
Kapil Goyal