Reputation: 11
I'm working on FxPro Ctrader broker (FIX 4.4) and I'm trying to make an FixApi in C# using QuickFix/n library (1.7.0.0).
I stucked at 'NewOrderSingle': After successful logon I'm trying to make an order:
class TradeConnection : MessageCracker, IApplication
{
public void OnLogon(SessionID sessionID)
{
Write.Info("Account TRADE successful logged " + sessionID);
sendOrder();
}
public void sendOrder()
{
NewOrderSingle oc = new NewOrderSingle();
ClOrdID ID = new ClOrdID("1408479");
Symbol symb = new Symbol("1");
Side side = new Side('1');
OrderQty lots = new OrderQty(1000);
OrdType type = new OrdType('1');
TransactTime TransactTime = new TransactTime(DateTime.Now);
TimeInForce TimeInForce = new TimeInForce('3');
oc.SetField(ID);
oc.SetField(symb);
oc.SetField(side);
oc.SetField(lots);
oc.SetField(type);
oc.SetField(TimeInForce);
send(oc);
}
public void send(QuickFix.Message message)
{
Session.SendToTarget(message, sessionID);
}
}
Unfortunately it isn't working and I get error:
A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll
Same error appears @
RequestForPositions and OrderStatusRequest
On same account in api that uses NetworkStream rather than QuickFix lib it works fine.
Upvotes: 0
Views: 159
Reputation: 11
Problem solved. Forgot to set field TransactTime which counterparty required:
oc.SetField(TransactTime);
Upvotes: 1