简体   繁体   English

如何使用QuickFix验证订单的值

[英]How do you validate values for an order using QuickFix

I'm a beginner with quickfix and I'm not sure if the problem I'm having is trivial or not. 我是quickfix的初学者,我不确定我遇到的问题是否很简单。 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)? 我想使用symbolpricequantity等快速修复来验证订单的值。快速修复是否在python中提供了一个函数来验证价格是否为PRICE类型且其值是否有效(例如:4.23)?

Here is the reference: http://www.quickfixengine.org/FIX42.html#field_Price 这是参考: http : //www.quickfixengine.org/FIX42.html#field_Price

As DumbCoder says in the comment QuickFix does not validate the contents of a message. 正如DumbCoder在评论中所说,QuickFix不会验证消息的内容。 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(FIX4.2标签44)字段定义为浮点类型,则它可以是任何浮点值,可以是负,零或正。 PRICE types in financial markets are not usually negative although there are exceptions. 尽管有例外,但金融市场中的PRICE类型通常不是负数。

So it is up to you to validate the message contents for the type of message you are processing. 因此,您可以根据要处理的消息类型来验证消息内容。 A fill message (eg 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. 对于简单的股票定单,填充消息(例如,您以123.45的价格购买了100股AAPL的股票)通常不会具有负价格值,但是由程序员自己决定要添加此上下文验证。

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. 这是在指令中将两个单独的工具以原子方式交易在一起,可能会导致负价,从而使您收回资金获得合约头寸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM