API Support Forum
User Profile

Viewing User Profile for: AAnatoly


About

Jul 01, 2010 08:05 AM

Oct 12, 2010 08:42 AM

Nov 30, 2010 04:48 AM



Post Statistics
AAnatoly has contributed to 22 posts out of 5593 total posts (0.39%) in 5049 days (0.00 posts per day).

20 most recent posts:

API Support » BUY LIMIT orders with Price X are filled when LastPrice = X and not when AskPrice = X. Oct 12, 2010 @ 08:42 AM (Total replies: 3)

So,

is it correct that:

- on simulation environment

BUY LIMIT order with Price X will be always filled when LastPrice = X.

- or production environment:

BUY LIMIT order with Price X will be always filled when AskPrice = X.

Thanks,
Anatoly

Anatoly Gutnick

API Support » BUY LIMIT orders with Price X are filled when LastPrice = X and not when AskPrice = X. Oct 12, 2010 @ 07:17 AM (Total replies: 3)

Hi.

BUY LIMIT order with Price X is filled when LastPrice = X and not when AskPrice = X.

Please advice.

Here is example:

BUY LIMIT order filled at price 1153.50 at 12:17:33.953

1) Here is a log of order execution:

12:17:33.953 : Order #201224835 (Buy 1 ESZ0 LMT 1153.50) filled : 1@1153.50
12:17:33.843 : State of Order #201224835 (Buy 1 ESZ0 LMT 1153.50) changed from Working to Completed
12:16:39.234 : Command #201224836 Modify for Order #201224835 (Buy 1 ESZ0 LMT 1153.50) updated
10:51:32.361 : State of Order #201224809 (Sell 1 ESZ0 LMT 1152.50) changed from Unknown to Sent
10:51:32.346 : Command #201224809 Create for Order #201224809 (Sell 1 ESZ0 LMT 1152.50) updated


We try to understand what was AskPrice at this moment.

2) Here is an output of what we got with callback: OnPriceChangedEvent

| 12:17:33 | moAPI_OnPriceChanged Contract[ESZ0] LastPrice[1153.5] LastVol[1] AskPrice[1153.75] AskVol[209] BidPrice[1153.5] BidVol[584] Formated LastPrice[1153.50]
| 12:17:33 | moAPI_OnPriceChanged Contract[ESZ0] LastPrice[1153.75] LastVol[1] AskPrice[1153.75] AskVol[209] BidPrice[1153.5] BidVol[584] Formated LastPrice[1153.75]
| 12:17:30 | moAPI_OnPriceChanged Contract[ESZ0] LastPrice[1153.75] LastVol[1] AskPrice[1153.75] AskVol[208] BidPrice[1153.5] BidVol[584] Formated LastPrice[1153.75]


We can see here that LastPrice become 1153.5 and order filled with this price.
But, we expected that BUY LIMIT order will be filled when AskPrice will be 1153.5 and not when LastPrice is 153.5

3) Connection info:

Host="api.openecry.com"
Port="9200"
Username="AAnatoly”

Account: API001127

Anatoly Gutnick

API Support » Order events for period before Login Sep 16, 2010 @ 09:03 AM (Total replies: 1)

After OnLoginComplete we subscribes for Order events:

OECClient.Global.OnOrderConfirmed += new OnOrderConfirmedEvent( Global_OnOrderConfirmed );
OECClient.Global.OnOrderFilled += new OnOrderFilledEvent( Global_OnOrderFilled );
OECClient.Global.OnOrderStateChanged += new OnOrderStateChangedEvent( Global_OnOrderStateChanged );
OECClient.Global.OnCommandUpdated += new OnCommandUpdatedEvent( Global_OnCommandUpdated );

Sometime (it is not consistenly happens very rarely), we receive events like OnOrderFilled for events that actually happened some seconds before Login (when we were not connected to Server).

Is it expected behaviour or this may not happnen?

We belive that after OnLoginComplete we have to accees OECClient.Global.Orders.Values for previosly happened events.

Regards,
Anatoly

Anatoly Gutnick

API Support » Sometime new order are sent and Canceled immidiatly by server. Sep 01, 2010 @ 08:27 AM (Total replies: 3)

How to retrieve reaon for cancel?

Anatoly Gutnick

API Support » Sometime new order are sent and Canceled immidiatly by server. Sep 01, 2010 @ 07:22 AM (Total replies: 3)

Reproduced with 'Advanced Example'

If order is rejected than we look for Reason filed.
Why order is Canceled and how to know the reason to show in application?

Here is log for example with an issue:

14:14:58.773 : State of Order #201212740 (Sell 100 ZCU0 MKT) changed from Sent to Cancelled
14:14:58.648 : Command #201212740 Create for Order #201212740 (Sell 100 ZCU0 MKT) updated
14:14:58.523 : State of Order #201212740 (Sell 100 ZCU0 MKT) changed from Sent to Sent
14:14:58.413 : Order #-4 (Sell 100 ZCU0 MKT) confirmed. New Order #201212740

Here is good flow:

