0.2.0 preview release

Moderator: Moderator

0.2.0 preview release

Postby Nikolay.Gekht » Fri Mar 25, 2011 4:54 pm

Please find information about the release here:
http://fxcodebase.com/wiki/index.php/Ma ... 280.2.0%29
Nikolay.Gekht
FXCodeBase: Base Builder
 
Posts: 1222
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: 0.2.0 preview release

Postby frAnton » Mon Apr 18, 2011 9:09 am

Hi Nikolay,

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

thanks,
Anton.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: 0.2.0 preview release

Postby sunshine » Tue Apr 19, 2011 5:46 am

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
sunshine
 

Re: 0.2.0 preview release

Postby frAnton » Thu Apr 28, 2011 4:37 pm

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.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: 0.2.0 preview release

Postby sunshine » Fri Apr 29, 2011 6:53 am

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
sunshine
 

Re: 0.2.0 preview release

Postby frAnton » Fri Apr 29, 2011 9:54 am

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.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: 0.2.0 preview release

Postby sunshine » Mon May 02, 2011 8:55 am

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);
        }
sunshine
 

Re: 0.2.0 preview release

Postby frAnton » Mon May 02, 2011 6:01 pm

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.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: 0.2.0 preview release

Postby sunshine » Tue May 03, 2011 5:07 am

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.
sunshine
 

Re: 0.2.0 preview release

Postby frAnton » Tue May 03, 2011 3:24 pm

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.
Last edited by frAnton on Wed May 04, 2011 8:54 pm, edited 1 time in total.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Next

Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 3 guests

cron