Narrow width layout Medium width layout Full-screen width layout    Small text Medium text Large text    Color Palette Selector      Search
Register  |  
Forum policy    

These Discussion Forums are dedicated to discussions on Sophis products. Some are private, you shall be connected to see their content.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to Sophis products.
2. No Flaming or Trolling.
3. No Profanity, Racism, or Prejudice.
4. Publishing information for insider trades or other illegal trading is forbidden and will be reported,
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Private messaging between users is enable. If you already put a message on forums, a registered user can send you a private message by clicking on the username link, and thus on the "Message User" link on the "Private Messaging" row. The messages can be read by clicking on the Inbox button of the toolbar.

 
Forums    
 
  Forum  Risque Support  Real-time  Notify an instrument modification using CSREvent
Previous Previous
 
Next Disabled
New Post 6/4/2008 3:12 PM
  Philippe Bonneau
254 posts
www.ebsys.fr
1st Level Poster


Notify an instrument modification using CSREvent 
Modified By Philippe Bonneau  on 6/4/2008 2:14:38 PM)

Hi,

Little changes when creating an event to notify the clients of the SEC server that an instrument was updated - for instance, directly into the database by an update or insert-: a new tag should be added: wdID. I don't know the signification of this tag, but adding this tag and setting it to a "0" value works fine. If this tag is not added, an error 'tag not found' will be returned by the CSREvent::SendEvent method.

Thus, finally, for those who want all the code, this one works fine on the 5.3.2:

CSREvent _event;

const CSRInstrument* _instrument = NULL;
try
{
 // first: release the instrument if already loaded, because the internal definition
 // could be different on the web service: if we try to notify, it's that there's a problem
 // of coherency between the database and the memory somewhere....
 CSRInstrument::Free(*ident);
 // then load it again
 _instrument = CSRInstrument::GetInstance(*ident);
}
catch(...)
{
 exception->set(__ITQ_E_INSTRUMENT_GETTING__,"Unknown error");
}
if(exception->m_error==0)
{
 if(_instrument!=NULL)
 {
  char _buffer[41];
  // Internal code
  _event.Add('SICO',*ident);
  // Reference
  _instrument->GetReference(_buffer);
  _event.Add('refc',_buffer);
  // Name
  _instrument->GetName(_buffer);
  _event.Add('name',_buffer);
  // Currency
  long _ccy = _instrument->GetCurrency();
  _event.Add('curr',_ccy);
  // Type
  _buffer[0] = _instrument->GetType();
  _buffer[1] = '\0';
  _event.Add('type',_buffer);
  // + Beta (needed)
  const CSREquity* _equity = dynamic_cast<const CSREquity*>(_instrument);
  double _beta = _equity==NULL ? 0. : _equity->GetBeta();
  _event.Add('beta',_beta);
  // Owner/modifier
  _event.Add('ownr',(short)0);
  // wdID ???
  _event.Add('wdID',(long)0);

  long _eventType = ieCHANGE; // ajti

  try
  {
    sophis::misc::eEventErrorCode _error = _event.SendEvent(classAPIPacket,_eventType); // PAPI + ajti
    if(_error!=eecNoError)
    {
     char _msg[256];
     snprintf(_msg,sizeof(_msg),"Error while sending instrument event, error=%i",_error);
     exception->set(__ITQ_E_EVENT_SEND__,_msg);
    }
  }
  catch(...)
  {
   exception->set(__ITQ_E_EVENT_SEND__,"Unknown error while sending instrument event");
  }
 }
 else
  exception->set(__ITQ_E_UNDEFINED_INSTRUMENT__,"Undefined instrument");
}

Rgds,

Philippe

 
Previous Previous
 
Next Disabled
  Forum  Risque Support  Real-time  Notify an instrument modification using CSREvent
 Syndicate  

Copyright 2007-2008 by Ebsys  | Terms Of Use | Privacy Statement  | Skin by Speerio