14:14:58.101 : State of Order #-4 (Sell 100 ZCU0 MKT) changed from Unknown to Sent
14:14:53.492 : Order #201212739 (Sell 100 ZCU0 MKT) filled : 10@4.2675
14:14:53.398 : Order #201212739 (Sell 100 ZCU0 MKT) filled : 8@4.2700
14:14:53.273 : Order #201212739 (Sell 100 ZCU0 MKT) filled : 21@4.2725
14:14:53.163 : Order #201212739 (Sell 100 ZCU0 MKT) filled : 5@4.2775
14:14:53.070 : Order #201212739 (Sell 100 ZCU0 MKT) filled : 56@4.2850
14:14:52.945 : State of Order #201212739 (Sell 100 ZCU0 MKT) changed from Sent to Completed
14:14:52.835 : Command #201212739 Create for Order #201212739 (Sell 100 ZCU0 MKT) updated
14:14:52.710 : State of Order #201212739 (Sell 100 ZCU0 MKT) changed from Sent to Sent
14:14:52.601 : Order #-3 (Sell 100 ZCU0 MKT) confirmed. New Order #201212739

Regards,
Anatoly



Anatoly Gutnick
Edited by AAnatoly on Sep 1, 2010 at 07:23:10
Edited by AAnatoly on Sep 1, 2010 at 07:32:31

API Support » Order is partially filled, then come to Completed state, but then OrderFilledEvent happens. Aug 31, 2010 @ 07:40 AM (Total replies: 1)

Please look in the log entries below from ‘Advanced Example’ application

1) Order with 100 lots was send at 13:50:18.059.
It was partly filled 15, 12, 10, 8, 6, 8 - total 59 (OrderFilledEvent called 6 time)

2) Then at 13:50:20.466 State of Order was changed from Working to ‘Completed’.

OrderStateChangedEvent( Order Order, OrderState OldOrderState) was called.
And we checked that: Order.CurrentState = OEC::Data::OrderState::Completed

3) Due documentation Completed status means that no state changes are expected

We check that at this moment filled lots number is still 59 … and there are still 41 not filled lots.
Then we assume that 41 lots will never filled. For example we can think 41 lots were Canceled by User from some application.

But then OrderFilledEvent happens 3 time (filled : 5@4.2125, filled : 19@4.2125 , filled : 17@4.2125)

What is wrong here?
We assume that is order is in ‘Completed state’ that OrderFilledEvent will never called anymore.
If you say that this is ok that OrderFilledEvent is called after ’Completed state’ than how to handle situation when
Order is partly filled and then User send Cancel command? (We are using the same OrderStateChangedEvent )

=========================

Here is a log:

13:50:20.716 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 5@4.2125
13:50:20.637 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 19@4.2125
13:50:20.559 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 17@4.2125
13:50:20.466 : State of Order #201212433 (Sell 100 ZCU0 LMT 4.2125) changed from Working to Completed
13:50:20.387 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 8@4.2125
13:50:20.309 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 6@4.2125
13:50:20.216 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 8@4.2125
13:50:20.122 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 10@4.2125
13:50:20.044 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 12@4.2125
13:50:18.231 : Order #201212433 (Sell 100 ZCU0 LMT 4.2125) filled : 15@4.2125
13:50:18.153 : State of Order #201212433 (Sell 100 ZCU0 LMT 4.2125) changed from Sent to Working
13:50:18.059 : State of Order #201212433 (Sell 100 ZCU0 LMT 4.2125) changed from Unknown to Sent


Anatoly Gutnick
Edited by AAnatoly on Aug 31, 2010 at 07:41:51

API Support » OnCommandUpdated is called twice when you modify LIMIT order Aug 31, 2010 @ 02:29 AM (Total replies: 2)

In first callback Command.State is Sent,
in seconds callback it is Executed.

OnCommandUpdatedEvent Command:[#201212365 Modify] Order::ID :[201212364] Order[Buy 1 ESU0 LMT 1038.00] Command->State: [Sent]

OnCommandUpdatedEvent Command:[#201212365 Modify] Order::ID :[201212364] Order[Buy 1 ESU0 LMT 1038.25] Command->State: [Executed]

Seems this answer my question.
We can use this Command.State in application logic.


Additional question regarding Command->State:[Failed]
If if change lots number to something big like 10000 i get Command->State Failed.

But how i can know what is reason this command failed?

I see now Command->ResultComments.



Thanks.
Anatoly




Anatoly Gutnick
Edited by AAnatoly on Aug 31, 2010 at 02:30:24
Edited by AAnatoly on Aug 31, 2010 at 02:51:09
Edited by AAnatoly on Aug 31, 2010 at 05:02:31

API Support » OnCommandUpdated is called twice when you modify LIMIT order Aug 30, 2010 @ 11:16 AM (Total replies: 2)

Hi.

Here is following issue.

OnCommandUpdated is called twice when you modify LIMIT order.

First time it is called with old price and this is not good.
The issue is reproducible with Advandced Demo application.

Here are logs:



17:42:30.093 : Command #201212319 Modify for Order #201212316 (Buy 1 ZCU0 LMT 4.2700) updated



Note, LIMIT order price now 4.2700.
Now I send modify order command: Buy 1 ZCU0 LMT 4.2575

And instead of one callback OnCommandUpdated I get OnCommandUpdated called twice:

17:42:34.249 : Command #201212320 Modify for Order #201212316 (Buy 1 ZCU0 LMT 4.2700) updated
17:42:34.281 : Command #201212320 Modify for Order #201212316 (Buy 1 ZCU0 LMT 4.2575) updated


Note. First time OnCommandUpdated is called with previously price 4.2700 of Limit Order and seconds time the same second 17:42:34 it
Is called with new correct price 4.2575.

Both callbacks are with the same CommandID 201212320.

How we can avoid this callback. We need to find a way to ignore it, otherwise we have problem in our application

Regards,
Anatoly


Anatoly Gutnick
Edited by AAnatoly on Aug 30, 2010 at 11:17:38

API Support » AutoReconncet and RequestContracts, subscribe, subscribeDOM Aug 04, 2010 @ 09:36 AM (Total replies: 5)

1. The same flow is working with 'OECAPI Advanced Sample'.

2. But in our application it is not working.
I have all activity in trace.

1) OnLoginComplete is called after disconnect

and at this moment:
OECClient.Global.Contracts.Count == 1

2) RequestContracts is called
3) OnContractsChanged is never called any more.

