Exemple #1
0
TLOrder LS_TLWM::ProcessOrder(L_Order* order)
{
    TLOrder o;
    long lsid = order->L_ReferenceId();
    // ensure it exists
    if (order)
    {

        // udpate order information
        CTime ct = CTime(order->L_CreateTime());
        o.symbol = CString(order->L_Symbol());
        o.time = (ct.GetHour()*10000)+(ct.GetMinute()*100)+ct.GetSecond();
        o.date = (ct.GetYear()*10000)+(ct.GetMonth()*100)+ct.GetDay();
        o.exchange = CString(order->L_OriginalMarket());
        o.price = order->L_AveragePrice();
        o.side = order->L_TradeSide()=='B';
        o.stop = order->L_SecondaryPrice();
        o.size = (o.side ? 1 : -1) * abs(order->L_ActiveShares());
        o.account = CString(accounts[0]->L_TraderId());
        // try to save this order
        bool isnew = saveOrder(order,0);
        // if it fails, we already have it so get the id
        // if it succeeds, we should be able to get the id anyways
        int64 tlid = fetchOrderId(order);
        o.id = tlid;
        if (!_noverb)
        {
            if (isnew)
            {
                CString tmp;
                tmp.Format("%s new order tlid: %lld lsid: %i ord: %s",o.symbol,o.id,lsid,o.Serialize());
                v(tmp);
            }
            else
            {
                CString tmp;
                tmp.Format("%s processed order tlid: %lld lsid: %i ord: %s",o.symbol,tlid,lsid,o.Serialize());
                v(tmp);
            }
        }
    }
    else
    {
        CString tmp;
        tmp.Format("%i order id not found.",lsid);
        D(tmp);
    }
    return o;
}
Exemple #2
0
void reorganizeThumbs(){
	if( selected == placedIndex ) return;
	
	vector <imageThumb> tmp;
	
	for(int i = 0; i < thumbs.size(); i++){
		if( i == placedIndex ){
			tmp.push_back( thumbs[selected] );
		}
		if( i != selected ){
			tmp.push_back( thumbs[i] );
		}
	}
	thumbs.clear();
	thumbs = tmp;
	
	reSort();
	saveOrder();
	
}
Exemple #3
0
void StrikeBalanceWidget::createActions()
{
    // Add tool tar actions for order list.
    m_addAct          = new QAction(QIcon(":/add"), tr("Add"), this);
    m_deleteAct       = new QAction(QIcon(":/delete"), tr("Delete"), this);
    m_saveAct         = new QAction(QIcon(":/ok"), tr("Save"), this);
    m_cancelAct       = new QAction(QIcon(":/cancel"), tr("Cancel"), this);
    m_findAct         = new QAction(QIcon(":/find"), tr("Find"), this);
    m_findClientAct   = new QAction(QIcon(":/find"), tr("Find Client"), this);
    
    m_deleteAct->setDisabled(true);
    m_saveAct->setDisabled(true);
    m_cancelAct->setDisabled(true);

    connect(m_addAct, SIGNAL(triggered()), this, SLOT(addOrder()));
    connect(m_deleteAct, SIGNAL(triggered()), this, SLOT(deleteOrder()));
    connect(m_saveAct, SIGNAL(triggered()), this, SLOT(saveOrder()));
    connect(m_cancelAct, SIGNAL(triggered()), this, SLOT(cancelModifiedOrder()));
    connect(m_findAct, SIGNAL(triggered()), this, SLOT(findOrder()));
    connect(m_findClientAct, SIGNAL(triggered()), this, SLOT(findClient()));
}