From c002907216929365cd026e37a68164fd46d674d1 Mon Sep 17 00:00:00 2001 From: Keeqler <33733651+Keeqler@users.noreply.github.com> Date: Tue, 18 Nov 2025 21:06:06 -0300 Subject: [PATCH] Fix wrong pair values being sent in kraken requests and missing SETTLEMENT_CURRENCY --- .github/workflows/deploy.yml | 1 + docker-compose.yml | 1 + src/autoconvert.py | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5210b6c..263ebf5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -45,5 +45,6 @@ jobs: BITCOIN_FEE_RATE="${{ secrets.BITCOIN_FEE_RATE }}" \ LITECOIN_FEE_SOURCE="${{ secrets.LITECOIN_FEE_SOURCE }}" \ LITECOIN_FEE_RATE="${{ secrets.LITECOIN_FEE_RATE }}" \ + SETTLEMENT_CURRENCY="${{ secrets.SETTLEMENT_CURRENCY }}" \ docker compose up -d --build EOF diff --git a/docker-compose.yml b/docker-compose.yml index c4f4daa..3587979 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -122,6 +122,7 @@ services: - TESTNET=${TESTNET} - KRAKEN_API_KEY=${KRAKEN_API_KEY} - KRAKEN_API_SECRET=${KRAKEN_API_SECRET} + - SETTLEMENT_CURRENCY=${SETTLEMENT_CURRENCY} command: python ./src/autoconvert.py depends_on: - seed-importer diff --git a/src/autoconvert.py b/src/autoconvert.py index 4d421bc..0e10986 100644 --- a/src/autoconvert.py +++ b/src/autoconvert.py @@ -15,7 +15,7 @@ def get_balance(kraken_ticker): def get_pair_details(quote_curency, base_currency, base_kraken_ticker): - response = util.kraken_request('/0/public/AssetPairs', {'pair': f'{quote_curency}{base_currency}'})[f'X{quote_curency}{base_kraken_ticker}'] + response = util.kraken_request('/0/public/AssetPairs', {'pair': f'{quote_curency}{base_currency}'})[f'{quote_curency}{base_kraken_ticker}'] order_min = float(response['ordermin']) trade_decimals = int(response['pair_decimals']) return order_min, trade_decimals @@ -29,7 +29,7 @@ def prepare_and_make_trade(balance, quote_currency, base_currency, base_kraken_t # We ensure we have more than the minimum to trade if balance > order_min: # We get the current orderbook to calculate the mid market price - orderbook = util.kraken_request('/0/public/Depth?count=1', {'pair': f'{quote_currency}{base_currency}'})[f'X{quote_currency}{base_kraken_ticker}'] + orderbook = util.kraken_request('/0/public/Depth?count=1', {'pair': f'{quote_currency}{base_currency}'})[f'{quote_currency}{base_kraken_ticker}'] # We make the trade mid_market_price = float(orderbook['bids'][0][0]) + ((float(orderbook['asks'][0][0]) - float(orderbook['bids'][0][0])) / 2) # Example 212.55+((212.72-212.55)/2) = 212.635 @@ -87,7 +87,7 @@ def attempt_sell(asset, settlement_currency, settlement_kraken_ticker): if __name__ == '__main__': if env.TESTNET == '1': - print('Testnet mode enabled. Autoconvert will now sleep forever.') + print('Testnet mode enabled. Autoconvert will now sleep forever. Zz Zz Zz...') time.sleep(999999999) while 1: