Skip to content

Commit 2ab9459

Browse files
authored
Revert twap trade beyond end (#213)
* revert stopping twap algo in case of trade beyond end * fix test
1 parent 9856968 commit 2ab9459

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/twap/events/self_interval_tick.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ const onSelfIntervalTick = async (instance = {}, origin) => {
6565
(amount > 0 && (currentSumAmount > amount)) ||
6666
(amount < 0 && (currentSumAmount < amount))
6767
) {
68-
tickSignal.meta.currentSumAmount = currentSumAmount
6968
debug('next tick would exceed total order amount, refusing')
70-
return emit('exec:stop', null, { origin: tickSignal })
69+
return
7170
}
7271
}
7372

test/lib/host/init_ao_state.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ describe('host:init_ao_state', () => {
4646
})
4747

4848
it('provides necessary default data', () => {
49-
const state = initAOState({ name: 'test', id: 'some-id' }, 42)
50-
49+
const state = initAOState({ name: 'test', id: 'some-id' }, { arg1: 42 })
5150
assert.ok(_isArray(state.channels) && _isEmpty(state.channels))
5251
assert.ok(_isObject(state.orders) && _isEmpty(state.orders))
5352
assert.ok(_isObject(state.cancelledOrders) && _isEmpty(state.cancelledOrders))
5453
assert.ok(_isObject(state.allOrders) && _isEmpty(state.allOrders))
5554
assert.ok(state.ev instanceof AsyncEventEmitter)
5655
assert.ok(_isString(state.label) && !_isEmpty(state.name))
57-
assert.strictEqual(state.args, 42)
56+
assert.deepStrictEqual(state.args, { arg1: 42, meta: { algoOrderId: 'some-id' } })
5857
assert.strictEqual(state.id, 'some-id')
5958
})
6059
})

0 commit comments

Comments
 (0)