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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class PostgresConfig(db: DatabaseClient) {
accumulative_quote_qty decimal,
status integer,
create_date TIMESTAMP,
update_date TIMESTAMP
update_date TIMESTAMP,
version numeric
);
CREATE TABLE IF NOT EXISTS trades (
id SERIAL PRIMARY KEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class OrderPersisterImpl(val orderRepository: OrderRepository) : OrderPersister
existingOrder.accumulativeQuoteQty,
existingOrder.status,
existingOrder.createDate ?: LocalDateTime.now(),
existingOrder.updateDate
existingOrder.updateDate,
existingOrder.version
)
).awaitFirstOrNull()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class TradePersisterImpl(val tradeRepository: TradeRepository, val orderReposito
OrderStatus.PARTIALLY_FILLED.code
},
existingOrder?.createDate,
LocalDateTime.now()
LocalDateTime.now(),
existingOrder?.version
)
).awaitFirstOrNull()
}
Expand Down Expand Up @@ -140,7 +141,8 @@ class TradePersisterImpl(val tradeRepository: TradeRepository, val orderReposito
OrderStatus.PARTIALLY_FILLED.code
},
existingOrder?.createDate ?: LocalDateTime.now(),
LocalDateTime.now()
LocalDateTime.now(),
existingOrder?.version
)
).awaitFirstOrNull()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import co.nilin.opex.matching.core.model.MatchConstraint
import co.nilin.opex.matching.core.model.OrderDirection
import co.nilin.opex.matching.core.model.OrderType
import org.springframework.data.annotation.Id
import org.springframework.data.annotation.Version
import org.springframework.data.relational.core.mapping.Column
import org.springframework.data.relational.core.mapping.Table
import java.time.LocalDateTime
Expand Down Expand Up @@ -34,5 +35,8 @@ class OrderModel(
@Column("accumulative_quote_qty") val accumulativeQuoteQty: Double?,
@Column("status") val status: Int?,
@Column("create_date") val createDate: LocalDateTime?,
@Column("update_date") val updateDate: LocalDateTime
@Column("update_date") val updateDate: LocalDateTime,
@Version
@Column("version")
var version: Long? = null
)