How do you validate values for an order using Quic

2019-09-07 06:16发布

问题:

I'm a beginner with quickfix and I'm not sure if the problem I'm having is trivial or not. I want to validate the values of an order using quickfix such as symbol, price, quantity, etc. Does quickfix provide a function in python that validates if a price is of type PRICE and that its value is valid (for example: 4.23)?

Here is the reference: http://www.quickfixengine.org/FIX42.html#field_Price

回答1:

As DumbCoder says in the comment QuickFix does not validate the contents of a message. If the PRICE (FIX4.2 tag 44) field is defined to be a float type for example, it can be any float value be it negative, zero or positive. PRICE types in financial markets are not usually negative although there are exceptions.

So it is up to you to validate the message contents for the type of message you are processing. A fill message (e.g. you bought 100 shares of AAPL for 123.45) for a simple stock order would generally never have a negative price value but it is left up to you the programmer to add this contextual validation.

As an example of an exception consider a fill message in a futures markets for a spread order. This in an instruction to trade two separate instruments together somewhat atomically and could result in a negative price so that you got money back and a position in a contract.