I tried to find in OECAPI log file any info:

- RequestContracts trace;
- OnContractsChanged trace;

Questions:

1. Do you see RequestContracts on server side?

2. If so then probalby OnContractsChanged is not called due some threading issue.

But PriceUpdate callback is called for one contract that was availible when OnLoginComplete is called without Request.

Any idea?

3. What AutoReconnect feature provide?

We still need to Re-Request and Re-Subscribe -
this is not done Automatically.

So, it is only automaticaly re-login that can be done by application?

What about orders? (OECClient.Global.Orders.Values - this will be loaded automatically after Relogin?)

Anatoly Gutnick

API Support » AutoReconncet and RequestContracts, subscribe, subscribeDOM Aug 04, 2010 @ 03:57 AM (Total replies: 5)

I tried again.

After disconnect OnLoginCompleteEnent is called.
Then we re-request 207 contracts as after regular Login.

But OnContractsChanged never called after reconnect.
Price update come to only one contract ESU0.

Here are lgs of OEC client.

10:43:16.262 Dbg Reader Price PLogin to OEC Server 4.0.0.0
10:43:16.262 Dbg Reader Order Login to OEC Server 4.0.0.0
10:43:17.535 Dbg System #8 AAnatoly2 : Loading
10:43:17.723 Dbg System #8 AAnatoly2 : Loaded, API: 93.75ms, Client: 93.75ms
10:47:54.934 Dbg System #8 DOM ZBU0 : 733987.07:47:54.9185000
10:47:55.913 Dbg System #8 DOM EMDU0 : 733987.07:47:55.9185000
10:47:56.902 Dbg System #8 DOM ESU0 : 733987.07:47:56.9028750
10:47:57.913 Dbg System #8 DOM ESH1 : 733987.07:47:57.9185000
10:47:58.927 Dbg System #8 DOM M6EU0 : 733987.07:47:58.9341250
10:47:59.912 Dbg System #8 DOM NQU0 : 733987.07:47:59.9185000
10:48:00.912 Dbg System #8 DOM FSTXU0 : 733987.07:48:00.9185000
10:48:03.099 Dbg System #8 DOM M6EU0 : 00:00:04.3860000
10:48:04.663 Dbg System #8 DOM NQU0 : 00:00:03.4645000
10:48:06.758 Dbg System #8 DOM FSTXU0 : 00:00:06.0582500
10:48:07.320 Dbg System #8 DOM EMDU0 : 00:00:06.0577500
10:48:07.569 Dbg System #8 DOM ESH1 : 00:00:09.8707500
10:48:12.350 Dbg System #8 DOM EMDU0 : 00:00:03.2770000
10:48:13.757 Dbg System #8 DOM FSTXU0 : 00:00:06.2142500
10:48:15.991 Dbg System #8 DOM NQU0 : 00:00:04.6356250
10:48:16.288 Dbg System #8 DOM ZBU0 : 00:00:04.4015000
10:48:18.929 Dbg System #8 DOM EMDU0 : 00:00:06.7921250
10:48:22.164 Dbg System #8 DOM NQU0 : 00:00:03.0891250
10:48:23.241 Dbg System #8 DOM EMDU0 : 00:00:04.5422500
10:48:25.398 Dbg System #8 DOM NQU0 : 00:00:03.4635000
10:48:26.303 Dbg System #8 DOM FSTXU0 : 00:00:04.2607500
10:48:27.087 Dbg System #8 DOM ESH1 : 00:00:18.6520000
10:48:30.180 Dbg System #8 DOM EMDU0 : 00:00:03.0887500
10:48:30.183 Dbg System #8 DOM ESH1 : 00:00:03.1977500
10:48:30.304 Dbg System #8 DOM FSTXU0 : 00:00:04.2287500
10:48:34.182 Dbg System #8 DOM NQU0 : 00:00:03.7287500
10:48:37.976 Dbg System #8 DOM ZBU0 : 00:00:03.3856250
10:48:40.101 Dbg System #8 DOM M6EU0 : 00:00:29.7456250
10:48:40.147 Dbg System #8 DOM ESH1 : 00:00:03.1355000
10:48:40.383 Dbg System #8 DOM FSTXU0 : 00:00:06.3068750
10:48:51.589 Dbg System #8 DOM NQU0 : 00:00:05.8690000
10:48:53.353 Dbg System #8 DOM FSTXU0 : 00:00:09.2596250
10:48:54.336 Dbg System #8 DOM ZBU0 : 00:00:13.4160000
10:48:54.822 Dbg System #8 DOM NQU0 : 00:00:03.4623750
10:48:56.824 Dbg System #8 DOM EMDU0 : 00:00:11.0727500
10:49:00.460 Dbg System #8 DOM ZBU0 : 00:00:03.0723750
10:49:01.383 Dbg System #8 DOM FSTXU0 : 00:00:03.2122500
10:49:03.446 Dbg System #8 DOM NQU0 : 00:00:03.3377500
10:49:05.304 Dbg System #8 DOM EMDU0 : 00:00:05.7901250
10:49:05.444 Dbg System #8 DOM M6EU0 : 00:00:06.5877500
10:49:10.882 Dbg System #8 DOM EMDU0 : 00:00:05.5562500
10:49:17.104 Dbg System #8 DOM M6EU0 : 00:00:07.7590000
10:49:17.121 Dbg System #8 DOM NQU0 : 00:00:11.9156250
10:49:17.180 Dbg System #8 DOM EMDU0 : 00:00:03.2591250
10:49:24.289 Dbg System #8 DOM M6EU0 : 00:00:07.3525000
10:49:26.555 Dbg System #8 DOM NQU0 : 00:00:07.4151250
10:49:26.617 Dbg System #8 DOM EMDU0 : 00:00:08.5246250
10:49:26.961 Dbg System #8 DOM FSTXU0 : 00:00:03.2583750
10:49:28.632 Dbg System #8 DOM ESH1 : 00:00:48.5722500
10:49:36.463 Dbg System #8 DOM NQU0 : 00:00:03.3833750
10:49:36.477 Dbg System #8 DOM M6EU0 : 00:00:07.9620000
10:49:40.479 Dbg System #8 DOM FSTXU0 : 00:00:07.2430000
10:49:41.831 Dbg System #8 DOM NQU0 : 00:00:05.6023750
10:49:41.867 Dbg System #8 DOM ESH1 : 00:00:13.3366250
10:49:41.901 Dbg System #8 DOM EMDU0 : 00:00:12.5238750
10:49:47.899 Dbg System #8 DOM ZBU0 : 00:00:06.1798750
10:49:50.712 Dbg System #8 DOM NQU0 : 00:00:03.5703750
10:49:51.009 Dbg System #8 DOM FSTXU0 : 00:00:05.7732500
10:49:52.273 Dbg System #8 DOM M6EU0 : 00:00:16.0238750
10:49:52.820 Dbg System #8 DOM EMDU0 : 00:00:07.5707500
10:49:55.179 Dbg System #8 DOM M6EU0 : 00:00:03.1331250
10:49:55.692 Dbg System #8 DOM ESH1 : 00:00:13.2577500
10:50:06.606 Dbg System #8 DOM NQU0 : 00:00:04.3200000
10:50:10.263 Dbg System #8 DOM EMDU0 : 00:00:03.7412500
10:50:13.450 Dbg System #8 DOM M6EU0 : 00:00:06.4607500
10:50:21.544 Dbg Reader Order MainStream disconnected: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at OEC.CommLib.PacketSocket.ReadLen(Byte[] buf, Int32 length) at OEC.CommLib.PacketSocket.Read() at OEC.CommLib.ProtoSocket.Read[T]() at OEC.CommLib.ProtoClient`2.ReadLoop()
10:50:21.545 Dbg Reader Price PriceStream disconnected: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at OEC.CommLib.PacketSocket.ReadLen(Byte[] buf, Int32 length) at OEC.CommLib.PacketSocket.Read() at OEC.CommLib.ProtoSocket.Read[T]() at OEC.CommLib.ProtoClient`2.ReadLoop()
10:51:00.032 Dbg Reader Order Login to OEC Server 4.0.0.0
10:51:01.226 Dbg System #8 AAnatoly2 : Loading
10:51:01.284 Dbg System #8 AAnatoly2 : Loaded, API: 0ms, Client: 46.875ms
10:51:04.674 Dbg Reader Price PLogin to OEC Server 4.0.0.0




