Re: [Quickfix-developers] Currency Pairs
Brought to you by:
orenmnero
From: Patrick W. <pw...@ka...> - 2008-03-26 02:54:17
|
Not really sure - but some things to check. Did you get a QuoteRequest Acknowledgement back? Are you setting the dealt currency correctly? Maybe you are not permissioned by your broker for that pair. Or they could just be not sending prices for that pair right now. Sometimes they need to turn them on. Cheers, Patrick -----Original Message----- From: Parjeet Singh [mailto:par...@oa...] Sent: Wednesday, 26 March 2008 12:53 PM To: Patrick Wright; qui...@li... Subject: RE: [Quickfix-developers] Currency Pairs Thanks Patrick for your help. When I pass the currency pairs e.g. "EUR/USD", I am able to receive the message from the Broker, but when I am passing second set of currency pairs e.g. "AUD/USD", I am still receiving "EUR/USD" with different prices. Do I have to refresh the message when I send new set of currency pairs? Thanks PS -----Original Message----- From: Patrick Wright [mailto:pw...@ka...] Sent: Tuesday, 25 March 2008 11:29 AM To: Parjeet Singh; qui...@li... Subject: RE: [Quickfix-developers] Currency Pairs After you have put your currency pairs into a config file you need to call your own function once for each pair and keep a track of the quote request ids. This will allow you to subscribe, unsubscribe and check whether your subscription request was accepted. Here is some example c# code. Sorry for formatting //example marketCodeThirdParty is USD/JPY, marketId is my internal ID for the same market protected override void SendSubscribePermanent(int marketId, string marketCodeThirdParty, int qty) { QuickFix42.QuoteRequest mdRequest = new QuickFix42.QuoteRequest(); //_lastQuoteIdentifier is just an int which is incremented for each request QuoteReqID requestId = new QuoteReqID((++_lastQuoteIdentifier).ToString()); mdRequest.set(requestId); QuickFix42.QuoteRequest.NoRelatedSym noRelatedSymbols = new QuickFix42.QuoteRequest.NoRelatedSym(); noRelatedSymbols.set(new Symbol(marketCodeThirdParty)); //returns USD etc Currency currency = new Currency(GetDealtCurrency(marketCodeThirdParty)); noRelatedSymbols.set(currency); OrderQty qty = new OrderQty(quantity); noRelatedSymbols.set(qty); FutSettDate settDate = new FutSettDate("SP"); noRelatedSymbols.set(settDate); TransactTime transactTime = new TransactTime(DateTime.Now.ToUniversalTime()); noRelatedSymbols.set(transactTime); OrdType orderType = new OrdType('C'); noRelatedSymbols.set(orderType); SecurityType secType = new SecurityType("FOR"); noRelatedSymbols.set(secType); // quote duration field noRelatedSymbols.setField(new IntField(6065, 0)); mdRequest.addGroup(noRelatedSymbols); if (Session.doesSessionExist(_currentSessionID)) { //update our collections mapping my marketid to quote request id if (_marketIdToQuote.ContainsKey(marketId)) { _marketIdToQuote[marketId] = requestId.getValue(); } else { _marketIdToQuote.Add(marketId, requestId.getValue()); } if (_quoteRequestToMarket.ContainsKey(requestId.getValue())) { _quoteRequestToMarket[requestId.getValue()] = marketId; } else { _quoteRequestToMarket.Add(requestId.getValue(), marketId); } Session.sendToTarget(mdRequest, _currentSessionID); } } protected override void CancelSubscribePermanent(int marketId , string marketCodeThirdParty, int quantity) { QuickFix42.QuoteRequest mdRequest = new QuickFix42.QuoteRequest(); QuoteReqID requestId = new QuoteReqID(DateTime.Now.Ticks.ToString()); mdRequest.set(requestId); QuickFix42.QuoteRequest.NoRelatedSym noRelatedSymbols = new QuickFix42.QuoteRequest.NoRelatedSym(); noRelatedSymbols.set(new Symbol(marketCodeThirdParty)); Currency currency = new Currency(GetDealtCurrency(marketCodeThirdParty)); noRelatedSymbols.set(currency); OrderQty qty = new OrderQty(quantity); noRelatedSymbols.set(qty); FutSettDate settDate = new FutSettDate("SP"); noRelatedSymbols.set(settDate); TransactTime transactTime = new TransactTime(DateTime.Now.ToUniversalTime()); noRelatedSymbols.set(transactTime); OrdType orderType = new OrdType('C'); noRelatedSymbols.set(orderType); SecurityType secType = new SecurityType("FOR"); noRelatedSymbols.set(secType); // quote duration field noRelatedSymbols.setField(new IntField(6065, -1)); mdRequest.addGroup(noRelatedSymbols); if (_currentSessionID != null && Session.doesSessionExist(_currentSessionID)) { //update our collections if (_marketIdToQuote.ContainsKey(marketId)) { string quoteId = _marketIdToQuote[marketId]; _marketIdToQuote.Remove(marketId); if (_quoteRequestToMarket.ContainsKey(quoteId)) { _quoteRequestToMarket.Remove(quoteId); } } Session.sendToTarget(mdRequest, _currentSessionID); } } public override void onMessage(QuickFix42.QuoteAcknowledgement message_, SessionID session) { QuoteAckStatus ack = message_.getQuoteAckStatus(); //quote request was rejected if (ack.getValue() == 5) { QuoteReqID reqId = message_.getQuoteReqID(); int marketId = 0; if (_quoteRequestToMarket.ContainsKey(reqId.getValue())) { marketId = _quoteRequestToMarket[reqId.getValue()]; } string description = " QuoteAck Reject. Market:" + marketId + " Reason:"; Text text = new Text(); QuoteRejectReason reject = new QuoteRejectReason(); if (message_.isSet(reject)) { reject = message_.getQuoteRejectReason(); description += GetQuoteRejectDescription(reject.getValue()); } if (message_.isSet(text)) { description += " Text: "; text = message_.getText(); description += text.getValue(); } //Log the error ...omitted //update our collections if (_marketIdToQuote.ContainsKey(marketId)) { string quoteId = _marketIdToQuote[marketId]; _marketIdToQuote.Remove(marketId); if (_quoteRequestToMarket.ContainsKey(quoteId)) { _quoteRequestToMarket.Remove(quoteId); } } } } -----Original Message----- From: qui...@li... [mailto:qui...@li...] On Behalf Of Parjeet Singh Sent: Wednesday, 19 March 2008 4:53 PM To: qui...@li... Subject: [Quickfix-developers] Currency Pairs QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html |