如何使用QuickFix验证订单的值 [英] How do you validate values for an order using QuickFix
问题描述
我是quickfix的初学者,我不确定我遇到的问题是否很简单.我想使用诸如symbol
,price
,quantity
之类的quickfix来验证订单的值.quickfix是否在python中提供了一个函数来验证价格是否为PRICE
类型,并且其值是有效(例如:4.23)?
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)?
此处是参考: http://www.quickfixengine.org/FIX42.html# field_Price
推荐答案
正如DumbCoder在评论中所说,QuickFix不会验证消息的内容.例如,如果PRICE(FIX4.2标签44)字段定义为浮点类型,则它可以是 any 浮点值,可以是负数,零或正数.尽管有例外,但金融市场中的PRICE类型通常不是为负.
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.
因此,您可以根据要处理的消息类型来验证消息内容.对于简单的股票定单,填充消息(例如,您以123.45的价格购买了100股AAPL的股票)通常不会出现负价格值,但是由程序员自己决定是否要添加此上下文验证.
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.
这篇关于如何使用QuickFix验证订单的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!