Skip to content

Commit

Permalink
add alias field (#213)
Browse files Browse the repository at this point in the history
* add alias field

* update package dependency

* fix linting issue

* fix broken test cases

* update versions

Co-authored-by: Tarcísio Ferraz <[email protected]>
  • Loading branch information
iamarifdev and tferraz-bitfinex authored Dec 8, 2022
1 parent 456991b commit 004ad4b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 5 additions & 3 deletions lib/ws_servers/api/algos/algo_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,14 @@ class AlgoWorker {
const [serialized, uiData] = await ao

const { id, name, label, args, gid, i18n, createdAt } = uiData
d('ao started: %s %s', name, label)
const alias = uiData.alias || name

d('ao started: %s %s', alias, label)

await this._updateAlgo(serialized)

this.sendSuccess(`Started AO ${name} on Bitfinex`, ['startedAO', { name, target: 'Bitfinex' }])
this.pub(['data.ao', 'bitfinex', mode, { id, gid, name, label, args, i18n, createdAt }])
this.sendSuccess(`Started AO ${alias} on Bitfinex`, ['startedAO', { alias, name, target: 'Bitfinex' }])
this.pub(['data.ao', 'bitfinex', mode, { id, gid, alias, name, label, args, i18n, createdAt }])
return gid
} catch (e) {
d('error starting AO %s: %s for %s: %s', aoID, e, this.userId, e.stack)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-hf-server",
"version": "8.1.0",
"version": "8.2.0",
"description": "HF server bundle",
"author": "Bitfinex",
"license": "Apache-2.0",
Expand All @@ -22,7 +22,7 @@
"bfx-api-node-core": "git+https://github.com/bitfinexcom/bfx-api-node-core.git#v1.6.1",
"bfx-api-node-plugin-wd": "^1.0.4",
"bfx-api-node-rest": "^4.3.1",
"bfx-hf-algo": "git+https://github.com/bitfinexcom/bfx-hf-algo.git#v4.14.2",
"bfx-hf-algo": "git+https://github.com/bitfinexcom/bfx-hf-algo.git#v4.15.0",
"bfx-hf-ext-plugin-dummy": "github:bitfinexcom/bfx-hf-ext-plugin-dummy#v1.0.4",
"bfx-hf-indicators": "git+https://github.com/bitfinexcom/bfx-hf-indicators.git#v2.1.1",
"bfx-hf-models": "git+https://github.com/bitfinexcom/bfx-hf-models.git#v4.0.0",
Expand Down
9 changes: 5 additions & 4 deletions test/unit/lib/ws_servers/api/algos/algo_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ describe('AlgoWorker', () => {
const createdAt = 1633936704466
const serialized = { gid }
const uiData = {
alias: 'alias',
name: 'name',
label: 'label',
args: {},
Expand Down Expand Up @@ -248,8 +249,8 @@ describe('AlgoWorker', () => {
assert.calledWithExactly(WsStub.firstCall, [
'notify',
'success',
'Started AO name on Bitfinex',
{ key: 'startedAO', props: { name: 'name', target: 'Bitfinex' } }
`Started AO ${uiData.alias} on Bitfinex`,
{ key: 'startedAO', props: { alias: uiData.alias, name: 'name', target: 'Bitfinex' } }
])
assert.calledWithExactly(WsStub.secondCall, ['data.ao', 'bitfinex', mode, { ...uiData }])
expect(returnedGid).to.eq(gid)
Expand All @@ -276,8 +277,8 @@ describe('AlgoWorker', () => {
assert.calledWithExactly(WsStub.firstCall, [
'notify',
'success',
'Started AO name on Bitfinex',
{ key: 'startedAO', props: { name: 'name', target: 'Bitfinex' } }
`Started AO ${uiData.alias} on Bitfinex`,
{ key: 'startedAO', props: { alias: uiData.alias, name: 'name', target: 'Bitfinex' } }
])
assert.calledWithExactly(WsStub.secondCall, ['data.ao', 'bitfinex', mode, { ...uiData }])
expect(returnedGid).to.eq(gid)
Expand Down

0 comments on commit 004ad4b

Please sign in to comment.