quickfix: How to know whether a fid is in a group or not? - quickfix

Let's assume there is such part in quickfix's data dictionary
<message name="Name" msgtype="type">
<field name="field1" required="Y"/>
<field name="field2" required="Y"/>
<field name="field3" required="N"/>
<group name="group1" required="Y">
<field name="field4" required="Y"/>
</group>
<group name="group2" required="Y">
<field name="field5" required="Y"/>
<field name="field6" required="N"/>
</group>
</message>
While sending request, I need to construct message correctly - set field5 in group2, field4 in group1, and field1 outside of any group. Is there a way in quickfix library to know, for example, if field4 is in a group or not? And in which group?
If not, how is it possible to use quickfix library, if you are depending on data dictionary client will use? I should force clients to configure data dictionary as I configured it?

I should force clients to configure data dictionary as I configured it?
Yes. A server ("acceptor") and its clients ("initiators") should all be using the same DataDictionary.
If you are providing a server, you should provide documentation that defines exactly what messages/fields you support, and how use use those messages and fields. If you don't provide a QuickFIX data dictionary file, you should provide sufficient information so that client firms can create one.
Is there a way in quickfix library to know, for example, if field4 is in a group or not? And in which group?
I think you are asking this question because you don't really know what you're doing yet. :)
I think there might be DD methods for this, but I can't really remember because they're not something people usually need. I don't think this is the right approach for whatever your problem is.

Related

Wrong values in Interim Accounts when returning stock

I am using anglo saxon accounting ​method in my accounting and I use average pricing as my costing method in inventory. But I am struggling with the vendor stock returning process because after validating the return, stock interim account values are not as I expected. I want to return the stock to the vendor to the price of what bought but it returned to the current price.
https://www.odoo.com/documentation/user/12.0/accounting/others/inventory/avg_price_valuation.html
As the above link says, Odoo can cater stock returns to their purchase price (see section: “Further thoughts on anglo saxon mode”). But I run the same test case on my server (Odoo 12) as well as the Odoo demo server, but it returns to the current price.
Is there any specific configuration for enabling this process or am I doing something wrong?
all you need to do is inherit view_company_form view and add anglo_saxon_accounting field
<record id="view_company_form_inherit" model="ir.ui.view">
<field name="name">res.company.form.inherit</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='rml_header1']" position="after">
<separator string=""/>
<group >
<field name="anglo_saxon_accounting" />
</group>
</xpath>
</field>
</record>

Make notes global?

I have a client who wants to use notes and have them global across all users. It would be easiest to just remove the user dependency to display to all users. The other option is to add message_follower_ids upon creation to add a "general" channel as a follower but I'm clueless as to what the values would be.
Any thoughts, ideas, advice is greatly appreciated.
You can achieve using two methods.
You can inactive record rule of note.
<record id="note.note_note_rule_global" model="ir.rule">
<field name="name">Only followers can access a sticky notes</field>
<field name="model_id" ref="note.model_note_note"/>
<field name="active" eval="False"/>
<field name="domain_force">['|', ('user_id', '=', user.id), ('message_partner_ids', '=', user.partner_id.id)]</field>
<field name="global" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
If you inactive above record rule then odoo will visible notes to all users.
Add followers inside note.
If you hide some notes for some users then you must not inactive record rule and just add followers.
This may help you.

Difference between "group" and "component" in QuickFIX/J

