API Support Forum
User Profile

Viewing User Profile for: FFred58


About

May 19, 2009 12:00 AM

Oct 22, 2009 05:54 PM

Dec 08, 2009 10:59 AM




Post Statistics
FFred58 has contributed to 8 posts out of 5593 total posts (0.14%) in 5456 days (0.00 posts per day).

20 most recent posts:

API Support » API & Windows Service Oct 22, 2009 @ 05:54 PM (Total replies: 5)

I am not creating the OEClient object on a different thread. I am creating it on the main thead.

There is no Application context since this is a windows service, not a WinForms application.



Here is a code snippet:

Private _OECClient As OEC.API.OECClient

Protected Overrides Sub OnStart(ByVal args() As String)
HookupEventLog()

WriteEvent("Service Starting...", EventLogEntryType.Information)

_OECClient = New OEC.API.OECClient()
AddHandler _OECClient.OnLoginComplete, AddressOf OECClient_OnLoginComplete
AddHandler _OECClient.OnLoginFailed, AddressOf OECClient_OnLoginFailed
AddHandler _OECClient.OnDisconnected, AddressOf OECClient_Disconnected

_OECClient.Connect(My.Settings.OECServer, My.Settings.OECServerPort, My.Settings.OECLoginID, My.Settings.OECPwd, False)
End Sub


Private Sub OECClient_OnLoginComplete()
WriteEvent("Connected...", EventLogEntryType.Information)
End Sub

Private Sub OECClient_OnLoginFailed(ByVal Reason As OEC.Data.FailReason)
WriteEvent(String.Format("Login Failed: {0}", Reason), EventLogEntryType.Error)
End Sub

Private Sub OECClient_Disconnected(ByVal Unexpected As Boolean)
WriteEvent(String.Format("Disconnected: Unexpected={0}", Unexpected), EventLogEntryType.Warning)
End Sub


Thanks.

Fred Baptiste

API Support » API & Windows Service Oct 22, 2009 @ 02:33 PM (Total replies: 5)

Thanks, but I'm not entirely sure what you mean.

Do you mean I have to trap all windows messages and then pull the messages I need to capture and raise that back to the main thread...

Also, I am creating the OECClient object on the main thread, not a separate thread, just as I do it in my standard windows form...

Can you provide me more detail or maybe just a link to something relevant?

Thanks!!

Fred Baptiste

API Support » API & Windows Service Oct 22, 2009 @ 01:34 PM (Total replies: 5)

I'm hoping someone has come across this problem before or knows what I would need to do.

I have a very simple application sample for now that runs just fine as a windows form. It simply attempts to connect to the api server, logs that it connected from the OnLoginComplete event (or that it failed from the OnLoginFailed event) and then disconnects.

I take the same code (basically replacing msg boxes with event log entries) but my application is now a windows service (running as local system account).

I know the event writing works because the OnStart event writes to the event log. The problem is that I am not receiving any events after I call the Global.Connect method. Neither a OnLoginComplete or a OnLoginFailed event is fired.

Does anyone have any ideas?
Thanks.

Fred Baptiste

API Support » Spot FOREX Oct 20, 2009 @ 03:45 PM (Total replies: 5)

Not that I'm aware of. How would I go about getting that?
Thanks.

Fred Baptiste

API Support » Spot FOREX Oct 20, 2009 @ 03:06 PM (Total replies: 5)

But how do I get the base contract (e.g. EURJPY, or USDJPY, etc) for the spot FOREX...

I do not see that symbol in the contracts list. When I choose FX for the Group, I do not get any base contracts like I do when I choose a Group of Indices for example...

Here is what I am trying to do:
- Retrieve Groups using OEC.API.ContractGroup
- Retrieve Base Contracts using: OEC.API.OECClient.Global.ContractGroups(myGroup.ID).BaseContracts
- Subscribe to the OnContractsChanged event.

However, choosing FX as the Group (ID=43) does not get me any base contracts...

Fred Baptiste

API Support » Spot FOREX Oct 20, 2009 @ 02:23 PM (Total replies: 5)

Does the OEC API support Spot FOREX trading?

Also, can I subscribe to "tick" events from the API?

I do not seem to find a way to do either, so I'm wondering if the API is for futures only...

Fred Baptiste

API Support » Cannot Retrieve Contracts May 19, 2009 @ 12:00 AM (Total replies: 2)

I cannot retrieve a list of contracts from a BaseContract object.

In fact, even the advanced sample is having problems doing that in the following section of the code:

private void SubscribeSomeContracts()
{
List<Contract> contracts = OECClient.Global.BaseContracts["ES"].GetNearestContracts( 2 );
OECClient.Global.Subscribe( contracts[0] );
OECClient.Global.Subscribe( contracts[1] );
}


I get an Index out of Range error in the contracts[0] section.

I am having similar problems in my own code:
Dim BaseCon As OEC.API.BaseContract = OEC.API.OECClient.Global.BaseContracts("ES")

This returns a valid BaseContract object, but the BaseCon.Contracts list has a count of zero.

Thanks in advance for any help...
Fred.

Fred Baptiste

API Support » Cannot Retrieve Contracts May 19, 2009 @ 12:00 AM (Total replies: 2)

I have now done that and handling the OnContractsChanged event. This seems to work.

However, the API documentation I have does not list any of those methods/events.

I downloaded the API docs from the following location:
http://www.openecry.com/api/apichm.zip

The OECClient page has this at the bottom of it:
Generated from assembly API [3.1.2.0]


I notice that the API.dll I am using (from one of the samples) is 3.3.0.

Where can I download the latest API doc (or could you email it to me)?

Your help is much appreciated!!
Thanks!

Fred Baptiste