Skip to content

Commit

Permalink
Revert "change timeMatched in matching engine to match exberry"
Browse files Browse the repository at this point in the history
This reverts commit b7df781.
  • Loading branch information
alexgraham-da committed May 19, 2021
1 parent b7df781 commit 86905ef
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions triggers/daml/MatchingEngine.daml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module MatchingEngine where
import DA.Finance.Types

import DA.Action
import DA.Date
import DA.Time
import DA.Foldable hiding (elem, null)
import DA.Next.Set (fromList)
import DA.List
Expand All @@ -20,9 +18,6 @@ import Utils

type CurrentOrderId = Int

getUnixTimestamp : TriggerA CurrentOrderId Int
getUnixTimestamp = convertRelTimeToMicroseconds . (flip subTime) (time (date 1970 Jan 1) 0 0 0) <$> getTime

handleMatching : Trigger CurrentOrderId
handleMatching = Trigger
{ initialize = return 0
Expand Down Expand Up @@ -130,19 +125,19 @@ handleOrder party orders (orderCid, order) = do
let fillQty = min passive.qty aggressive.qty
fillPrice = passive.price

nanoTimestamp <- (* 1000) <$> getUnixTimestamp
time <- getTime

emitExerciseCmd aggressiveCid Order_Fill with
fillQty, fillPrice
counterOrderId = passive.orderId
counterParty = passive.exchParticipant
timeMatched = show nanoTimestamp
timeMatched = show time

emitExerciseCmd passiveCid Order_Fill with
fillQty, fillPrice
counterOrderId = aggressive.orderId
counterParty = aggressive.exchParticipant
timeMatched = show nanoTimestamp
timeMatched = show time

return ()

Expand Down Expand Up @@ -197,7 +192,7 @@ handleClearedOrder party orders (orderCid, order) = do
let fillQty = min passive.qty aggressive.qty
fillPrice = passive.price

nanoTimestamp <- (* 1000) <$> getUnixTimestamp
time <- getTime

emitExerciseCmd aggressiveCid ClearedOrder_Fill with
fillQty, fillPrice
Expand All @@ -215,7 +210,7 @@ handleClearedOrder party orders (orderCid, order) = do
instrument = instrumentId
exchange = party
eventId = -1
timeMatched = show nanoTimestamp
timeMatched = (show time)
pair = order.pair
trackingNumber = -1
buyer = buyer.exchParticipant
Expand Down

0 comments on commit 86905ef

Please sign in to comment.