Anatoly Gutnick

Edited by AAnatoly on Aug 4, 2010 at 03:58:21
Edited by AAnatoly on Aug 4, 2010 at 04:00:48

API Support » Order Reject Reason is poor and OnErrorEvent is good, but not clear what Account belong to. Aug 04, 2010 @ 03:19 AM (Total replies: 4)

ok.

So the message is:
"Risk violation: 1048:API001048 Max credit ..."

Our account names are actually API001048, API001049 etc
We can extract account information.
We assume that account info always after

"Risk violation: "
and till next space charachter " ".

Why it appear as 1048:API001048 and not just API001048?
Will it be the same behaviour on production environment?

Anatoly Gutnick

API Support » Price Class miss previous day close price. Any way to get it from API? Aug 02, 2010 @ 03:57 AM (Total replies: 3)

Price Class miss previous day close price. Any way to get it from API?
What exectly contains Price.Settlement Property? How it should be used?

Regards,
Anatoly

Anatoly Gutnick

API Support » Any way tp enable OEC API's trace logs? Aug 02, 2010 @ 01:48 AM (Total replies: 3)

Hello.

Is it any kind of tracing/logging inside OEC API?
How to enable/disable it?

Thanks,
Anatoly

Anatoly Gutnick

API Support » AutoReconncet and RequestContracts, subscribe, subscribeDOM Jul 27, 2010 @ 04:21 AM (Total replies: 5)

The question is regarding AutoReconncet feature

1. If connection issue occuires then OnDisconnectedEvent fired.