I am new to the FIX world. I am writing an application processing FIX messages in Java and for that I am using QuickFIX/J. I have downloaded the DataDictionary from the homepage (http://quickfixengine.org/). I am using the version 4.4.
In the XML-file exist groups and components. But a component can contain groups again.
What's the exact difference between them?
Components aren't really... things. They're like macros in the FIX DataDictionary (DD). Many messages need the same set of fields, so instead of specifying the same fields in every message, the DD defines a component that other messages can include.
A Group, on the other hand, is a very real thing. It's a repeating sequence of fields that will appear 0 or more times in a message.
QuickFIX's (QF) programming interface largely ignores components as a concept. You can't extract a component from a message because a component isn't a concept in QF; you just extract the fields like any other field.
A hypothetical example: The following two message definitions are exactly the same.
With a component
<message name="Automobile" msgtype="X" msgcat="app">
<field name="Wheel" required="Y"/>
<field name="Bumper" required="Y"/>
<component name="Dashboard" required="Y"/>
</message>
<component name="Dashboard">
<field name="Radio" required="Y"/>
<field name="AirConditioner" required="Y"/>
<field name="Heater" required="Y"/>
</component>
Without a component
<message name="Automobile" msgtype="X" msgcat="app">
<field name="Wheel" required="Y"/>
<field name="Bumper" required="Y"/>
<field name="Radio" required="Y"/>
<field name="AirConditioner" required="Y"/>
<field name="Heater" required="Y"/>
</message>
See? A component is pretty much just a macro.
Either way it's defined, you just end up calling msg.GetHeater() (or whatever).
From the FIXWiki for Components:
Component blocks are sets of related data fields grouped together and are referenced by the component block name in messages that they are used in. Sometimes they are referred to as "Groups".
Component blocks are practical to be defined, and then reused in different message types. Sometimes a repeating group is just for one particular message and then it is not defined as a Component block.
View a component block as a reusable definition of fields. Such a component block may or may not contain a repeating group of fields.
For instance take the Parties component block which is used in many different messages types (see "Used In" on that page). Easy to define once and use in many definitions of messages.
Just going to add some information since the accepted answer is missing this information (probably due to the fact that it is about five years old now).
In QuickFIX/J you are actually able to get and set components. So you can for example simply copy the Instrument component from one message to another.
#Test
public void testComponent() throws Exception {
final Instrument instrument = new Instrument();
instrument.set(new Symbol("DELL"));
instrument.set(new CountryOfIssue("USA"));
instrument.set(new SecurityType(SecurityType.COMMON_STOCK));
final quickfix.fix44.NewOrderSingle newOrderSingle = new quickfix.fix44.NewOrderSingle();
newOrderSingle.set(instrument);
final quickfix.fix44.ExecutionReport executionReport = new quickfix.fix44.ExecutionReport();
executionReport.setComponent(newOrderSingle.getInstrument());
System.out.println("NOS: " + newOrderSingle.toString().replace('\001', '|'));
System.out.println("ER: " + executionReport.toString().replace('\001', '|'));
}
Output:
NOS: 8=FIX.4.4|9=28|35=D|55=DELL|167=CS|470=USA|10=233|
ER: 8=FIX.4.4|9=28|35=8|55=DELL|167=CS|470=USA|10=221|
Maybe this is also possible in the other QuickFIX language variants.

Add user defined fields in the FIX dictionary

I need to add/modify fields in the FIX4.4 dictionary. I haven't found any helpful documentation or tutorials on this.
I'm guessing I have to modify the FIX44.xml file, but I'm not sure how exactly to do that.
In the <message></message> tags I don't see any attributes that define the number or the type(format) of that field. I see just the name and required attributes.
I think I found attributes I', looking for in the <fields></fields> tags.
I'm not sure if I'm looking in the right place or if I'm doing the right thing, but according to this I should modify the dictionary if it is necessary.
Please help.
A link to a tutorial for beginners that can help me would also be greatly appreciated.
The FIX Data Dictionary in QuickFIX contains Messages and Fields (among other things).
To add Messages you must add the message between the <messages></messages> tags like this:
<message name="CoolMessage" msgcat="app" msgtype="xCM">
<field name="Currency" required="N"/>
<field name="Text" required="N"/>
<field name="Account" required="Y"/>
</message>
And then add the new msgtype to the MsgType field in the <fields></fields> section like this:
<field number='35' name='MsgType' type='STRING'>
...
<value enum='xCM' description='COOLMESSAGE'/>
</field>
If you want to add new fields, just add them between the <fields></fields> tags like this:
<fields>
<field number="1" name="Account" type="STRING"/>
<field number="2" name="AdvId" type="STRING"/>
<field number="3" name="AdvRefID" type="STRING"/>
...
<field number="9006" name="AwesomeField" type="STRING"/>
</fields>
This and more information can be found in this tutorial.

FIX 4.2 and ExecReportAck

we have a counterparty that implement FIX 4.2 standard to send executionReport messages (35=8).
In their specifications, they need a message in order to check the correct transmission. The strange thing is that the message type is "BN", that's not in 4.2 specs.
I've implemented a method in order to send such kind of message, and all works fine, but the quickfix put this message into the errorlog.
There is a way to tell quickfix to exclude from errorlog these "BN" messages?
Try editing the DataDictionary. I would create a new file. And set the DataDictionary location to the new file in your quickfix config file.
In the XML file for the data dictionary add an additional Message Type that to match what your counter party is sending you.
In the Message Type field:
<field number="35" name="MsgType" type="STRING">
add a line something like this:
<value enum="BN" description="MESSAGE_TYPE_NAME" />
where MESSAGE_TYPE_NAME is the correct description
Then add a type
<message name="ExecutionReportAck" msgtype="BN" msgcat="app">
<field name="OrderID" required="Y"/>
<field name="SecondaryOrderID" required="N"/>
<field name="ClOrdID" required="N"/>
...
</message>