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

op_underfunded errors for non-XLM assets #63

Closed
nikhilsaraf opened this issue Nov 26, 2018 · 0 comments
Closed

op_underfunded errors for non-XLM assets #63

nikhilsaraf opened this issue Nov 26, 2018 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@nikhilsaraf
Copy link
Contributor

nikhilsaraf commented Nov 26, 2018

related to #40

Describe the bug

The bot is unable to submit transactions if it has hit capacity limits for non-XLM assets. This requires at least 2 levels in the strategy.

Expected behavior

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

Frequency

The frequency is: Sometimes (in the above scenario)

Steps To Reproduce

Here are the steps to reproduce the issue:

  1. The bot should be configured to place at least 2 levels.
  2. Use a price feed such as kraken so there is some variability in the asset price.
  3. Configure the bot with the buysell strategy for an amount that will more than max out the non-XLM asset it is selling after it successfully places the full first level.
  4. Start the bot.
  5. Very soon the bot will have op_underfunded errors in the transaction result for the first operation.

Possible Solution

The native XLM asset is configured to provide a operational buffer of 20 XLM which prevents this issue from being hit with the XLM asset. A similar buffer can be added for non-native assets.

Your Environment

  version: master:v1.1.1-28-gdb5615eb
  git branch: master
  git hash: db5615ebcf4be719c9e71a2c8778ca30eae2d289
  build date: 20181126T221437Z
  GOOS: linux
  GOARCH: amd64

Context

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

Attachments