2. I was subscribed for 4 contracts for Price and DOM.

After autoreconnect i got OnLoginCompleteEvent
OECClient::Global->Contracts->Count is now 1 ( and not 4)

and my question is:

may I call again:

- RequestContracts (for previously requested 4 contracts)
- OECClient::Global->subscribe(contract);
- OECClient::Global->subscribeDOM(contract);

I tried to call RequestContracts, but then OnContractsChanged never called.

3. For some reason after autoreconnect I have feed Price update for one ocntract only.
(Probably because i have open positions on this contract?)

I do not receive DOM update for this contract as well.
My login username is AAnatoly2
Last time disconnected from api.openecry.com today 20 minutes before this message/

Please, clarify how it should work.

Regards,
Anatoly






Anatoly Gutnick
Edited by AAnatoly on Jul 27, 2010 at 06:44:38

API Support » Order Reject Reason is poor and OnErrorEvent is good, but not clear what Account belong to. Jul 22, 2010 @ 07:07 AM (Total replies: 4)

1) When Order is rejected then we retrieve reason form Order's State Comments.

"Order breaks limit" - very genral message.

2) Then OnErrorEvent is trigered with detailed message.

[Risk violation: 1048:API001048 Max credit = 0.0000000000 USD,Order requires [2812.50000 USD] and needs additional credit of 1497.51587 USD (cash leveraged) Cash and credit balance 1314.98413 USD. (Max 38104.96826 USD | Used 36789.98413 USD) (Leveraged).]

3) The problem is how we can retrieve what is account that this error belong to. In this case it is API001048, but the messge is not some kind object or XML that can be parsed with known fields.

We need to find a way to retrieve Account from OnError message programatically.

OnError(System.Exception ex)
{
// ex.Message; - what is account this message belong to.
}

We send orders on behalf of different accounts and what to know what error belong to what account.

Please advice.

Thanks,
Anatoly




Anatoly Gutnick

Edited by AAnatoly on Jul 22, 2010 at 07:12:04

API Support » Working with RequestContracts/OnContractsChanged and SymbolLookup/GlobalSymbolLookupReceived Jul 22, 2010 @ 06:10 AM (Total replies: 3)

OnContractsStatusChanged is called slow for more then 150 contracts request.
Sometime it takes 1-2 seconds to load all futures 207 contcats, but usually it takes 42 seconds.
First 150 contracts always loaded fast and then it became slowly loading.

1. We call OECClient.Global.RequestContracts 207 time to get all Futures contracts as appear beolow:

void OECClient_OnLoginComplete()
{
OnConnectionStatusChange( ConnectionStatus.Connected );

OECClient.Global.OnContractsChanged += new OnContractsChangedEvent( OECClient_OnContractsStatusChanged );

_RequestContractsCount = 0;
_LoadedContractsCount = 0;

foreach(OEC.API.ContractGroup group in OEC.API.OECClient.Global.ContractGroups)
{
foreach (BaseContract bc in OECClient.Global.ContractGroups[group.Name].BaseContracts)
{
if( bc.IsFuture )
{
OECClient.Global.RequestContracts(bc);
_RequestContractsCount++;

}
}
}

}

2. Then we get OECClient_OnContractsStatusChanged called 207 times.

void OECClient_OnContractsStatusChanged(BaseContract bc)
{
_LoadedContractsCount++;
if (_RequestContractsCount == _LoadedContractsCount)
MessageBox.Show("All contracts loaded" );
}

3. The problem is that OECClient_OnContractsStatusChanged is called 150 time during one second and then
this is delay 2 seconds delay between each next OnContractsStatusChanged call

This meanes that we need to wait 42 seconds !!! (18:05:05-18:06:37) till all contracts are loaded.

The problem can be reproduced with simple ‘OEC API Adv Example’ application.

Here are our logs that show how slow is contracts loading starting from contract 150.



| 15970 | 2010-07-20 | INFO | Gateway | 18:06:37 | Required contracts loaded. Number of contracts now 2710 |
18:05:05 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 149

41 seconds it take sometime when usually it takes 2 seconds.
First 149 contracts take 3 seconds and then each additional contract with 2-4 seconds delay is loaded….

