Frequently Asked Questions (FAQ)

GF API Documentation

The following are some common problems and solutions along with some known issues with GF API that you may encounter.


Where can I get the latest version of GF API?

The preferred way is to download it using the NuGet package manager:

What are the technical requirements for GF API?
  • Windows 7 or higher

  • .NET 4.6.2 or higher

Where can I find code samples?

We maintain a sample repo on BitBucket:

Should I implement any heartbeating?

No. The API implementation takes care of this. However, you must call Advance regularly.


Where can I find out margin requirements?

You can check a contract instance: GetInitialMargin(IAccount) or GetMaintenanceMargin(IAccount)

Why can't I find a particular contract in the Contracts list after logon?

When a user logs in, GF API loads contracts automatically for the user's existing orders and positions. You'll need to use Symbol Lookup to fetch additional contracts from the server. See here for details.

I’ve requested a symbol lookup for an equity (or FX) symbol, but received an empty list in response. Why?

Equity and FX are no longer supported by GAIN Capital Futures.

I requested a symbol lookup, but Get still has no contracts. Why?

Symbol Lookup is asynchronous. The request returns immediately without waiting for results to return from the server. Listen for the OnContractsChanged event to be fired before looking for the result.

Does GF API provide start/stop time of irregular sessions?

It does not.


How do I send an order?

See here.

How to I send an OCO or OSO order?

See here.

How to send I a trailing stop order?

See here.

What will happen when one OCO leg gets a fill?

The quantity of another leg of the OCO will be adjusted to make sure that the hypothetical total filled quantities of both orders will not exceed the original order quantity.

Can I send an OCO with more than two legs?
How to send an order with allocation block?

Create an instance of IAllocationBlockTemplate (you can use AllocationBlockTemplate) and assign it to IOrderDraft.AllocationBlock instead of assigning IOrderDraft.AccountID.

Will GAIN Capital Futures cancel my orders when I disconnect?

No. This is the API consumer's responsibility.

Where can I find the reason for an order's rejection?

You can check ICommandResultComments

Can I assign my own “client order ID” to an order? What are the limitations?

You can use OrderDraftComments and IOrderComments for it. Limit is 256 characters.

Will I receive an update when command state is changed?

GF API will raise the OnCommandUpdated event. If you see delays in command execution, please send Customer Service an order number and we will try to figure out the reason.

What currency is used for fill commissions?


IOrderLinked, IOrderParent, IOrderOCO are intended for it. See here for more details.

Can I get a list of orders from a previous trading session?

GF API doesn't load information from previous trading sessions. However, Trader's reports can probably help. Fills from previous days are aggregated in Previous Position values (IPositionPrev).

Can I modify a partially filled order?


My order was cancelled immediately without any cancel request. Why?

GAIN Capital Futures sends market orders to some exchanges with the FOK/IOC flag. This is a requirement of these exchanges. Please contact Customer Service for details.

Can I trade custom futures spread?


I’m getting “Action not supported for instrument status” (or "Trading suspended"). What does it mean?

Market closed: an order was sent between trading sessions or during a maintenance period. Normal maintenance period on workdays is 17:30 – 18:00 EST


What relations are between P&L values in Trader to GF API?
Cash == NetLiquidatingValue - SettlePnL
Net Liq == NetLiquidatingValue - SettlePnL + OpenPnL
Buying Power == NetLiquidatingValue - SettlePnL + OpenPnL - InitialMargin

See properties like OTE and CurrencyOTE: OTE is always in USD, and CurrencyOTE is in contract currency (for example, EUR for FDAX contract). CurrencyXXX values do not include commissions.

Market Data

What is the difference between OnPriceTick and OnPriceChanged?

OnPriceTick is intended to catch all quote changes on client-side without throttling. OnPriceChanged fires less frequently and batches updates before raising.

What is the difference between OnPriceChanged and OnDOMChanged?

IContractsApiOnPriceChanged is raised when CurrentPrice changes. OnDOMChanged is raised when DOM changes.

What is the difference between OnPriceTick and OnTicksReceived?

OnPriceTick is raised for every quote change in quote subscriptions. OnTicksReceived is raised when ticks change in tick subscriptions.

How many active subscriptions may I have?

You can find these settings in IGFClientProperties. See here for details.

I’m testing my new application and it is not receiving any quote updates. How can I check health status of GF servers?

Please try to check quotes in GAIN Futures Trader to exclude a possibility of a bug in your application.

What is the precision of quote and tick timestamps?

One second

I’ve opened a position and now I see that GF API subscribed for quotes for this contract. Can I unsubscribe it?
Yes, you can.
Should I resubscribe my subscriptions after reconnection?

Everything should be re-requested and re-subscribed after receiving OnLoginComplete the same way as it would be done the first time.

Why I don’t receive any bars for futures options and custom spread?

GAIN Capital Futures does not provide historical data for options and custom spreads.

How do I load ticks?

You can look at a sample here.

What are the limitations for tick responses?

You can get up to 3 days previous, but every request will be limited to 65536 ticks. You can work around this limitation by splitting the request into several smaller requests. Large amounts of ticks/bars are split into packets, so the client application needs to handle multiple callbacks and combine incoming data.
The packet size is currently 4096 ticks, but there is no guarantee that last packet could not be exactly 4096 ticks. Realtime updates usually are coming by 1 tick per update event. Empty packet is an indication of "last" historical packet.
If you subscribe to ticks twice, you will get historical and real-time data twice in two different subscriptions.
You can find details about subcription limits here.

How do I unsubscribe from ticks?

Find the ITickSubscription instance and call Unsubscribe on it.

How do I check if a trade (tick) was done at bid or ask price?

Some tick responses are accompanied by ITicks.AskPrices and ITicks.BidPrices.

Does GAIN Capital Futures provide exchange info for ticks?

It does not.


Is GF API thread-safe?

No. Only one thread at a time should access GF API or its objects.

I’ve started GF API in a console application and do not receive any events. Why?

In order for GF API to process messages and raise events, it must be operated by calling Advance. See here.

Does GF API use benefits of multi-core platforms?

GF API is not thread safe, but internally it uses multiple threads. So, yes.

Notifications, news and chat

How can I subscribe to GAIN Capital Futures notifications?

You can listen to the OnNotificationMessage event. Messages from our TradeDesk will have INotificationMessage.IsAlert = true.

How do I see risk violation messages?

You can listen to OnError, which is triggered with a detailed message about risk violation. It will be similar to:

Risk violation: 1540:API001540 Max credit = 0.0000000000 USD,Order requires [3600.00000 USD] and needs additional credit of 130.00000 USD (cash leveraged) Cash and credit balance 125.00000 USD ...
See sample here.

Customer Service

My username has expired. How do I renew it?

Please contact Customer Service.

Is it possible to open a “data only” production account?

No, but you can open a paid persistent Demo account.

Is there a GAIN Futures Trader for 3rd party developers?

Yes, GAIN Futures Trader Developer. Please contact Customer Service to get the download URL.

I’m getting a “risk violation”. How do I fix my balance?

Please contact Customer Service to increase your virtual balance.

I need to test my application with FX (or equity) account. How can I get it?

We don't support FX or equity.