Fix duplicate FIX orders and lowercase side field
Browse filesTwo bugs found:
1. FIX UI client was publishing orders to Kafka directly AND via FIX
protocol to OEG (which also publishes to Kafka) = duplicate orders.
Removed the direct Kafka publish from FIX UI client.
2. FIX OEG used "type": "buy"/"sell" instead of "side": "BUY"/"SELL",
inconsistent with the rest of the system.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- fix-ui-client/fix-ui-client.py +0 -13
- fix_oeg/fix_oeg_server.py +1 -1
fix-ui-client/fix-ui-client.py
CHANGED
|
@@ -11,7 +11,6 @@ from collections import deque
|
|
| 11 |
from threading import Lock
|
| 12 |
|
| 13 |
from shared.config import Config
|
| 14 |
-
from shared.kafka_utils import create_producer
|
| 15 |
|
| 16 |
app = Flask(__name__)
|
| 17 |
|
|
@@ -50,7 +49,6 @@ class FixUIClientApp(fix.Application):
|
|
| 50 |
super().__init__()
|
| 51 |
self.sessionID = None
|
| 52 |
self.connected = False
|
| 53 |
-
self.producer = create_producer(component_name="FIX-UI-Client")
|
| 54 |
|
| 55 |
def onCreate(self, sessionID): self.sessionID = sessionID
|
| 56 |
def onLogon(self, sessionID):
|
|
@@ -109,17 +107,6 @@ class FixUIClientApp(fix.Application):
|
|
| 109 |
|
| 110 |
fix.Session.sendToTarget(order, self.sessionID)
|
| 111 |
log(f"📤 Sent Order (ID={cl_ord_id}): {order.toString()}")
|
| 112 |
-
|
| 113 |
-
# 🔥 Publish to Kafka
|
| 114 |
-
self.producer.send(Config.ORDERS_TOPIC,
|
| 115 |
-
{
|
| 116 |
-
"id": cl_ord_id,
|
| 117 |
-
"symbol": symbol,
|
| 118 |
-
"side": "buy" if side == "1" else "sell",
|
| 119 |
-
"qty": qty,
|
| 120 |
-
"price": price,
|
| 121 |
-
"timestamp": time.time(),
|
| 122 |
-
})
|
| 123 |
|
| 124 |
return "Order sent!"
|
| 125 |
|
|
|
|
| 11 |
from threading import Lock
|
| 12 |
|
| 13 |
from shared.config import Config
|
|
|
|
| 14 |
|
| 15 |
app = Flask(__name__)
|
| 16 |
|
|
|
|
| 49 |
super().__init__()
|
| 50 |
self.sessionID = None
|
| 51 |
self.connected = False
|
|
|
|
| 52 |
|
| 53 |
def onCreate(self, sessionID): self.sessionID = sessionID
|
| 54 |
def onLogon(self, sessionID):
|
|
|
|
| 107 |
|
| 108 |
fix.Session.sendToTarget(order, self.sessionID)
|
| 109 |
log(f"📤 Sent Order (ID={cl_ord_id}): {order.toString()}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
return "Order sent!"
|
| 112 |
|
fix_oeg/fix_oeg_server.py
CHANGED
|
@@ -165,7 +165,7 @@ class Application(fix.Application):
|
|
| 165 |
"order_id": order_id,
|
| 166 |
"cl_ord_id": cl_ord_id,
|
| 167 |
"symbol": symbol,
|
| 168 |
-
"
|
| 169 |
"quantity": qty,
|
| 170 |
"price": price,
|
| 171 |
"timestamp": time.time(),
|
|
|
|
| 165 |
"order_id": order_id,
|
| 166 |
"cl_ord_id": cl_ord_id,
|
| 167 |
"symbol": symbol,
|
| 168 |
+
"side": "BUY" if str(side_val) == "1" else "SELL",
|
| 169 |
"quantity": qty,
|
| 170 |
"price": price,
|
| 171 |
"timestamp": time.time(),
|