+-------+------------+---------+---------+----------+----------------------------------------------------------------------------------------------------------------------+
| id | date | type | user | time | msg |
+-------+------------+---------+---------+----------+----------------------------------------------------------------------------------------------------------------------+
| 15970 | 2010-07-20 | INFO | Gateway | 18:06:37 | Required contracts loaded. Number of contracts now 2710 |
| 15969 | 2010-07-20 | INFO | Gateway | 18:06:37 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2710]. Current contract loaded [WSG] |
| 15968 | 2010-07-20 | INFO | Gateway | 18:06:37 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 207
| 15967 | 2010-07-20 | INFO | Gateway | 18:06:35 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2702]. Current contract loaded [TT] |
| 15966 | 2010-07-20 | INFO | Gateway | 18:06:35 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 206
| 15965 | 2010-07-20 | INFO | Gateway | 18:06:33 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2695]. Current contract loaded [SB-M-S] |
| 15964 | 2010-07-20 | INFO | Gateway | 18:06:33 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 205
| 15963 | 2010-07-20 | INFO | Gateway | 18:06:30 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2691]. Current contract loaded [SB-M] |
| 15962 | 2010-07-20 | INFO | Gateway | 18:06:30 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 204
| 15961 | 2010-07-20 | INFO | Gateway | 18:06:28 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2677]. Current contract loaded [RS2-M] |
| 15960 | 2010-07-20 | INFO | Gateway | 18:06:28 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 203
| 15959 | 2010-07-20 | INFO | Gateway | 18:06:26 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2666]. Current contract loaded [OJ-M-S] |
| 15958 | 2010-07-20 | INFO | Gateway | 18:06:26 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 202
| 15957 | 2010-07-20 | INFO | Gateway | 18:06:24 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2663]. Current contract loaded [OJ-M] |
| 15956 | 2010-07-20 | INFO | Gateway | 18:06:24 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 201
| 15955 | 2010-07-20 | INFO | Gateway | 18:06:22 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2646]. Current contract loaded [NF] |
| 15954 | 2010-07-20 | INFO | Gateway | 18:06:22 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 200
| 15953 | 2010-07-20 | INFO | Gateway | 18:06:20 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2636]. Current contract loaded [LBS] |
| 15952 | 2010-07-20 | INFO | Gateway | 18:06:20 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 199
| 15951 | 2010-07-20 | INFO | Gateway | 18:06:18 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2629]. Current contract loaded [KC-M-S] |
| 15950 | 2010-07-20 | INFO | Gateway | 18:06:18 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 198
| 15949 | 2010-07-20 | INFO | Gateway | 18:06:16 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2626]. Current contract loaded [KC-M] |
| 15948 | 2010-07-20 | INFO | Gateway | 18:06:16 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 197
| 15947 | 2010-07-20 | INFO | Gateway | 18:06:14 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2611]. Current contract loaded [GNP] |
| 15946 | 2010-07-20 | INFO | Gateway | 18:06:14 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 196
| 15945 | 2010-07-20 | INFO | Gateway | 18:06:12 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2586]. Current contract loaded [DY] |
| 15944 | 2010-07-20 | INFO | Gateway | 18:06:12 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 195
| 15943 | 2010-07-20 | INFO | Gateway | 18:06:10 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2561]. Current contract loaded [DA] |
| 15942 | 2010-07-20 | INFO | Gateway | 18:06:10 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 194
| 15941 | 2010-07-20 | INFO | Gateway | 18:06:08 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2536]. Current contract loaded [CT-M-S] |
| 15940 | 2010-07-20 | INFO | Gateway | 18:06:08 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 193
| 15939 | 2010-07-20 | INFO | Gateway | 18:06:06 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2531]. Current contract loaded [CT-M] |
| 15938 | 2010-07-20 | INFO | Gateway | 18:06:06 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 192
| 15937 | 2010-07-20 | INFO | Gateway | 18:06:04 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2517]. Current contract loaded [COA] |
| 15936 | 2010-07-20 | INFO | Gateway | 18:06:04 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 191
| 15935 | 2010-07-20 | INFO | Gateway | 18:06:02 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2507]. Current contract loaded [CC-M-S] |
| 15934 | 2010-07-20 | INFO | Gateway | 18:06:02 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 190
| 15933 | 2010-07-20 | INFO | Gateway | 18:06:00 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2504]. Current contract loaded [CC-M] |
| 15932 | 2010-07-20 | INFO | Gateway | 18:06:00 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 189
| 15931 | 2010-07-20 | INFO | Gateway | 18:05:58 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2495]. Current contract loaded [AB-M] |
| 15930 | 2010-07-20 | INFO | Gateway | 18:05:58 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 188
| 15929 | 2010-07-20 | INFO | Gateway | 18:05:56 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2484]. Current contract loaded [ZYG] |
| 15928 | 2010-07-20 | INFO | Gateway | 18:05:56 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 187
| 15927 | 2010-07-20 | INFO | Gateway | 18:05:54 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2464]. Current contract loaded [ZI] |
| 15926 | 2010-07-20 | INFO | Gateway | 18:05:54 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 186
| 15925 | 2010-07-20 | INFO | Gateway | 18:05:52 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2445]. Current contract loaded [ZG] |
| 15924 | 2010-07-20 | INFO | Gateway | 18:05:52 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 185
| 15923 | 2010-07-20 | INFO | Gateway | 18:05:50 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2425]. Current contract loaded [YI] |
| 15922 | 2010-07-20 | INFO | Gateway | 18:05:50 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 184
| 15921 | 2010-07-20 | INFO | Gateway | 18:05:50 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2406]. Current contract loaded [XSN] |
| 15920 | 2010-07-20 | INFO | Gateway | 18:05:50 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 183
| 15919 | 2010-07-20 | INFO | Gateway | 18:05:48 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2391]. Current contract loaded [XGN] |
| 15918 | 2010-07-20 | INFO | Gateway | 18:05:48 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 182
| 15917 | 2010-07-20 | INFO | Gateway | 18:05:46 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2376]. Current contract loaded [UX] |
| 15916 | 2010-07-20 | INFO | Gateway | 18:05:46 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 181
| 15915 | 2010-07-20 | INFO | Gateway | 18:05:46 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2315]. Current contract loaded [QT] |
| 15914 | 2010-07-20 | INFO | Gateway | 18:05:46 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 180
| 15913 | 2010-07-20 | INFO | Gateway | 18:05:44 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2305]. Current contract loaded [QS] |
| 15912 | 2010-07-20 | INFO | Gateway | 18:05:44 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 179
| 15911 | 2010-07-20 | INFO | Gateway | 18:05:42 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2294]. Current contract loaded [QR] |
| 15910 | 2010-07-20 | INFO | Gateway | 18:05:42 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 178
| 15909 | 2010-07-20 | INFO | Gateway | 18:05:42 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2284]. Current contract loaded [QO] |
| 15908 | 2010-07-20 | INFO | Gateway | 18:05:42 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 177
| 15907 | 2010-07-20 | INFO | Gateway | 18:05:40 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2272]. Current contract loaded [QI] |
| 15906 | 2010-07-20 | INFO | Gateway | 18:05:40 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 176
| 15905 | 2010-07-20 | INFO | Gateway | 18:05:38 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2261]. Current contract loaded [QC] |
| 15904 | 2010-07-20 | INFO | Gateway | 18:05:38 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 175
| 15903 | 2010-07-20 | INFO | Gateway | 18:05:38 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2237]. Current contract loaded [GSI] |
| 15902 | 2010-07-20 | INFO | Gateway | 18:05:38 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 174
| 15901 | 2010-07-20 | INFO | Gateway | 18:05:36 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2216]. Current contract loaded [GPL] |
| 15900 | 2010-07-20 | INFO | Gateway | 18:05:36 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 173
| 15899 | 2010-07-20 | INFO | Gateway | 18:05:34 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2208]. Current contract loaded [GPA] |
| 15898 | 2010-07-20 | INFO | Gateway | 18:05:34 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 172
| 15897 | 2010-07-20 | INFO | Gateway | 18:05:34 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2200]. Current contract loaded [GHG] |
| 15896 | 2010-07-20 | INFO | Gateway | 18:05:34 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 171
| 15895 | 2010-07-20 | INFO | Gateway | 18:05:32 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2175]. Current contract loaded [GGC] |
| 15894 | 2010-07-20 | INFO | Gateway | 18:05:32 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 170
| 15893 | 2010-07-20 | INFO | Gateway | 18:05:32 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2154]. Current contract loaded [GAL] |
| 15892 | 2010-07-20 | INFO | Gateway | 18:05:32 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 169
| 15891 | 2010-07-20 | INFO | Gateway | 18:05:30 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2148]. Current contract loaded [PB] |
| 15890 | 2010-07-20 | INFO | Gateway | 18:05:30 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 168
| 15889 | 2010-07-20 | INFO | Gateway | 18:05:27 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2148]. Current contract loaded [LH] |
| 15888 | 2010-07-20 | INFO | Gateway | 18:05:27 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 167
| 15887 | 2010-07-20 | INFO | Gateway | 18:05:27 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2148]. Current contract loaded [LE] |
| 15886 | 2010-07-20 | INFO | Gateway | 18:05:27 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 166
| 15885 | 2010-07-20 | INFO | Gateway | 18:05:25 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2148]. Current contract loaded [LC] |
| 15884 | 2010-07-20 | INFO | Gateway | 18:05:25 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 165
| 15883 | 2010-07-20 | INFO | Gateway | 18:05:25 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2130]. Current contract loaded [HE] |
| 15882 | 2010-07-20 | INFO | Gateway | 18:05:25 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 164
| 15881 | 2010-07-20 | INFO | Gateway | 18:05:23 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2108]. Current contract loaded [GPB] |
| 15880 | 2010-07-20 | INFO | Gateway | 18:05:23 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 163
| 15879 | 2010-07-20 | INFO | Gateway | 18:05:21 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2096]. Current contract loaded [GF] |
| 15878 | 2010-07-20 | INFO | Gateway | 18:05:21 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 162
| 15877 | 2010-07-20 | INFO | Gateway | 18:05:21 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2096]. Current contract loaded [FC] |
| 15876 | 2010-07-20 | INFO | Gateway | 18:05:21 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 161
| 15875 | 2010-07-20 | INFO | Gateway | 18:05:19 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2080]. Current contract loaded [ZSP] |
| 15874 | 2010-07-20 | INFO | Gateway | 18:05:19 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 160
| 15873 | 2010-07-20 | INFO | Gateway | 18:05:19 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2080]. Current contract loaded [ZND] |
| 15872 | 2010-07-20 | INFO | Gateway | 18:05:19 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 159
| 15871 | 2010-07-20 | INFO | Gateway | 18:05:17 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2080]. Current contract loaded [ZMD] |
| 15870 | 2010-07-20 | INFO | Gateway | 18:05:17 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 158
| 15869 | 2010-07-20 | INFO | Gateway | 18:05:15 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2080]. Current contract loaded [ZDJ] |
| 15868 | 2010-07-20 | INFO | Gateway | 18:05:15 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 157
| 15867 | 2010-07-20 | INFO | Gateway | 18:05:15 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2080]. Current contract loaded [YM] |
| 15866 | 2010-07-20 | INFO | Gateway | 18:05:15 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 156
| 15865 | 2010-07-20 | INFO | Gateway | 18:05:13 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2076]. Current contract loaded [SP5] |
| 15864 | 2010-07-20 | INFO | Gateway | 18:05:13 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 155
| 15863 | 2010-07-20 | INFO | Gateway | 18:05:11 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2074]. Current contract loaded [SP] |
| 15862 | 2010-07-20 | INFO | Gateway | 18:05:11 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 154
| 15861 | 2010-07-20 | INFO | Gateway | 18:05:11 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2062]. Current contract loaded [SMC] |
| 15860 | 2010-07-20 | INFO | Gateway | 18:05:11 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 153
| 15859 | 2010-07-20 | INFO | Gateway | 18:05:09 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2057]. Current contract loaded [RSM-M] |
| 15858 | 2010-07-20 | INFO | Gateway | 18:05:09 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 152
| 15857 | 2010-07-20 | INFO | Gateway | 18:05:09 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2053]. Current contract loaded [RLM-M] |
| 15856 | 2010-07-20 | INFO | Gateway | 18:05:09 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 151
| 15855 | 2010-07-20 | INFO | Gateway | 18:05:07 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2047]. Current contract loaded [RE] |
| 15854 | 2010-07-20 | INFO | Gateway | 18:05:07 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 150
| 15853 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2043]. Current contract loaded [NQ] |
| 15852 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 149
| 15851 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2038]. Current contract loaded [NKD] |
| 15850 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 148
| 15849 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2038]. Current contract loaded [NK] |
| 15848 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 147
| 15847 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2032]. Current contract loaded [NIY] |
| 15846 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 146
| 15845 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2017]. Current contract loaded [ND] |
| 15844 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 145
| 15843 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2007]. Current contract loaded [MSCIP] |
| 15842 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. LOaded Base Contracts Num: 144
| 15841 | 2010-07-20 | INFO | Gateway | 18:05:05 | OECAPI::moAPI_OnContractsChanged. Total Global->Contracts->Count: [2004]. Current contract loaded [MSCI] |


