Skip to content

Commit 663828b

Browse files
authored
Merge pull request #3363 from DFXswiss/develop
2 parents 9758081 + df0fae3 commit 663828b

5 files changed

Lines changed: 161 additions & 1 deletion

File tree

infrastructure/bicep/container-groups/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Container Instances are:
1212

1313
- hb-deuro-usdt: Hummingbot (dEURO/USDT)
14+
- hb-jusd-usdt: Hummingbot (JUSD/BTC)
1415
- hb-deps-usdt: Hummingbot (dEPS/USDT)
1516
- rk: RangeKeeper Liquidity Bot
1617

@@ -30,6 +31,7 @@ There is an entrypoint script in the container to setup the individual environme
3031
Connect to the running container:
3132

3233
- az container exec --resource-group rg-dfx-api-dev --name ci-dfx-hb-deuro-usdt-dev --exec-command /bin/bash
34+
- az container exec --resource-group rg-dfx-api-dev --name ci-dfx-hb-jusd-usdt-dev --exec-command /bin/bash
3335
- az container exec --resource-group rg-dfx-api-dev --name ci-dfx-hb-deps-usdt-dev --exec-command /bin/bash
3436

3537
Start the Hummingbot within the container:

infrastructure/bicep/container-groups/deploy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ API_NAME="api"
99
environmentOptions=("loc" "dev" "prd")
1010

1111
# "hb-deuro-usdt": Hummingbot (dEURO/USDT)
12+
# "hb-jusd-usdt": Hummingbot (JuiceDollar/USDT)
1213
# "hb-deps-usdt": Hummingbot (dEPS/USDT)
1314
# "rk": RangeKeeper Liquidity Bot
14-
instanceNameOptions=("hb-deuro-usdt" "hb-deps-usdt" "rk")
15+
instanceNameOptions=("hb-deuro-usdt" "hb-jusd-usdt" "hb-deps-usdt" "rk")
1516

1617
# --- ARGUMENTS --- #
1718
DOCKER_USERNAME=
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"fileShareQuota": {
6+
"value": 100
7+
},
8+
"containerImage": {
9+
"value": "dfxswiss/hummingbot:beta"
10+
},
11+
"containerVolumeMounts": {
12+
"value": [
13+
{
14+
"name": "volume",
15+
"mountPath": "/mnt/hummingbot",
16+
"readOnly": false
17+
}
18+
]
19+
},
20+
"containerCPU": {
21+
"value": 0.5
22+
},
23+
"containerMemory": {
24+
"value": 1
25+
},
26+
"containerEnv": {
27+
"value": [
28+
{
29+
"name": "BOT_DIR",
30+
"value": "jusd-usdt-dev"
31+
},
32+
{
33+
"name": "STRATEGY_FILE",
34+
"value": "jusd-usdt-conf_pure_mm.yml"
35+
}
36+
]
37+
},
38+
"containerCommand": {
39+
"value": []
40+
}
41+
}
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"fileShareQuota": {
6+
"value": 100
7+
},
8+
"containerImage": {
9+
"value": "dfxswiss/hummingbot:latest"
10+
},
11+
"containerVolumeMounts": {
12+
"value": [
13+
{
14+
"name": "volume",
15+
"mountPath": "/mnt/hummingbot",
16+
"readOnly": false
17+
}
18+
]
19+
},
20+
"containerCPU": {
21+
"value": 0.5
22+
},
23+
"containerMemory": {
24+
"value": 1
25+
},
26+
"containerEnv": {
27+
"value": [
28+
{
29+
"name": "BOT_DIR",
30+
"value": "jusd-usdt"
31+
},
32+
{
33+
"name": "STRATEGY_FILE",
34+
"value": "jusd-usdt-conf_pure_mm.yml"
35+
}
36+
]
37+
},
38+
"containerCommand": {
39+
"value": []
40+
}
41+
}
42+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* @typedef {import('typeorm').MigrationInterface} MigrationInterface
3+
* @typedef {import('typeorm').QueryRunner} QueryRunner
4+
*/
5+
6+
/**
7+
* Recalibrate financeLogPairIds for toScrypt CHF.
8+
*
9+
* BankTx 190079 (19.02, 40k CHF) has no matching ExchangeTx deposit at Scrypt
10+
* because it was manually added, shifting the 1:1 mapping. In unfiltered mode
11+
* there are 23 senders (40k each) vs 22 receivers (40k each) → +40'000 CHF
12+
* phantom pending on Yapeal/CHF (Asset 404).
13+
*
14+
* Fix: Set both IDs so the unfiltered window starts balanced
15+
* (Sender = 1'370'000 CHF, Receiver = 1'370'000 CHF → toScrypt = 0).
16+
*
17+
* @class
18+
* @implements {MigrationInterface}
19+
*/
20+
module.exports = class RecalibrateScryptChfPairIds1772500000000 {
21+
name = 'RecalibrateScryptChfPairIds1772500000000';
22+
23+
/**
24+
* @param {QueryRunner} queryRunner
25+
*/
26+
async up(queryRunner) {
27+
console.log('=== Recalibrate financeLogPairIds toScrypt CHF ===\n');
28+
29+
const rows = await queryRunner.query(`SELECT id, value FROM dbo.setting WHERE [key] = 'financeLogPairIds'`);
30+
31+
if (rows.length === 0) {
32+
console.log('ERROR: financeLogPairIds setting not found. Aborting.');
33+
return;
34+
}
35+
36+
const setting = rows[0];
37+
const pairIds = JSON.parse(setting.value);
38+
39+
console.log('Current toScrypt.chf:', JSON.stringify(pairIds.toScrypt.chf));
40+
41+
pairIds.toScrypt.chf.bankTxId = 190080;
42+
pairIds.toScrypt.chf.exchangeTxId = 123646;
43+
44+
console.log('New toScrypt.chf:', JSON.stringify(pairIds.toScrypt.chf));
45+
46+
const newValue = JSON.stringify(pairIds);
47+
48+
await queryRunner.query(`UPDATE dbo.setting SET value = '${newValue}' WHERE id = ${setting.id}`);
49+
50+
// Verify
51+
const verify = await queryRunner.query(`SELECT value FROM dbo.setting WHERE id = ${setting.id}`);
52+
const verified = JSON.parse(verify[0].value);
53+
console.log('\nVerified toScrypt.chf:', JSON.stringify(verified.toScrypt.chf));
54+
console.log('\n=== Migration Complete ===');
55+
}
56+
57+
/**
58+
* @param {QueryRunner} queryRunner
59+
*/
60+
async down(queryRunner) {
61+
const rows = await queryRunner.query(`SELECT id, value FROM dbo.setting WHERE [key] = 'financeLogPairIds'`);
62+
63+
if (rows.length === 0) return;
64+
65+
const setting = rows[0];
66+
const pairIds = JSON.parse(setting.value);
67+
68+
pairIds.toScrypt.chf.bankTxId = 186482;
69+
pairIds.toScrypt.chf.exchangeTxId = 116514;
70+
71+
await queryRunner.query(`UPDATE dbo.setting SET value = '${JSON.stringify(pairIds)}' WHERE id = ${setting.id}`);
72+
}
73+
};

0 commit comments

Comments
 (0)