API Support Forum
User Profile

Viewing User Profile for: NShine



Nov 02, 2016 08:55 AM

Nov 02, 2016 08:55 AM

Post Statistics
NShine has contributed to 36 posts out of 5221 total posts

20 most recent posts:

API Support » Problem with double quote for the same symbol Nov 02, 2016 @ 08:55 AM (Total replies: 2)

Also, if you don't care about history and only need the current price (quote) data, you can utilize our Subscribe(Contract) method. Multiple subscriptions to this method will not result in duplicate packets. Ticks are associated with charts, so they may not be what you are looking for. Again, the Advanced API Example is a great resource for this.

API Support » Problem with double quote for the same symbol Nov 01, 2016 @ 09:33 AM (Total replies: 2)


You will want to keep track of the Subscription object returned by the SubscribeTicks method. With this, you can call CancelSubscription(Subscription). The Unsubscribe(Contract) method you are using will only remove quote data.

If you want to see actual code implementing this, please refer to the Advanced API Example project we provide in our Samples at https://gainfutures.com/onelink/documentation.

API Support » Tasker auto checked "Create New Area" for my Custom Indicator Oct 31, 2016 @ 10:50 AM (Total replies: 2)


Yes, you can do this. The sample C# code in our Indicator guide (https://gainfutures.com/wp-content/uploads/CustomIndicators.pdf) has this behavior. Take a look at the TimeSeries attribute in the SNI class.

[TimeSeries("NET Indicator", "SNI", "Samples", AreaScale.Free, SourceScale=AreaScale.Stock)]

If you use AreaScale.Free or AreaScale.Percent then the "Create New Area" will be checked by default.

API Support » Requesting/Receiving Range Bars Oct 24, 2016 @ 11:43 AM (Total replies: 6)


You can unsubscribe from a histogram through the CancelSubscription method.


The limit for this type is equal to your DOM subscription limit plus your chart subscription limit. So if you have a 5 DOM limit and 10 chart limit (real-time data), you will have a 15 histogram limit.

API Support » Full snap quote when subscribing Sep 23, 2016 @ 01:04 PM (Total replies: 3)

We do not have any price data for ESZ7, therefore there is nothing to send upon subscribing.

API Support » Demo/sandbox account type Sep 13, 2016 @ 10:22 AM (Total replies: 8)

We have decided to enable this functionality, though the term "throttling" might be a little misleading. The same amount of updates will be sent through the API, but there will be an interval so that the quotes will accumulate before events are fired. Also, please be aware that these changes have to pass various testing environments before they are available on our demo/production servers. Thank you.

API Support » Demo/sandbox account type Sep 12, 2016 @ 03:02 PM (Total replies: 8)

Is there no throttling and the EventBatchInterval is obsolete?

This functionality is currently disabled, so there is no throttling at this time. We will discuss tomorrow if it should be enabled going forward.
Edited by NShine on Sep 12, 2016 03:03 PM

API Support » Allocation block net position Jul 19, 2016 @ 09:07 AM (Total replies: 2)

I am looking for documentation on how to get the net position for an allocation block (instead of a single account). I would like something similar to the OnPositionChangedEvent event, except one that summarizes at the allocation block level. What is the best approach for this?

You can subscribe to the OnDetailedPositionChanged event for this. The account parameter can be a single account or allocation block. The second parameter, contractPosition, will summarize at the same level as the account. So check contractPosition.Net for the net position.

API Support » Can't find the Connect - Force Login OEC Trader feature in the api Jul 01, 2016 @ 09:28 AM (Total replies: 2)


The new Connect call is already available in the API by downloading Trader and grabbing the DLL like you seemed to have already done. If you want the updated API.xml documentation, I can work on that.

From a COM perspective, it is a little more involved. One of the parameters of this overloaded Connect method is a new type called ConnectionFeatures. This class utilizes a nested Builder type to construct the ConnectionFeatures object. Our COM generator cannot handle nested types, and without it, there would be no way to change the ConnectionFeatures (currently just AutoReconnect and ForceLogin) from their default values (false and true, respectively). Additionally, the ServerInfo type was added to combine the server address and port into a single object. The only way to set these values is through the constructor, but I don't think you can build COM objects this way. I will create a new task to review these items, but I don't know if they will be added to our COM package in the future, and if so, when.

One final note, if you use the original Connect method, ForceLogin will be true. This just means that an existing session will be kicked off by the new session.

Market Data » MaxBars subscription count includes same subscription several times, wrong api call? Jun 29, 2016 @ 08:47 AM (Total replies: 2)


I'm glad you are now receiving historical data. I'll add a couple notes which might help with any confusion you still have.