Anatoly Gutnick

API Support » Contract.PriceToString Method question Jul 13, 2010 @ 09:40 AM (Total replies: 0)

Hello!

Can you please clarify how this function implemented?
Simple pseudo-source code of this function will be helpeful.

Contract.PriceToString Method
Formats price using contract price format, multiplier and tick size
public String PriceToString(
Double Price
);

For ZF contract for example:

BidLevel = 118.226563
Contract.PriceToString(118.226563) = 118 09.75;

Exchange:CBL
Contract:ZFU0

TickSize:0.0078125
PriceMultiplier:0
PriceFormat:-32

Regards,
Anatoly


Anatoly Gutnick
Edited by AAnatoly on Jul 13, 2010 at 09:41:19

API Support » OnDisconnectedEvent and other events are not called Jul 06, 2010 @ 10:00 AM (Total replies: 5)

It was some ACE Thread related issue.
It is resolved.


Thanks.
Anatoly

Anatoly Gutnick

API Support » Working with RequestContracts/OnContractsChanged and SymbolLookup/GlobalSymbolLookupReceived Jul 06, 2010 @ 09:56 AM (Total replies: 3)

Here are some places in the code of “OEC API Advanced Example” and my question below.

1. OECClient.Global.RequestContracts is called as below:

void OECClient_OnLoginComplete()
{
OnConnectionStatusChange( ConnectionStatus.Connected );
foreach( OEC.API.BaseContract bc in OECClient.Global.ContractGroups["Indices"].BaseContracts )
if( bc.IsFuture )
OECClient.Global.RequestContracts( bc );
}