2018/11/26 14:25:42 Starting the trader bot...
2018/11/26 14:25:42 ----------------------------------------------------------------------------------------------------
2018/11/26 14:25:42  (base) assetA=native, maxA=15653.0916464, trustA=math.MaxFloat64
2018/11/26 14:25:42 (quote) assetB=TEST:GCFFRPDGJHMTMP5WAVEUSDIYNWCDUZTRE2QMLYVVPAYYFKZPMF4AMNTG, maxB=740.9049244, trustB=922337203685.4775391
2018/11/26 14:25:42 liabilities after resetting
2018/11/26 14:25:42 asset=base  , balance=15653.0916464, trust=math.MaxFloat64, minAccountBal=23.5000000, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/11/26 14:25:42 asset=quote , balance=740.9049244, trust=922337203685.4775391, minAccountBal=0.0000000, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/11/26 14:25:43 price from exchange feed (ccxt-binance/XLM/USDT): bidPrice=0.1441200, askPrice=0.1448500, centerPrice=0.1444850
2018/11/26 14:25:43 feedPair prices: feedA=1.0000000, feedB=0.1444850; centerPrice=6.9211337
2018/11/26 14:25:44 price from exchange feed (ccxt-binance/XLM/USDT): bidPrice=0.1441400, askPrice=0.1448500, centerPrice=0.1444950
2018/11/26 14:25:44 feedPair prices: feedA=0.1444950, feedB=1.0000000; centerPrice=0.1444950
2018/11/26 14:25:44 offer | buy  | level=1 | curPriceQuote=0.1317045 | curAmtBase=0.1000003 | pruning=false
2018/11/26 14:25:44 offer | buy  | level=2 | curPriceQuote=0.1207292 | curAmtBase=6130.6714067 | pruning=false
2018/11/26 14:25:44 offer | sell | level=1 | curPriceQuote=0.1594175 | curAmtBase=0.0999997 | pruning=false
2018/11/26 14:25:44 offer | sell | level=2 | curPriceQuote=0.1739100 | curAmtBase=10000.0000000 | pruning=false
2018/11/26 14:25:44 created 0 operations to prune excess offers
2018/11/26 14:25:44 liabilities after resetting
2018/11/26 14:25:44 asset=base  , balance=15653.0916464, trust=math.MaxFloat64, minAccountBal=23.5000000, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/11/26 14:25:44 asset=quote , balance=740.9049244, trust=922337203685.4775391, minAccountBal=0.0000000, buyingLiabilities=0.0000000, sellingLiabilities=0.0000000
2018/11/26 14:25:44 buy  | modify | level=1 | targetPriceQuote=0.1313500 | targetAmtBase=0.1000000 | curPriceQuote=0.1317045 | lowPriceQuote=0.1313500 | highPriceQuote=0.1313500 | curAmtBase=0.1000003 | minAmtBase=0.0947443 | maxAmtBase=0.1047173
2018/11/26 14:25:44 buy  | modify | level=2 | targetPriceQuote=0.1204042 | targetAmtBase=10000.0000002 | curPriceQuote=0.1207292 | lowPriceQuote=0.1204042 | highPriceQuote=0.1204042 | curAmtBase=6130.6714067 | minAmtBase=9474.4262635 | maxAmtBase=10471.7342912
2018/11/26 14:25:44 we will oversell the asset 'TEST:GCFFRPDGJHMTMP5WAVEUSDIYNWCDUZTRE2QMLYVVPAYYFKZPMF4AMNTG', amountSelling = 1204.0416693, bal = 740.9049244, minAccountBal = 0.0000000, liabilities.Selling = 0.0131350
2018/11/26 14:25:44 computed remainder amount, constrained by selling capacity, returning sellingAmount=740.8917894, buyingAmount=6153.3733284
2018/11/26 14:25:44 buy  | modify | level=2 | targetPriceQuote=0.1204042 | targetAmtBase=6153.3733284 | curPriceQuote=0.1207292 | lowPriceQuote=0.1204042 | highPriceQuote=0.1204042 | curAmtBase=6130.6714067 | minAmtBase=9474.4262635 | maxAmtBase=10471.7342912
2018/11/26 14:25:44 sell | modify | level=1 | targetPriceQuote=0.1589445 | targetAmtBase=0.1000000 | curPriceQuote=0.1594175 | lowPriceQuote=0.1589445 | highPriceQuote=0.1589445 | curAmtBase=0.0999997 | minAmtBase=0.0950000 | maxAmtBase=0.1050000
2018/11/26 14:25:44 sell | modify | level=2 | targetPriceQuote=0.1733940 | targetAmtBase=10000.0000000 | curPriceQuote=0.1739100 | lowPriceQuote=0.1733940 | highPriceQuote=0.1733940 | curAmtBase=10000.0000000 | minAmtBase=9500.0000000 | maxAmtBase=10500.0000000
2018/11/26 14:25:44 liabilities at the end of a call to UpdateWithOps
2018/11/26 14:25:44 asset=base  , balance=15653.0916464, trust=math.MaxFloat64, minAccountBal=23.5000000, buyingLiabilities=6153.4733284, sellingLiabilities=10000.1000000
2018/11/26 14:25:44 asset=quote , balance=740.9049244, trust=922337203685.4775391, minAccountBal=0.0000000, buyingLiabilities=1733.9558944, sellingLiabilities=740.9049244
2018/11/26 14:25:44 created 4 operations to update existing offers
2018/11/26 14:25:44 reloading sequence number
2018/11/26 14:25:44 tx XDR: AAAAAIpYvGZJ2TY/tgVJSQ0YbYQ6ZnEmoMXitXgxgqsvYXgGAAABkAAAMKUAAAbsAAAAAAAAAAAAAAAEAAAAAQAAAAC+B05WMqwKNPp1zsO8wisjLSFafnHK96h/lpSKbpq9fgAAAAMAAAABVEVTVAAAAACKWLxmSdk2P7YFSUkNGG2EOmZxJqDF4rV4MYKrL2F4BgAAAAAAAAABuZsdhgE80wkAJiWgAAAAAAACB6oAAAABAAAAAL4HTlYyrAo0+nXOw7zCKyMtIVp+ccr3qH+WlIpumr1+AAAAAwAAAAFURVNUAAAAAIpYvGZJ2TY/tgVJSQ0YbYQ6ZnEmoMXitXgxgqsvYXgGAAAAAAAAAAAAAgEWAHQrPwAPQkAAAAAAAAIHyQAAAAEAAAAAvgdOVjKsCjT6dc7DvMIrIy0hWn5xyveof5aUim6avX4AAAADAAAAAAAAAAFURVNUAAAAAIpYvGZJ2TY/tgVJSQ0YbYQ6ZnEmoMXitXgxgqsvYXgGAAAAAAAPQkAABNnBAB6EgAAAAAAAAgeIAAAAAQAAAAC+B05WMqwKNPp1zsO8wisjLSFafnHK96h/lpSKbpq9fgAAAAMAAAAAAAAAAVRFU1QAAAAAili8ZknZNj+2BUlJDRhthDpmcSagxeK1eDGCqy9heAYAAAAXSHboAAABUqkAB6EgAAAAAAACA/4AAAAAAAAAAi9heAYAAABABEgxWWvPy/ugeRuxsDUldFMdwv+S2/YSPIef4lMtxzpjIp1k6inBY3nbn9JuwQ+dVBUOGOvVOPsV9ERAg83wBW6avX4AAABA6CHI0nICXxVYfiVzNHid7MbbF2ApejvtyWqVQLROGgfuCbDh710RyG9lFhHQmNW5nLWLId29ytFJJS3M0DGmBA==
2018/11/26 14:25:44 submitting tx XDR to network (async)
2018/11/26 14:25:50 (async) error: result code details: tx code = tx_failed , opcodes = [op_underfunded op_success op_success op_success]
@nikhilsaraf nikhilsaraf added the bug Something isn't working label Nov 26, 2018
@nikhilsaraf nikhilsaraf added this to the v1.2.0 milestone Nov 26, 2018
@nikhilsaraf nikhilsaraf self-assigned this Nov 26, 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