简体   繁体   English

QuickFIX-接收和发送来自不同算法的订单(源)

[英]QuickFIX - Receive and send orders from different algorithms (sources)

I built a FIX Initiator Application using the QuickFIX/J library to send orders to my broker. 我使用QuickFIX / J库构建了一个FIX启动器应用程序,以将订单发送给我的经纪人。 If you don't know what is a FIX Application, consider that my program is an application that sends message to a server through TCP connection. 如果您不知道什么是FIX应用程序,请考虑我的程序是一个通过TCP连接将消息发送到服务器的应用程序。

To get and send the orders created by multiple algorithms I have a Directory Watcher (WatchService) that watches for modifications on a local directory that is synchronized with a S3 bucket using AWS Cli. 为了获取和发送由多种算法创建的订单,我有一个目录监视程序(WatchService),该监视程序监视使用AWS Cli与S3存储桶同步的本地目录上的修改。

This approach works well, except for the fact that I have to wait about 6-8 seconds before the file is on my local directory, so I can parse it to fix orders and send to broker's FIX app. 这种方法效果很好,除了我必须等待大约6-8秒才能将文件放在本地目录上之外,这样我才能解析该文件以修复订单并将其发送到经纪人的FIX应用程序。 I really would like to decrease this delay between the order creation and the moment when it is send to the broker. 我真的很想减少订单创建和发送给经纪人之间的这种延迟。

What are the possible solutions that I'd tought: 我想提出的可能解决方案有哪些:

1) Reading directly from S3 bucket without using AWS CLI 1) 在不使用AWS CLI的情况下直接从S3存储桶读取

2) Opening different FIX sessions for each different algorithm 2) 为每种不同的算法打开不同的FIX会话

3) Instead of reading from a bucket, peaking a database (MySQL) for new orders. 3) 无需从存储桶中读取数据,而是将数据库(MySQL)的峰值提高到新订单。 The algos would generate table rows instead of files 该算法将生成表行而不是文件

4) Having an API between my FIX application and the algorithms, so the algos can connect directly with my application. 4) 在我的FIX应用程序和算法之间有一个API,因此算法可以直接与我的应用程序连接。

Solution (1) didn't improved the order receiving time because it takes about the same time to list S3 objects, get summary and filter the desired file. 解决方案(1)并没有改善订单接收时间,因为列出S3对象,获取摘要和过滤所需文件大约需要相同的时间。

Solution (2) I didn't tried, but I think it is not the best one. 解决方案(2)我没有尝试过,但我认为这不是最好的方法。 If I have, for example, 100 different strategies I would have to open 100 different connections and I am not sure if my broker app can handle. 例如,如果我有100种不同的策略,我将不得不打开100种不同的连接,而且我不确定我的经纪人应用程序是否可以处理。 But I may be wrong. 但是我可能是错的。

Solution (3) I also didn't tried. 解决方案(3)我也没有尝试。

Solution (4) is what I believe that is ideal, but I don't know how to implement. 我认为解决方案(4)是理想的,但我不知道如何实现。 I tried to create an REST API, but I don't know if it is conceptually correct. 我试图创建一个REST API,但是我不知道它在概念上是否正确。 Supposing that my FIX application is currently connected to the broker's server, my idea was to (i) create a new webapp to create a REST API (ii) receive order info through a API, (iii) find the current alive session and (iv) send order to broker server using the current session. 假设我的FIX应用程序当前已连接到代理的服务器,我的想法是(i)创建一个新的Web应用程序以创建REST API(ii)通过API接收订单信息,(iii)查找当前的活动会话,以及(iv )使用当前会话将订单发送到代理服务器。 Unfortunately, I was not able to find the current session by ID using the following on a different of the class that is running the FIX application: 不幸的是,在不同的运行FIX应用程序的类上,我无法使用以下代码通过ID查找当前会话:

SessionID sessionID = new SessionID("FIX.4.4", "CLIENT1", "FixServer");
    Session session = Session.lookupSession(sessionID);

What I would like to hear from you: 我想听听您的意见:

  • What do you think that is the best solution to send FIX orders created by multiple sources? 您认为发送由多个来源创建的FIX订单的最佳解决方案是什么?

    • If I want to create an API to connect 2 different applications, what are the steps that I can follow? 如果我想创建一个连接两个不同应用程序的API,可以遵循哪些步骤?

I am sorry if I was a bit confuse. 很抱歉,如果我有点困惑。 Let me know if you need further clarification. 让我知道您是否需要进一步说明。

Thank you 谢谢

Q : What do you think that is the best solution to send FIX orders created by multiple sources? 您认为发送多个来源创建的FIX订单的最佳解决方案是什么?

Definitely the 4) -ie- consolidate your multiple sources of decisions and interface the Broker-side FIX Protocol Gateway from a single point. 绝对是4)-即-合并您的多个决策源,并从单一角度连接Broker-side FIX协议网关。

Reasons: 原因:
- isolation of concerns in design/implementation/operations -隔离设计/实施/操作中的问题
- single point of authentication/latency-motivated colocation for FIX Protocol channel -FIX协议通道的单点身份验证/等待时间共置
- minimised costs of FIX Protocol Gateway acceptance-testing (without this Tier-1 market participants will not let you run business with, so expenses on FIX Protocol E2E-mutual-cooperation compliance-testing do matter - both costs-wise and time-wise ) -最小化FIX协议网关验收测试的成本(没有这个1级市场参与者将不允许您开展业务,因此FIX协议E2E相互合作合规性测试的费用很重要-无论是在成本方面还是在时间方面)

Q : what are the steps that I can follow? 我可以遵循哪些步骤?

Follow you own use-case, that defines all the MVP-features that need to be ready for going into testing. 遵循您自己的用例,该用例定义了需要准备好进行测试的所有MVP功能。

Do not try to generalise your needs into any "new-Next-Gen-API", your trading is all about latency+trading, so rather specialise on the MVP-definition and do not design/implement anything beyond an MVP with minimum latency (overhead) on a point to point basis. 不要尝试将您的需求概括为任何“新的下一代API”,您的交易全都是关于延迟+交易的,所以请专注于MVP定义,不要以最小的延迟设计/实现MVP以外的任何东西(点对点)。 Using stable professional frameworks, like nanomsg or ZeroMQ , may avoid spending a bit of time on reinventing any already invented wheels for low-latency trading messaging/signaling tools. 使用稳定的专业框架(例如nanomsgZeroMQ )可以避免花一些时间重新发明任何已经发明的用于低延迟交易消息/信号传递工具的工具。 Using REST is rather an anti-pattern in the 3rd millenium low-latency motivated high performance distributed computing eco-system for trading. 在第3千年低延迟动机的高性能分布式计算生态系统中,使用REST是一种反模式。

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

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