2. Then in another place it is call to OECClient.Global.SymbolLookup

_criteria = new SymbolLookupCriteria
{
SearchText = edText.Text, //*
ContractGroup = cbContractGroup.SelectedItem as ContractGroup, //NULL
Exchange = OECClient.Global.Exchanges[cbExchangeFilter.Text], //NULL
DesiredResultCount = (int) edMaxResults.Value //1000
};

_criteria.ContractKinds.Add( ContractKind.Future );
_criteria.ContractKinds.Add( ContractKind.FutureCompound );
_criteria.ContractKinds.Add( ContractKind.GenericCompound );

OECClient.Global.SymbolLookup(_criteria);

3. Then callback received:

void GlobalSymbolLookupReceived(SymbolLookupCriteria symbolLookup, ContractList contracts)
{
//Contracts.Count; // Contracts.Count is 172
}

4. OnContractsChanged(BaseContract bc) is not implemented in the example, but if subscribed then is is called 172 times.


Questions:

1. If we remove/comment OECClient.Global.RequestContracts call from this application then we will receive
50 contracts in GlobalSymbolLookupReceived and not 172+50 = 222 contracts.

Can you please explain how SymbolLookup depend on RequestContracts ?
How they may be used together?


2. I just want to get list of all FUTURES contracts.

If I must call OECClient.Global.RequestContracts( bc );
Then how I can know that ALL requested contracts are loaded?

Help says that OnContractsChanged() may be used.
But, OnContractsChanged() is called one by one for each BaseContract.

I want to know that ALL requested contracts loaded and then to call SymbolLookup

Regards,
Anatoly

Anatoly Gutnick

API Support » OnDisconnectedEvent and other events are not called Jul 03, 2010 @ 06:05 AM (Total replies: 5)

Thanks.

I checked that OECAPI instance craeted and connected in the same thread as message loop.

But still events are not fired.

What esle can be cheked in our application?
OECClient wtire some logs to trace issues?

(But the way, why you required from client to have message loop and thread limitation.
Why standard .Net delagate/event mehanism can be used to implement callbacks without limitation to client)



Anatoly Gutnick

Edited by AAnatoly on Jul 3, 2010 at 09:43:55