Get MMR (O2GO, CS)

From FxCodeBaseWiki

Jump to: navigation, search

The example shows how to get the MMR value for a certain account/offer. The sample prints MMR values for all offers and all accounts.

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Sample.MMR
    class Program
        static FXCore.CoreAut mCore;
        static FXCore.TradeDeskAut mDesk;        
        static void Main(string[] args)
                if (args.Length < 2)
                    Console.WriteLine("usage: sample.MMR.exe user password");
                //create an o2go object and log in                
                mCore = new FXCore.CoreAut();
                mDesk = (FXCore.TradeDeskAut)mCore.CreateTradeDesk("trader");                
                mDesk.Login(args[0], args[1], "", "Demo");
                //enumerate all accounts and offers, for each pair offer + account show the MMR value
                FXCore.TableAut accounts = (FXCore.TableAut)mDesk.FindMainTable("accounts");
                FXCore.TableAut offers = (FXCore.TableAut)mDesk.FindMainTable("offers");
                FXCore.TradingSettingsProviderAut tradingSettings = (FXCore.TradingSettingsProviderAut)mDesk.TradingSettingsProvider;
                foreach (FXCore.RowAut account in (FXCore.RowsEnumAut)accounts.Rows)
                    string account_id = (string)account.CellValue("AccountID");
                    Console.WriteLine("====Account {0}====", account_id);
                    foreach (FXCore.RowAut offer in (FXCore.RowsEnumAut)offers.Rows)
                        string instrument = (string)offer.CellValue("Instrument");
                        Console.WriteLine("The MMR for {0}: {1}", instrument, tradingSettings.GetMMR(instrument, account_id));
            catch (Exception e)
                Console.WriteLine("{0}", e.ToString());

This Article in Other Languages

Language: English  • EspaƱol
Personal tools