Trade FOREX with FXCM

  • Award-Winning Platform
  • 24/7 Customer Support
  • Trade Directly on Charts
  • Free $50K Practice Account
Register


Results 1 to 10 of 10

Thread: Table Manager vs Non-table Manager

  1. #1
    gym2000usa is offline Member
    Join Date
    Jun 2012
    Posts
    5

    Table Manager vs Non-table Manager

    I am new here. I need to implement interface between FXCM and My software (WPF) to create/execute orders, get updates on those orders (executions), subscribe for quotes etc. I downloaded Forex Connect API and after install I see several example projects, which is divided in "Table Manager" AND "Non-table Manager" examples. What the difference between them? And which way "Table Manager" -OR- "Non-table Manager" would be better to use for my project? Suggestions highly appreciated. Thank you in advance.

  2. #2
    Natalya is offline Member
    Join Date
    Apr 2009
    Posts
    744
    The table manager is responsible to keep all tables data and perform all offer-based calculations (such as open trades profit/loss and current account equity) "on the fly". Without table manager you won't have keeping trading table data inside the API and calculations of the P/L, trailing stops, summary on each tick.
    If your application does not need calculated values, usage of table manager is not recommended.

    Please read also about advantages and disadvantages of table manager in this article O2GTableManager

  3. #3
    gym2000usa is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Thank you for answer it was very helpful.
    According to ForexConnect API document in order to login to FXCM and get responses I should create session, listeners, and subscribe listeners and catch SessionStatusChanged, onRequestCompleted etc...and “WholeSample” project from SDK does that, so all event handling is coded by hand. But, Session object already have all those events built in. Can I use built in events in Session object instead of writing all those listeners by hand?
    Thank you.

  4. #4
    Natalya is offline Member
    Join Date
    Apr 2009
    Posts
    744
    Yes, you can use built-in events. For example, see the OpenPosition sample in the simple samples folder:
    ...\ForexConnectAPI\samples\cs\dotnet20\SimpleSamples\OpenPosition\

  5. #5
    gym2000usa is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Thanks again. I used built-in events (no table manager) to create orders, get offers … etc. It’s working fine. I assigned “session.TablesUpdates” built-in event to get updates and updates coming for ALL tables offers, orders, trades … etc. into one event handler. So, I have to iterate through tables reader to get update for order or offer or trade, then when new “TableUpdate” response is coming I have to iterate again. That is problem for me, because it’s slows down offers updates stream. I need stream of Order updates and Offer updates coming in separate independent handles.
    Q: Can I mix “table manager” and “non-table manager” architecture that I will use “non-table manager” built-in events to workout Orders updates AND “table manager” to workout just Offers updates? May be you know another solution using built-in events to SEPARATE flow of updates for different tables?
    Thank you.

  6. #6
    Natalya is offline Member
    Join Date
    Apr 2009
    Posts
    744
    You can mix 'table manager' and 'non-table manager architecture, but in both architectures event calling and TableUpdate occurs in context of one thread (in other words, in context of one flow).

    Could you please tell what do you mean by 'slows down offers updates stream'?

    Please tell also for which purpose you get offers stream:
    - calculate your values;
    - show them in GUI;
    - write to file;
    - something else.

    If you process all your events in TableUpdates, you may process offers with delay. Offers may be collected in an internal update queue. You can create two different threads. This provides you with different flows. In OnTablesUpdates, you route a response or result response to offer and trade thread. You can send IO2GResponse and process result in different threads or process a response and then send IO2GOfferRow directly (IO2GTradeRow, IO2GOrderRow, etc). For synchronization between threads you can use a queue (for details, please see samples/dotnet20/WholeSample/ResponseQueue.cs).

  7. #7
    gym2000usa is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Thank you for your response.
    1. What I meant is, all updates for Offers, Order and Trades coming into one event handler and goes into one response queue, then each update extracted one by one from response queue. For example while I am taking update for created “Order” and process it from response queue, another update for “Offer” waiting in the queue. I want stream offer updates without delays while I process order updates. Simply saying separate responses for orders updates from responses for offer updates.
    2. Purpose of offers stream is “show them in the GUI” without delay And generate signals.
    Yes, I can create internal queue just for offer updates and process offers queue in separate thread. But anyway I have to iterate through original response queue, Identify that this update for offer before add it to internal queue to process offers in separate thread. That is why I thought I will get table manager and assign “row change” event just for offers table, then whatever change is coming for offer it will publish “row change” event without any delays. For “orders updates” I am still going to process original response queue coming on Session_TablesUpdates event.

  8. #8
    Natalya is offline Member
    Join Date
    Apr 2009
    Posts
    744
    Internally, ForexConnect has the original response (the same as your application receives in TablesUpdate) and iterates original responses too.
    If the table manager mode is "yes", the "row offer change" is called first, before TablesUpdates is called. In table manager mode the calculated field is computed (PL) and only then offer event is published.

    Currently, the most of FXCM servers have 2 channels system: one for trading, another for prices. In this case, TablesUpdate (and onChange events) for offers and orders are called in a different thread.

    So, if you need calculated fields for your application, it's better to use onChange offers event.
    If you need to show prices only, then it's better to use TableUpdates in non-table manager mode. The offers are automatically received in a separated thread.
    You can use O2GOffersTableResponseReader offersReader = factory.createOffersTableReader(response); in TablesUpdates. This reader contains only offers row.

    P.S. We use TalbeUpdates and WPF (Windows Presentation Foundation) for showing prices in our NYSE monitor project. This project is intended to translate the FXCM prices on a big monitor at New-York Stock exchange. It works fine.

  9. #9
    gym2000usa is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Hello Natalya,

    I am doing extensive testing of FXCM API and run into issue, when order sent with big quantity of lots
    It is not responding with reject and order not appears in FXCM platform as well. But, when I do the same trade at FXCM itself I got message that I cannot trade that many lots.
    Simply saying I need to handle reject if I send order have to many lots, but when I send this order there is no reject responses coming back.
    Question: How to get reject response from FXCM if I send order which have too many lots?

    Thank you.

  10. #10
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    Hi gym2000usa,

    First of all let's see what do you mean by " if I send order have to many lots".

    1) If you mean that the order amount is bigger than the available margin, then ForexConnect must receive "request failed" with the following message:
    [java] ORA-20113: Insufficient margin in session: G10D1_PUa7HMGvDEI05BJf7cfAr4vtpkbXa0vzgUFQXLR9AqHRo22lLQYuaq3DGW

    2) If you trade on the Real account, then the orders with the big amount can be executed longer depending on the market liquidity. And most likely, such order will be executed partially.

    You can find description of How to Monitor Order Execution in ForexConnect in the following section of Help (version 1.2.1):

    How to open position on hedging and non-hedging accounts.

    So, if the Order is rejected, then a rejection message will appear in the Messages table. An order with the "R" status will appear in the Orders table.

    You can also use OrderMonitor class to catch rejected orders in all cases.


    But if you still do not see messages, please provide us the following information:

    • the type of connection you use: Demo or Real;
    • the type of order: Market(at best, range) or Entry
    • the order parameters: GTC/IOC/FOK



    Best regards,
    Ekaterina

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.