Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions infrastructure/bicep/container-groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Container Instances are:

- hb-deuro-usdt: Hummingbot (dEURO/USDT)
- hb-jusd-usdt: Hummingbot (JUSD/BTC)
- hb-deps-usdt: Hummingbot (dEPS/USDT)
- rk: RangeKeeper Liquidity Bot

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

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

Start the Hummingbot within the container:
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/bicep/container-groups/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ API_NAME="api"
environmentOptions=("loc" "dev" "prd")

# "hb-deuro-usdt": Hummingbot (dEURO/USDT)
# "hb-jusd-usdt": Hummingbot (JuiceDollar/USDT)
# "hb-deps-usdt": Hummingbot (dEPS/USDT)
# "rk": RangeKeeper Liquidity Bot
instanceNameOptions=("hb-deuro-usdt" "hb-deps-usdt" "rk")
instanceNameOptions=("hb-deuro-usdt" "hb-jusd-usdt" "hb-deps-usdt" "rk")

# --- ARGUMENTS --- #
DOCKER_USERNAME=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"fileShareQuota": {
"value": 100
},
"containerImage": {
"value": "dfxswiss/hummingbot:beta"
},
"containerVolumeMounts": {
"value": [
{
"name": "volume",
"mountPath": "/mnt/hummingbot",
"readOnly": false
}
]
},
"containerCPU": {
"value": 0.5
},
"containerMemory": {
"value": 1
},
"containerEnv": {
"value": [
{
"name": "BOT_DIR",
"value": "jusd-usdt-dev"
},
{
"name": "STRATEGY_FILE",
"value": "jusd-usdt-conf_pure_mm.yml"
}
]
},
"containerCommand": {
"value": []
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"fileShareQuota": {
"value": 100
},
"containerImage": {
"value": "dfxswiss/hummingbot:latest"
},
"containerVolumeMounts": {
"value": [
{
"name": "volume",
"mountPath": "/mnt/hummingbot",
"readOnly": false
}
]
},
"containerCPU": {
"value": 0.5
},
"containerMemory": {
"value": 1
},
"containerEnv": {
"value": [
{
"name": "BOT_DIR",
"value": "jusd-usdt"
},
{
"name": "STRATEGY_FILE",
"value": "jusd-usdt-conf_pure_mm.yml"
}
]
},
"containerCommand": {
"value": []
}
}
}
73 changes: 73 additions & 0 deletions migration/1772500000000-RecalibrateScryptChfPairIds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* @typedef {import('typeorm').MigrationInterface} MigrationInterface
* @typedef {import('typeorm').QueryRunner} QueryRunner
*/

/**
* Recalibrate financeLogPairIds for toScrypt CHF.
*
* BankTx 190079 (19.02, 40k CHF) has no matching ExchangeTx deposit at Scrypt
* because it was manually added, shifting the 1:1 mapping. In unfiltered mode
* there are 23 senders (40k each) vs 22 receivers (40k each) → +40'000 CHF
* phantom pending on Yapeal/CHF (Asset 404).
*
* Fix: Set both IDs so the unfiltered window starts balanced
* (Sender = 1'370'000 CHF, Receiver = 1'370'000 CHF → toScrypt = 0).
*
* @class
* @implements {MigrationInterface}
*/
module.exports = class RecalibrateScryptChfPairIds1772500000000 {
name = 'RecalibrateScryptChfPairIds1772500000000';

/**
* @param {QueryRunner} queryRunner
*/
async up(queryRunner) {
console.log('=== Recalibrate financeLogPairIds toScrypt CHF ===\n');

const rows = await queryRunner.query(`SELECT id, value FROM dbo.setting WHERE [key] = 'financeLogPairIds'`);

if (rows.length === 0) {
console.log('ERROR: financeLogPairIds setting not found. Aborting.');
return;
}

const setting = rows[0];
const pairIds = JSON.parse(setting.value);

console.log('Current toScrypt.chf:', JSON.stringify(pairIds.toScrypt.chf));

pairIds.toScrypt.chf.bankTxId = 190080;
pairIds.toScrypt.chf.exchangeTxId = 123646;

console.log('New toScrypt.chf:', JSON.stringify(pairIds.toScrypt.chf));

const newValue = JSON.stringify(pairIds);

await queryRunner.query(`UPDATE dbo.setting SET value = '${newValue}' WHERE id = ${setting.id}`);

// Verify
const verify = await queryRunner.query(`SELECT value FROM dbo.setting WHERE id = ${setting.id}`);
const verified = JSON.parse(verify[0].value);
console.log('\nVerified toScrypt.chf:', JSON.stringify(verified.toScrypt.chf));
console.log('\n=== Migration Complete ===');
}

/**
* @param {QueryRunner} queryRunner
*/
async down(queryRunner) {
const rows = await queryRunner.query(`SELECT id, value FROM dbo.setting WHERE [key] = 'financeLogPairIds'`);

if (rows.length === 0) return;

const setting = rows[0];
const pairIds = JSON.parse(setting.value);

pairIds.toScrypt.chf.bankTxId = 186482;
pairIds.toScrypt.chf.exchangeTxId = 116514;

await queryRunner.query(`UPDATE dbo.setting SET value = '${JSON.stringify(pairIds)}' WHERE id = ${setting.id}`);
}
};
Loading