...
This commit is contained in:
@@ -132,6 +132,22 @@ object DatabaseFactory {
|
||||
AutoTradeTable.deleteWhere { AutoTradeTable.id eq id }
|
||||
}
|
||||
|
||||
fun findAllPendingBuyCodes(): Set<String> {
|
||||
return transaction {
|
||||
AutoTradeTable.select {
|
||||
(AutoTradeTable.status eq "PENDING_BUY") or (AutoTradeTable.status eq "ORDERED")
|
||||
}.map { it[AutoTradeTable.stockCode] }.toSet()
|
||||
}
|
||||
}
|
||||
|
||||
fun findAllMonitoringTrades(): List<AutoTradeItem> {
|
||||
return transaction {
|
||||
AutoTradeTable.select {
|
||||
AutoTradeTable.status neq "COMPLETED"
|
||||
}.map { mapToAutoTradeItem(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun mapToAutoTradeItem(it: ResultRow) = AutoTradeItem(
|
||||
id = it[AutoTradeTable.id],
|
||||
code = it[AutoTradeTable.stockCode],
|
||||
|
||||
Reference in New Issue
Block a user