Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ COPY . .
COPY --from=cpp-builder /build/Matching-Engine/build/libmatching_engine_c_api.so ./lib/

RUN CGO_ENABLED=1 go build -o /app/server ./cmd/server
RUN CGO_ENABLED=1 go build -o /app/mmbot ./cmd/mmbot

# Stage 3: Minimal runtime image
FROM alpine:3.21
Expand All @@ -35,6 +36,7 @@ RUN apk add --no-cache ca-certificates libstdc++ libgcc
WORKDIR /app

COPY --from=go-builder /app/server .
COPY --from=go-builder /app/mmbot .
COPY --from=cpp-builder /build/Matching-Engine/build/libmatching_engine_c_api.so /usr/local/lib/
COPY internal/db/migrations/ ./internal/db/migrations/

Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {
}
}
}

// 3. Initialize Auth & Email Services (needed for WebSocket Hub)
emailSvc := auth.NewEmailService(cfg.SMTPHost, cfg.SMTPPort, cfg.SMTPUser, cfg.SMTPPass)
authService := auth.NewService(db.Pool, cfg.JWTSecret, emailSvc)
Expand Down
26 changes: 13 additions & 13 deletions internal/market/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,17 @@ func (g *Generator) submitOrders(basePrice float64) {

// Occasionally submit a market order to simulate aggressive traders
// taking liquidity. This creates actual trades in the book.
if g.cfg.AggressiveRate > 0 && g.rng.Float64() < g.cfg.AggressiveRate {
side := engine.SideBuy
if g.rng.Float64() < 0.5 {
side = engine.SideSell
}
qty := g.cfg.MinQty + g.rng.Intn(g.cfg.MaxQty-g.cfg.MinQty+1)
orderID := int(g.nextOrderID.Add(1))

status, result := g.book.Market(orderID, side, qty)
if status == engine.StatusOK && len(result.Trades) > 0 && g.onTrade != nil {
g.onTrade(side, result)
}
}
// if g.cfg.AggressiveRate > 0 && g.rng.Float64() < g.cfg.AggressiveRate {
// side := engine.SideBuy
// if g.rng.Float64() < 0.5 {
// side = engine.SideSell
// }
// qty := g.cfg.MinQty + g.rng.Intn(g.cfg.MaxQty-g.cfg.MinQty+1)
// orderID := int(g.nextOrderID.Add(1))

// status, result := g.book.Market(orderID, side, qty)
// if status == engine.StatusOK && len(result.Trades) > 0 && g.onTrade != nil {
// g.onTrade(side, result)
// }
// }
}
Loading