You are using the correct historical data request method. RequestBars/RequestTicks will fire OnBarsReceived/OnTicksReceived as each data packet comes in. You must be subscribed to these if you want to catch the data. When we are done sending data for a request, either because the request has been satisfied or the maximum amount of data has been returned for a single request, you will get a response with an empty bar/tick array. With this in mind, you can always create a new request if you need more data.

When it comes to subscriptions, you cannot cancel an un-updatable one. These will be removed once the final zero-length array packet comes in. So after calling RequestBars, do not call CancelSubscription.

Good luck!

API Support » does Reconnect() raise any events? Jun 01, 2016 @ 07:31 AM (Total replies: 5)

Reconnect disconnects the client, resets the session information, and runs the connection code. This will clear all client data and reload only the data given during initialization. You could accomplish the same thing by calling Disconnect, waiting, and then calling Connect.

API Support » does Reconnect() raise any events? Jun 01, 2016 @ 07:09 AM (Total replies: 5)

Reconnect can only be called if you are already connected. If you lose connection (or call Disconnect), please use Connect to login.

API Support » Subscribe vs SubscribeTicks vs RequestTicks May 31, 2016 @ 11:20 AM (Total replies: 3)

TotalVol is not returned during OnTicksReceived. You should be able to access the current TotalVol in your OECClient.Global.Contracts["SYMBOL"].CurrentPrice, or listen to the OnPriceChanged event to catch it when it changes.

API Support » Subscribe vs SubscribeTicks vs RequestTicks May 31, 2016 @ 09:27 AM (Total replies: 3)


SubscribeTicks sets up an ongoing subscription to receive tick data for a given contract. You will need to cancel this subscription to stop ticks from being sent.

RequestTicks requests a range of ticks to return. Once the requested data has been sent to the client, no more will ticks will be sent. No cancellation is required for this method.

Subscribe sets up a price (quote) subscription. If you are receiving bar or tick data for a contract, you will already have a price subscription. No Subscription object is returned because to cancel you just need to use the more generic method Unsubscribe.

Don't forget, tick/price data is not returned in the Subscription object. You need to listen to the events being raised for each type of request (e.g., OnTicksReceived).

Please refer to our API documentation. You might be interested in the Market Data section.


API Support » does Reconnect() raise any events? May 31, 2016 @ 09:00 AM (Total replies: 5)

What are the expected events? OnLoginComplete is not raised
I've just tested this, and OnLoginComplete is raised.

Do we need to resubscribe to symbols?

API Support » Possible Regional Settings Issue with OECClient.CreateDraft call Apr 19, 2016 @ 10:19 AM (Total replies: 8)

I'm sorry David, I don't see anything else that could change behavior. When you pass the template string into CreateDraft(), it breaks up the string and handles each element separately. For the price parser, only two inputs are sent: the contract (which is grabbed from OECClient.Contracts["contract string"]) and the price string. The parser will not change its behavior if it gets these same two inputs unless there is also a change to CultureInfo.CurrentCulture. This is not changing, is it? If not, are you performing these actions on a separate thread from the one that created your OECClient?

API Support » Possible Regional Settings Issue with OECClient.CreateDraft call Apr 15, 2016 @ 03:36 PM (Total replies: 8)

Does this string change at all between the first call and the working calls to CreateDraft?


Which regional settings or CurrentCulture are you working with?

API Support » RequestTicks gets no response after auto-reconnect Apr 07, 2016 @ 02:52 PM (Total replies: 1)

Hi Reza,

Yes, there appears to be a difference in the connection properties between an initial login and an auto-reconnect that can prohibit RequestTicks() calls within the OnLoginComplete event. I will be submitting a fix shortly.

API Support » Possible Regional Settings Issue with OECClient.CreateDraft call Apr 06, 2016 @ 01:10 PM (Total replies: 8)

Can you verify the contract is in your oecClient.Contracts collection before you call CreateDraft()?

API Support » Possible Regional Settings Issue with OECClient.CreateDraft call Apr 04, 2016 @ 03:25 PM (Total replies: 8)

Hi David,

Yes, that problem seems very odd at first glance. I reviewed the CreateDraft() method, and here is what I see.

If your client does not have the given contract within your OECClient Contracts, the current culture is used to parse the string. Since your current culture uses '.' as a divider, it is ignored during the parse, resulting in Price=11618.

Later, you call the same function. This time, though, the contract is within the Contracts list. CreateDraft() now utilizes a more advanced parsing method that incorporates the current culture and contract information to generate the correct string.

Since you are calling these methods right after OnSymbolLookupReceived fires, the corresponding contract might not have had enough time to populate into OECClient Contracts. If that doesn't work, you will need to look at your threading and synchronization. Hopefully this solves your issue.