// 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(); } }
// Find orders by request ID and print it private static void FindOrders(O2GTableManager tableManager, string sRequestID) { O2GOrdersTable ordersTable = (O2GOrdersTable)tableManager.getTable(O2GTableType.Orders); O2GTableIterator ordersIterator = new O2GTableIterator(); O2GOrderTableRow orderRow = null; while (ordersTable.getNextRowByColumnValue("RequestID", sRequestID, ordersIterator, out orderRow)) { Console.WriteLine("Order:{0}, OfferID={1}, Type={2}, Rate={3:N4}, BuySell={4}, Status={5}, Limit={6:N4}, Stop={7:N4}, RequestID={8}", orderRow.OrderID, orderRow.OfferID, orderRow.Type, orderRow.Rate, orderRow.BuySell, orderRow.Status, orderRow.Limit, orderRow.Stop, orderRow.RequestID); } }
// Find orders by type and buysell and print it private static void FindOrdersByTypeAndDirection(O2GTableManager tableManager, String sOrderType, string sBuySell) { O2GOrdersTable ordersTable = (O2GOrdersTable)tableManager.getTable(O2GTableType.Orders); O2GTableIterator ordersIterator = new O2GTableIterator(); O2GOrderTableRow orderRow = null; while (ordersTable.getNextRowByMultiColumnValues(new String[] { "Type", "BuySell" }, new Object[] { sOrderType, sBuySell }, ordersIterator, out orderRow)) { Console.WriteLine("Order:{0}, OfferID={1}, Type={2}, Rate={3:N4}, BuySell={4}, Status={5}, Limit={6:N4}, Stop={7:N4}, RequestID={8}", orderRow.OrderID, orderRow.OfferID, orderRow.Type, orderRow.Rate, orderRow.BuySell, orderRow.Status, orderRow.Limit, orderRow.Stop, orderRow.RequestID); } }
// Find conditional orders and print it private static void FindConditionalOrders(O2GTableManager tableManager) { O2GOrdersTable ordersTable = (O2GOrdersTable)tableManager.getTable(O2GTableType.Orders); O2GTableIterator ordersIterator = new O2GTableIterator(); O2GOrderTableRow orderRow = null; Object[] orderTypes = new Object[] { Constants.Orders.LimitEntry, Constants.Orders.StopEntry, Constants.Orders.Limit, Constants.Orders.Stop, Constants.Orders.Entry, "LTE", "STE" }; while (ordersTable.getNextRowByColumnValues("Type", orderTypes, ordersIterator, out orderRow)) { Console.WriteLine("Order:{0}, OfferID={1}, Type={2}, Rate={3:N4}, BuySell={4}, Status={5}, Limit={6:N4}, Stop={7:N4}, RequestID={8}", orderRow.OrderID, orderRow.OfferID, orderRow.Type, orderRow.Rate, orderRow.BuySell, orderRow.Status, orderRow.Limit, orderRow.Stop, orderRow.RequestID); } }
/// <summary> /// Find order by id and print it /// </summary> /// <param name="session"></param> /// <param name="sAccountID"></param> /// <param name="sOrderID"></param> /// <param name="responseListener"></param> private static void FindOrder(O2GTableManager tableManager, string sAccountID, string sOrderID) { O2GOrdersTable ordersTable = (O2GOrdersTable)tableManager.getTable(O2GTableType.Orders); O2GOrderTableRow orderRow = null; ordersTable.findRow(sOrderID, out orderRow); if (orderRow != null && sAccountID.Equals(orderRow.AccountID)) { Console.WriteLine("OrderID={0}; AccountID={1}; Type={2}; Status={3}; OfferID={4}; Amount={5}; BuySell={6}; Rate={7}", orderRow.OrderID, orderRow.AccountID, orderRow.Type, orderRow.Status, orderRow.OfferID, orderRow.Amount, orderRow.BuySell, orderRow.Rate); } else { Console.WriteLine("Order '{0}' is not found", sOrderID); } }
public Orders(MainForm CurrentForm, O2GTableManager mTblMgr) { CreateTable(); CurrentForm.PopulateTable(OrdersTable); while (mTblMgr.getStatus() != O2GTableManagerStatus.TablesLoaded && mTblMgr.getStatus() != O2GTableManagerStatus.TablesLoadFailed) { Thread.Sleep(50); } O2GOrdersTable table = (O2GOrdersTable)mTblMgr.getTable(O2GTableType.Orders); OrdersListener listener = new OrdersListener(); O2GOrderTableRow row = null; for (int i = 0; i < table.Count; i++) { DataRow CurrentRow = OrdersTable.NewRow(); OrdersTable.Rows.Add(CurrentRow); } CurrentForm.GetTableData(table, listener, row, mTblMgr); }
public void onChanged(string rowID, O2GRow rowData) { O2GOrderTableRow trade = (O2GOrderTableRow)rowData; }