feat: Add /scheduleorder command for recurring/auto-republishing orders
@ToRyVand is already working on this.
Since Jun 10, 2026.
- Dominant language
- TypeScript
- Stars
- 292
- Forks
- 136
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Description
## Problem
Active traders need to manually recreate their buy/sell orders every day. This is tedious and time-consuming, especially for users who consistently offer the same trading conditions.
## Proposed Solution
Add a `/scheduleorder` command that creates orders which automatically republish when they expire (not taken).
### Command Syntax
```
/scheduleorder [premium]
```
**Example:**
```
/scheduleorder sell 0 10 eur f2f 1
```
This creates a sell order for 10 EUR via face-to-face with 1% premium, which will auto-republish if not taken.
## Implementation Details
### 1. New Order Field
Add `republish_count` field to the Order model:
```typescript
republish_count: { type: Number, default: 0 }
```
### 2. New Environment Variable
```
REPUBLISH_ORDER_DAYS=10
```
Maximum number of days an order can be republished. Prevents abandoned orders from republishing forever.
### 3. Modify `jobs/delete_published_orders.js`
When processing expired orders:
```typescript
if (order.republish_count > 0) {
// Republish the order
order.republish_count -= 1;
order.status = "PENDING";
order.expires_at = new Date(Date.now() + EXPIRATION_TIME);
await order.save();
// Publish to channel
} else {
// Normal expiration flow
}
```
### 4. Reset Counter on Take
When an order is taken, reset `republish_count` to `REPUBLISH_ORDER_DAYS`:
```typescript
// In takeorder/takebuy/takesell handler
if (order.republish_count !== undefined) {
order.republish_count = parseInt(process.env.REPUBLISH_ORDER_DAYS || "10");
}
```
This ensures that after a successful trade, the order continues auto-republishing.
## User Flow
1. User creates: `/scheduleorder sell 0 100 usd bank 2`
2. Order is published with `republish_count = 10`
3. Order expires (not taken) → job republishes it, `republish_count = 9`
4. ... repeats ...
5. If `republish_count = 0` and expires → order is deleted normally
6. If order is taken at any point → `republish_count` resets to 10
## Edge Cases
- **User wants to stop auto-republish**: Add `/cancelschedule ` command to set `republish_count = 0`
- **Order in dispute**: Should NOT auto-republish (check status before republishing)
- **User changes trading conditions**: They cancel and create a new scheduled order
## Benefits
- Saves time for active traders
- Increases liquidity in channels (more consistent order availability)
- Self-cleaning: abandoned orders stop after N days
---
_Based on discussion #462_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.