예제 #1
0
 // Print orders table
 private static void PrintOrders(O2GTableManager tableManager)
 {
     tableManager.lockUpdates();
     try
     {
         O2GOrdersTable ordersTable = (O2GOrdersTable)tableManager.getTable(O2GTableType.Orders);
         for (int ii = 0; ii < ordersTable.Count; ii++)
         {
             O2GOrderTableRow orderRow = ordersTable.getRow(ii);
             Console.WriteLine("Order: " + orderRow.OrderID);
             Console.WriteLine("AccountID = " + orderRow.AccountID);
             Console.WriteLine("OfferID = " + orderRow.OfferID);
             Console.WriteLine("Type = " + orderRow.Type);
             Console.WriteLine("Rate = " + orderRow.Rate);
             Console.WriteLine("Buy/Sell = " + orderRow.BuySell);
             Console.WriteLine("Status = " + orderRow.Status);
             Console.WriteLine("Limit = " + orderRow.Limit);
             Console.WriteLine("Stop = " + orderRow.Stop);
         }
     }
     finally
     {
         tableManager.unlockUpdates();
     }
 }
예제 #2
0
        public Offers(O2GTableManager mTblMgr)
        {
            while (mTblMgr.getStatus() != O2GTableManagerStatus.TablesLoaded && mTblMgr.getStatus() != O2GTableManagerStatus.TablesLoadFailed)
            {
                Thread.Sleep(50);
            }
            O2GOffersTable   table    = (O2GOffersTable)mTblMgr.getTable(O2GTableType.Offers);
            OffersListener   listener = new OffersListener();
            O2GOfferTableRow row      = null;

            table.subscribeUpdate(O2GTableUpdateType.Insert, listener);
            table.subscribeUpdate(O2GTableUpdateType.Update, listener);
            try
            {
                mTblMgr.lockUpdates();
                for (int ii = 0; ii < table.Count; ii++)
                {
                    row = table.getRow(ii);

                    foreach (O2GTableColumn CurrentColumn in table.Columns)
                    {
                        if (CurrentColumn.ID == "Instrument")
                        {
                            CurrencyList.Add(row.getCell(1).ToString());
                        }
                    }
                }
            }
            finally
            {
                mTblMgr.unlockUpdates();
            }
            table.unsubscribeUpdate(O2GTableUpdateType.Insert, listener);
            table.unsubscribeUpdate(O2GTableUpdateType.Update, listener);
        }
예제 #3
0
파일: MainForm.cs 프로젝트: Sandbrain/Forex
        public void GetTableData(O2GTable table, IO2GTableListener listener,
                                 O2GRow row, O2GTableManager mTblMgr)
        {
            try
            {
                table.subscribeUpdate(O2GTableUpdateType.Insert, listener);
                table.subscribeUpdate(O2GTableUpdateType.Update, listener);
                try
                {
                    mTblMgr.lockUpdates();
                    for (int ii = 0; ii < table.Count; ii++)
                    {
                        row = table.getGenericRow(ii);

                        foreach (O2GTableColumn CurrentColumn in table.Columns)
                        {
                            for (int jj = 0; jj < row.Columns.Count; jj++)
                            {
                                if (CurrentColumn.ID == row.Columns[jj].ID)
                                {
                                    dataGridView.Rows[ii].Cells[CurrentColumn.ID].Value = row.getCell(jj);
                                }
                            }
                        }
                    }
                }
                finally
                {
                    mTblMgr.unlockUpdates();
                }

                table.unsubscribeUpdate(O2GTableUpdateType.Insert, listener);
                table.unsubscribeUpdate(O2GTableUpdateType.Update, listener);
            }
            catch (Exception e)
            {
                LogDirector.DoAction(4, e);
            }
        }
예제 #4
0
 // Print orders table
 private static void PrintOrders(O2GTableManager tableManager)
 {
     tableManager.lockUpdates();
     try
     {
         O2GOrdersTable ordersTable = (O2GOrdersTable)tableManager.getTable(O2GTableType.Orders);
         for (int ii = 0; ii < ordersTable.Count; ii++)
         {
             O2GOrderTableRow orderRow = ordersTable.getRow(ii);
             Console.WriteLine("Order: " + orderRow.OrderID);
             Console.WriteLine("AccountID = " + orderRow.AccountID);
             Console.WriteLine("OfferID = " + orderRow.OfferID);
             Console.WriteLine("Type = " + orderRow.Type);
             Console.WriteLine("Rate = " + orderRow.Rate);
             Console.WriteLine("Buy/Sell = " + orderRow.BuySell);
             Console.WriteLine("Status = " + orderRow.Status);
             Console.WriteLine("Limit = " + orderRow.Limit);
             Console.WriteLine("Stop = " + orderRow.Stop);
         }
     }
     finally
     {
         tableManager.unlockUpdates();
     }
 }