价格/时间优先算法如何工作?

时间:2018-06-21 17:38:43

标签: algorithm finance

我正在尝试编写一个简单的FIFO(价格/时间优先)订单匹配程序,但是我不太确定我是否有正确的逻辑:

for each unfilled buy order (newest first):
    filter orders by buy price > sell price
    while buy order not filled:
        fill best priced sell order
        if multiple equal cheapest sell orders:
            fill oldest
    if remainder of most recently filled sell order is not 0:
        create new sell order for remainder

我已经分别模拟了500个买入和卖出订单,但是说实话,没有参考来检查它是否正确匹配了订单-尝试手动进行交易将非常耗时消耗。有人可以确认我做对了吗?

0 个答案:

没有答案