Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

op_underfunded errors when increasing amounts for a bot that has hit capacity limits #40

Closed
nikhilsaraf opened this issue Oct 30, 2018 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@nikhilsaraf
Copy link
Contributor

Describe the bug

The bot is unable to increase the amounts on a market if it has already hit it's capacity limits

Expected behavior

I think the correct behavior in this situation is for the bot to handle this smoothly.

Frequency

The frequency is: Always (in the above scenario)

Steps To Reproduce

Here are the steps to reproduce the issue (see attachments in section below):

  1. Start the bot with the buysell strategy with an amount that will max out the lumens it is selling
  2. Update the configuration to further increase the amount (AMOUNT_OF_A_BASE)
  3. The bot will have op_underfunded errors in the transaction result

Possible Solution

This bug can be fixed by prepending modify offers that reduce it's outstanding liability -- we already do this when the bot deletes offers. Order of the update operations matter.

Your Environment

  version: v1.1.1-7-g880b1b1d
  git hash: 880b1b1d4f99b104587a1a12390bc35ccab03ade
  build date: 20181030T164726Z
  GOOS: linux
  GOARCH: amd64

Context

I am unable to adjust the bot's amounts as desired because of this bug.

Attachments

2018/10/30 09:48:45 Starting the trader bot...
2018/10/30 09:48:45 ----------------------------------------------------------------------------------------------------
2018/10/30 09:48:45  (base) assetA=native, maxA=14194.9999875, trustA=math.MaxFloat64
2018/10/30 09:48:45 (quote) assetB=TEST:GCFFRPDGJHMTMP5WAVEUSDIYNWCDUZTRE2QMLYVVPAYYFKZPMF4AMNTG, maxB=99998999.2296317, trustB=922337203685.4775391
2018/10/30 09:48:46 liabilities after resetting
2018/10/30 09:48:46 asset = {native  }, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/10/30 09:48:46 asset = {credit_alphanum4 TEST GCFFRPDGJHMTMP5WAVEUSDIYNWCDUZTRE2QMLYVVPAYYFKZPMF4AMNTG}, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/10/30 09:48:47 price from exchange feed (ccxt-binance/XLM/USDT): bidPrice=0.2244000, askPrice=0.2246000, centerPrice=0.2245000
2018/10/30 09:48:47 feedPair prices: feedA=1.0000000, feedB=0.2245000; centerPrice=4.4543430
2018/10/30 09:48:47 price from exchange feed (ccxt-binance/XLM/USDT): bidPrice=0.2244000, askPrice=0.2246000, centerPrice=0.2245000
2018/10/30 09:48:47 feedPair prices: feedA=0.2245000, feedB=1.0000000; centerPrice=0.2245000
2018/10/30 09:48:47 offer | buy  | level=1 | curPriceQuote=0.2244389 | curAmtBase=10000.0000000 | pruning=false
2018/10/30 09:48:47 offer | buy  | level=2 | curPriceQuote=0.2243828 | curAmtBase=10000.0000000 | pruning=false
2018/10/30 09:48:47 offer | buy  | level=3 | curPriceQuote=0.2243268 | curAmtBase=10000.0000001 | pruning=false
2018/10/30 09:48:47 offer | sell | level=1 | curPriceQuote=0.2245511 | curAmtBase=10000.0000000 | pruning=false
2018/10/30 09:48:47 offer | sell | level=2 | curPriceQuote=0.2246072 | curAmtBase=4170.4999871 | pruning=false
2018/10/30 09:48:47 created 0 operations to prune excess offers
2018/10/30 09:48:48 liabilities after resetting
2018/10/30 09:48:48 asset = {native  }, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/10/30 09:48:48 asset = {credit_alphanum4 TEST GCFFRPDGJHMTMP5WAVEUSDIYNWCDUZTRE2QMLYVVPAYYFKZPMF4AMNTG}, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/10/30 09:48:48 buy  | modify | level=1 | targetPriceQuote=0.2244439 | targetAmtBase=12000.0000000 | curPriceQuote=0.2244389 | lowPriceQuote=0.2244439 | highPriceQuote=0.2244439 | curAmtBase=10000.0000000 | minAmtBase=11400.2538191 | maxAmtBase=12600.2805369
2018/10/30 09:48:49 buy  | modify | level=2 | targetPriceQuote=0.2243878 | targetAmtBase=11999.9999999 | curPriceQuote=0.2243828 | lowPriceQuote=0.2243878 | highPriceQuote=0.2243878 | curAmtBase=10000.0000000 | minAmtBase=11400.2537556 | maxAmtBase=12600.2804667
2018/10/30 09:48:49 buy  | modify | level=3 | targetPriceQuote=0.2243318 | targetAmtBase=12000.0000000 | curPriceQuote=0.2243268 | lowPriceQuote=0.2243317 | highPriceQuote=0.2243318 | curAmtBase=10000.0000001 | minAmtBase=11400.2539481 | maxAmtBase=12600.2806794
2018/10/30 09:48:49 sell | modify | level=1 | targetPriceQuote=0.2245561 | targetAmtBase=12000.0000000 | curPriceQuote=0.2245511 | lowPriceQuote=0.2245561 | highPriceQuote=0.2245561 | curAmtBase=10000.0000000 | minAmtBase=11400.0000000 | maxAmtBase=12600.0000000
2018/10/30 09:48:49 sell | modify | level=2 | targetPriceQuote=0.2246123 | targetAmtBase=12000.0000000 | curPriceQuote=0.2246072 | lowPriceQuote=0.2246123 | highPriceQuote=0.2246123 | curAmtBase=4170.4999871 | minAmtBase=11400.0000000 | maxAmtBase=12600.0000000
2018/10/30 09:48:49 we will oversell the asset 'native', amountSelling = 12000.0000000, bal = 14194.9999875, minAccountBal = 24.0000000, liabilities.Selling = 12000.0000000
2018/10/30 09:48:49 computed remainder amount, constrained by selling capacity, returning sellingAmount=2170.9999875, buyingAmount=487.6333005
2018/10/30 09:48:49 sell | modify | level=2 | targetPriceQuote=0.2246123 | targetAmtBase=2170.9999875 | curPriceQuote=0.2246072 | lowPriceQuote=0.2246123 | highPriceQuote=0.2246123 | curAmtBase=4170.4999871 | minAmtBase=11400.0000000 | maxAmtBase=12600.0000000
2018/10/30 09:48:49 liabilities at the end of a call to UpdateWithOps
2018/10/30 09:48:49 asset = {native  }, buyingLiabilities=36000.0000000, sellingLiabilities=14170.9999875
2018/10/30 09:48:49 asset = {credit_alphanum4 TEST GCFFRPDGJHMTMP5WAVEUSDIYNWCDUZTRE2QMLYVVPAYYFKZPMF4AMNTG}, buyingLiabilities=3182.3065005, sellingLiabilities=8077.9613362
2018/10/30 09:48:49 created 5 operations to update existing offers
2018/10/30 09:48:49 reloading sequence number
2018/10/30 09:48:50 tx XDR: AAAAAIpYvGZJ2TY/tgVJSQ0YbYQ6ZnEmoMXitXgxgqsvYXgGAAAB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:48:53 (async) error: result code details: tx code = tx_failed , opcodes = [op_success op_success op_success op_underfunded op_success]
@nikhilsaraf nikhilsaraf self-assigned this Oct 30, 2018
@nikhilsaraf nikhilsaraf added the bug Something isn't working label Oct 30, 2018
@nikhilsaraf nikhilsaraf added this to the v1.1.2 milestone Oct 30, 2018
nikhilsaraf added a commit to nikhilsaraf/kelp that referenced this issue Oct 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant