Page 1 of 4

0.2.0 preview release

PostPosted: Fri Mar 25, 2011 4:54 pm
by Nikolay.Gekht
Please find information about the release here:
http://fxcodebase.com/wiki/index.php/Ma ... 280.2.0%29

Re: 0.2.0 preview release

PostPosted: Mon Apr 18, 2011 9:09 am
by frAnton
Hi Nikolay,

With regards to current release of ForexConnect, I could not find 'Stop'/'Limit' columns in IO2GTradeRow.

thanks,
Anton.

Re: 0.2.0 preview release

PostPosted: Tue Apr 19, 2011 5:46 am
by sunshine
With the current version of ForexConnect API, you cannot obtain the Stop/Limit directly from the trade object. But you can retrieve the Stop/Limit orders related with your trade from the orders table.

First, retrieve the orders table:

Code: Select all
O2G2Ptr<IO2GRequestFactory> factory = mSession->getRequestFactory(); //create the request factory
O2G2Ptr<IO2GRequest> refreshOrders = factory->createRefreshTableRequestByAccount(Orders, mAccount); //create the Orders request by Account ID
mSession->sendRequest(refreshOrders); //send the request asynchronously


Then, in your implementation of IO2ResponseListener in the onRequestCompleted event handler, process the request response:

Code: Select all
if (response->getType() == GetOrders)
{
    O2G2Ptr<IO2GResponseReaderFactory> pFactory =  mSession->getResponseReaderFactory();       
    O2G2Ptr<IO2GOrdersTableResponseReader> pOrdersReader = pFactory->createOrdersTableReader(response);
    for(int i=0; i< pOrdersReader->size(); i++)
    {
        O2G2Ptr<IO2GOrderRow> order =  pOrdersReader->getRow(i);
        //test the order type for "L", "S", "ST", "LT"  (stop/limit/stop trailing/limit trailing)
        //order->getTradeID(); //retrieve the TradeID and compare it with your trade row ID

Re: 0.2.0 preview release

PostPosted: Thu Apr 28, 2011 4:37 pm
by frAnton
Thanks for answering,

I have another question though with regards to O2GTablesUpdatesReader.
Do I understand it correctly that with onTablesUpdates(O2GResponse data) data contains just one row per table that was changed at the time?
Just could not find how to iterate through the rows that were changed in one table.

thanks,
Anton.

Re: 0.2.0 preview release

PostPosted: Fri Apr 29, 2011 6:53 am
by sunshine
Hi Anton,

Actually, data provided with onTablesUpdates(O2GResponse data) contains all updates (such as "Insert", "Update", "Delete") of all tables at the time when this method is called. For details about how to process table updates, please refer to the method
void EventListener::onTableUpdateReceive(IO2GResponse *response).

You can find this in C++ WholeSample EventListener.cpp provided with ForexConnect API.
By default, the path is:
C:\Program Files\Candleworks\Order2Go2\samples\cpp\WholeSample\source\EventListener.cpp

Re: 0.2.0 preview release

PostPosted: Fri Apr 29, 2011 9:54 am
by frAnton
thanks for the answer,

with current version Size() is not available though, I used Count.
And I got an idea. It can have more than one record changed for one table and all of them will be packed into response and available through the getUpdateTable(i) one by one.

Have another question though, are you guys going to publish Server Time? I would like to be able to synchronize the client with the server. Or may be you might suggest something.

thanks,
Anton.

Re: 0.2.0 preview release

PostPosted: Mon May 02, 2011 8:55 am
by sunshine
Hi Anton,

frAnton wrote:And I got an idea. It can have more than one record changed for one table and all of them will be packed into response and available through the getUpdateTable(i) one by one.

You can group updates for a certain table in your application.

frAnton wrote:Have another question though, are you guys going to publish Server Time? I would like to be able to synchronize the client with the server. Or may be you might suggest something.

thanks,
Anton.

Please follow this example:
Code: Select all
       
private void OnTableUpdateReceive(O2GResponse response)
        {
            O2GResponseReaderFactory factory = mSession.getResponseReaderFactory();
            if (factory == null)
                return;

            O2GTablesUpdatesReader updatesReader = factory.createTablesUpdatesReader(response);
            if (updatesReader == null)
                return;

            Console.WriteLine("Server Time - {0}", updatesReader.ServerTime);
        }

Re: 0.2.0 preview release

PostPosted: Mon May 02, 2011 6:01 pm
by frAnton
thank you for your advise,

However it is not exactly what I am needed.
In O2G we had TradeDesk.ServerTime() and the Client could get server time to synchronize itself anytime when it was needed and not when the table got updated only.
I am looking for similar functionality in ForexConnect API.

thanks,
Anton.

Re: 0.2.0 preview release

PostPosted: Tue May 03, 2011 5:07 am
by sunshine
Hi Anton,

I've passed your suggestion to the development team. May be the function will appear in one the next updates of ForexConnect API.

Re: 0.2.0 preview release

PostPosted: Tue May 03, 2011 3:24 pm
by frAnton
Thank you very much, I really appreciate your help.
Couple of other fields I am missing:
O2GOfferRow.PointCost
O2GOfferRow.MMR
This information is needed for the client to make a decision if it has enough equity to open position and hold it open over time.
I would appreciate if these fields be added to the table.

Another issue:
O2GMessageRow.Text is in Base64(?) format.


thanks,
Anton.