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

Implement buy twap strategy (closes #522) #537

Closed
wants to merge 7 commits into from

Conversation

debnil
Copy link
Contributor

@debnil debnil commented Oct 16, 2020

This PR implements the buy twap strategy and closes #522.

@debnil
Copy link
Contributor Author

debnil commented Oct 16, 2020

Implementation questions:

  1. What database config do I need to avoid this issue?
cannot make 'sell_twap' strategy: makeFn failed: error when making dowFilter: unable to make filter for entry Sunday: could not make daily volume by date Query: the provided db should be non-nil
  1. Do we need to implement a buyTwapLevelProvider? Or can we just reuse sellTwapLevelProvider?

Let me know if there are any other changes I should make.

Copy link
Contributor

@nikhilsaraf nikhilsaraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@debnil Will dig into this in more detail later today.

This also needs the walkthrough guide for buy Twap like we have for the others. Can you copy from sell twap and make necessary modifications? (Mostly replacing sell with buy) — feel free to do as a separate commit if you want

@debnil
Copy link
Contributor Author

debnil commented Oct 16, 2020

Thanks! And sounds good, will do that in the morning.

Copy link
Contributor

@nikhilsaraf nikhilsaraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments inline. pending files besides that:

  • add sample_buytwap.cfg
  • add buy_twap.md
  • upload log file of output run as described in the issue

for both the above you'll just need to copy paste from the sell version and replace sell with buy everywhere in the files. you may need to force add the cfg file to be committed with git, not sure.

plugins/buyTwapStrategy.go Show resolved Hide resolved
sdex,
orderConstraints,
ieif,
assetQuote,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the parameters passed in are already correct.

can you add a comment above the buySideStrategy variable:
// switch sides of base/quote here for buy side

levelProvider,
config.PriceTolerance,
config.AmountTolerance,
false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking we would need to set this to true because it's a buy side level provider, but I could be wrong.

Was the pricing correct for you when you ran this strategy on testnet? If so then maybe it's correct to keep this as false for this specific strategy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't run this yet because of the database config issue, but looking at the definitions, I think you're correct. Will confirm post-successful run.

config.AmountTolerance,
false,
)
// switch side of base/quote here for the delete side
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be deleteSideStrategy := makeDeleteSideStrategy(sdex, assetBase, assetQuote)
and we don't need the comment of switch sides.. on here.
instead we can add a comment saying

// use assetBase as param to assetBase argument since the delete strategy is
// on the sell side so the params should line up correctly with the arguments

plugins/buyTwapStrategy.go Show resolved Hide resolved
plugins/factory.go Show resolved Hide resolved
@nikhilsaraf
Copy link
Contributor

@debnil I've fixed the config file issue so when you merge the master branch it should work without any config issues

@debnil
Copy link
Contributor Author

debnil commented Oct 19, 2020

@nikhilsaraf I've made the requested changes and added the files. Run log is below. I'm not totally certain how to check if this has the desired price levels or behavior. I'll add the run log for sell_twap in a subsequent comment.

2020/10/19 10:38:09 Starting Kelp Trader: debnil/buytwap:nightly-33ab2afe-77-g48e59fa4-dirty [48e59fa4c91ddf083fba4838b273f0b2f0021e25-dirty]
2020/10/19 10:38:09 will run unbounded iterations
2020/10/19 10:38:09 configs:
2020/10/19 10:38:09      SOURCE_SECRET_SEED: [secret key to account GBHXGGUD3LIAWJHFO7737C4TFNDDDLZ74C6VBEPF5H53XNRCVIUWZA5I]
2020/10/19 10:38:09      TRADING_SECRET_SEED: [secret key to account GCB7WIQ3TILJLPOT4E7YMOYF6A5TKYRWK3ZHJ5UR6UKD7D7NJVWNWIQV]
2020/10/19 10:38:09      ASSET_CODE_A: XLM
2020/10/19 10:38:09      ISSUER_A: 
2020/10/19 10:38:09      ASSET_CODE_B: COUPON
2020/10/19 10:38:09      ISSUER_B: GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI
2020/10/19 10:38:09      TICK_INTERVAL_SECONDS: 300
2020/10/19 10:38:09      MAX_TICK_DELAY_MILLIS: 0
2020/10/19 10:38:09      DELETE_CYCLES_THRESHOLD: 0
2020/10/19 10:38:09      SUBMIT_MODE: both
2020/10/19 10:38:09      FILL_TRACKER_SLEEP_MILLIS: 150000
2020/10/19 10:38:09      FILL_TRACKER_DELETE_CYCLES_THRESHOLD: 0
2020/10/19 10:38:09      SYNCHRONIZE_STATE_LOAD_ENABLE: false
2020/10/19 10:38:09      SYNCHRONIZE_STATE_LOAD_MAX_RETRIES: 0
2020/10/19 10:38:09      FILL_TRACKER_LAST_TRADE_CURSOR_OVERRIDE: 
2020/10/19 10:38:09      HORIZON_URL: https://horizon-testnet.stellar.org
2020/10/19 10:38:09      CCXT_REST_URL: <nil>
2020/10/19 10:38:09      DOLLAR_VALUE_FEED_BASE_ASSET: 
2020/10/19 10:38:09      DOLLAR_VALUE_FEED_QUOTE_ASSET: 
2020/10/19 10:38:09      FEE: 
2020/10/19 10:38:09          CAPACITY_TRIGGER: 0.8
2020/10/19 10:38:09          PERCENTILE: 90
2020/10/19 10:38:09          MAX_OP_FEE_STROOPS: 5000
2020/10/19 10:38:09      CENTRALIZED_PRICE_PRECISION_OVERRIDE: <nil>
2020/10/19 10:38:09      CENTRALIZED_VOLUME_PRECISION_OVERRIDE: <nil>
2020/10/19 10:38:09      CENTRALIZED_MIN_BASE_VOLUME_OVERRIDE: <nil>
2020/10/19 10:38:09      CENTRALIZED_MIN_QUOTE_VOLUME_OVERRIDE: <nil>
2020/10/19 10:38:09      POSTGRES_DB: 
2020/10/19 10:38:09          HOST: localhost
2020/10/19 10:38:09          PORT: 5432
2020/10/19 10:38:09          DB_NAME: kelp
2020/10/19 10:38:09          USER: postgres
2020/10/19 10:38:09          PASSWORD: 
2020/10/19 10:38:09          SSL_ENABLE: false
2020/10/19 10:38:09      DB_OVERRIDE__ACCOUNT_ID: account1
2020/10/19 10:38:09      FILTERS: []
2020/10/19 10:38:09      ALERT_TYPE: 
2020/10/19 10:38:09      ALERT_API_KEY: 
2020/10/19 10:38:09      MONITORING_PORT: 0
2020/10/19 10:38:09      MONITORING_TLS_CERT: 
2020/10/19 10:38:09      MONITORING_TLS_KEY: 
2020/10/19 10:38:09      GOOGLE_CLIENT_ID: 
2020/10/19 10:38:09      GOOGLE_CLIENT_SECRET: 
2020/10/19 10:38:09      ACCEPTABLE_GOOGLE_EMAILS: 
2020/10/19 10:38:09      TRADING_EXCHANGE: 
2020/10/19 10:38:09      EXCHANGE_API_KEYS: 
2020/10/19 10:38:09      EXCHANGE_PARAMS: 
2020/10/19 10:38:09      EXCHANGE_HEADERS: 
2020/10/19 10:38:09 Trading XLM: for COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI
2020/10/19 10:38:10 metric - successfully sent event metric of type 'ce:startup'
2020/10/19 10:38:10 using CCXT-rest URL: http://localhost:3000
2020/10/19 10:38:10 did not create db 'kelp' because it already exists
2020/10/19 10:38:10 creating db schema and running upgrade scripts ...
2020/10/19 10:38:10 fetched dbVersion from db: 6
2020/10/19 10:38:10    skipping upgrade script for version 1 because current db version (6) is equal or ahead
2020/10/19 10:38:10 fetched dbVersion from db: 6
2020/10/19 10:38:10    skipping upgrade script for version 2 because current db version (6) is equal or ahead
2020/10/19 10:38:10 fetched dbVersion from db: 6
2020/10/19 10:38:10    skipping upgrade script for version 3 because current db version (6) is equal or ahead
2020/10/19 10:38:10 fetched dbVersion from db: 6
2020/10/19 10:38:10    skipping upgrade script for version 4 because current db version (6) is equal or ahead
2020/10/19 10:38:10 fetched dbVersion from db: 6
2020/10/19 10:38:10    skipping upgrade script for version 5 because current db version (6) is equal or ahead
2020/10/19 10:38:10 fetched dbVersion from db: 6
2020/10/19 10:38:10    skipping upgrade script for version 6 because current db version (6) is equal or ahead
2020/10/19 10:38:10 ... finished creating db schema and running upgrade scripts
2020/10/19 10:38:10 made db instance with config: host=localhost port=5432 sslmode=disable user=postgres dbname=kelp
2020/10/19 10:38:10 Using network passphrase: Test SDF Network ; September 2015
2020/10/19 10:38:10 Making strategy: buy_twap
2020/10/19 10:38:10 configs:
2020/10/19 10:38:10      START_ASK_FEED_TYPE: exchange
2020/10/19 10:38:10      START_ASK_FEED_URL: kraken/XXLM/ZUSD/mid
2020/10/19 10:38:10      PRICE_TOLERANCE: 0.001
2020/10/19 10:38:10      AMOUNT_TOLERANCE: 0.001
2020/10/19 10:38:10      RATE_OFFSET_PERCENT: 0
2020/10/19 10:38:10      RATE_OFFSET: 0
2020/10/19 10:38:10      RATE_OFFSET_PERCENT_FIRST: true
2020/10/19 10:38:10      DAY_OF_WEEK_DAILY_CAP: 
2020/10/19 10:38:10          Mo: volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:10          Tu: volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:10          We: volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:10          Th: volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:10          Fr: volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:10          Sa: volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:10          Su: volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:10      NUM_HOURS_TO_SELL: 23
2020/10/19 10:38:10      PARENT_BUCKET_SIZE_SECONDS: 600
2020/10/19 10:38:10      DISTRIBUTE_SURPLUS_OVER_REMAINING_INTERVALS_PERCENT_CEILING: 0.05
2020/10/19 10:38:10      EXPONENTIAL_SMOOTHING_FACTOR: 0.5
2020/10/19 10:38:10      MIN_CHILD_ORDER_SIZE_PERCENT_OF_PARENT: 0.2
2020/10/19 10:38:10 ccxt-rest is not running at http://localhost:3000 so we cannot include those exchanges: could not execute http request: Get http://localhost:3000/exchanges: dial tcp [::1]:3000: connect: connection refused
2020/10/19 10:38:10 set latest trade cursor from where to start tracking fills (no override specified): 5533459770519553-0
2020/10/19 10:38:10 validating trustlines...
2020/10/19 10:38:10 trustlines valid
2020/10/19 10:38:10 Starting fill tracker with 2 handlers
2020/10/19 10:38:10 Starting the trader bot...
2020/10/19 10:38:10 ----------------------------------------------------------------------------------------------------
2020/10/19 10:38:11 there were no trades, leaving lastCursor value as 5533459770519553-0
2020/10/19 10:38:12 synchronized state loading is disabled
2020/10/19 10:38:12  (base) assetA=native, maxA=53926.07655740, trustA=math.MaxFloat64
2020/10/19 10:38:12 (quote) assetB=COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI, maxB=998218.49778510, trustB=922337203685.47753906
2020/10/19 10:38:12 orderConstraints for trading pair XLM/COUPON: OrderConstraints[PricePrecision: 7, VolumePrecision: 7, MinBaseVolume: 0.0000001, MinQuoteVolume: <nil>]
2020/10/19 10:38:13 liabilities after resetting
2020/10/19 10:38:13 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=23.50000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:38:13 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:38:13 GetLevels, unix timestamp for 'now' in UTC = 1603129093 (2020-10-19 17:38:13.482392 +0000 UTC)
2020/10/19 10:38:13 volumeFilter = volume/daily/sell/base/10000.0/exact
2020/10/19 10:38:13 returning kraken API key at index 0
2020/10/19 10:38:14 (modifier: mid) price from exchange feed (kraken/XXLM/ZUSD/mid): bidPrice=0.085611, askPrice=0.085650, midPrice=0.085631, lastTradePrice=0.085535; price=0.085631
2020/10/19 10:38:14 bucketInfo: BucketInfo[UUID=513bb43752d81d03d91e986ec742721ecc8dbc63, date=2020-10-19, dayID=1 (Monday), bucketID=105, startTime=2020-10-19T17:30:00Z, endTime=2020-10-19T17:39:59Z, sizeSeconds=600, totalBuckets=144, totalBucketsToSell=138, dayBaseSoldStart=0.00000000, dayBaseCapacity=10000.00000000, totalBaseSurplusStart=7608.69565217, baseSurplusIncluded=5072.46376812, baseCapacity=5144.92753623, minOrderSizeBase=1028.98550725, DynamicBucketValues[isNew=true, isLast=false, roundID=0, dayBaseSold=0.00000000, dayBaseRemaining=10000.00000000, baseSold=0.00000000, baseRemaining=5144.92753623, bucketProgress=0.00%, bucketTimeElapsed=82.30%]]; roundInfo: RoundInfo[roundID=0, bucketID=105, bucketUUID=513bb43752d81d03d91e986ec742721ecc8dbc63, now=2020-10-19T17:38:13Z (day=Monday, secondsElapsedToday=63493), sizeBaseCapped=4039.94933898, price=0.08563100]
2020/10/19 10:38:14 levels returned (side = sell): [{0.0856310 4039.9493390}]
2020/10/19 10:38:14 offer | sell | level=1 | curPriceQuote=11.73943160 | curAmtBase=590.44839220 | pruning=false
2020/10/19 10:38:14 offer | sell | level=2 | curPriceQuote=11.74012070 | curAmtBase=212.96629450 | pruning=true
2020/10/19 10:38:14 deleteSideStrategy: deleting 2 offers
2020/10/19 10:38:14 created 3 operations to prune excess offers
2020/10/19 10:38:14 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 10:38:14 reloading sequence number
2020/10/19 10:38:14 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAABLAAARv8AAAoIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAAAg/siG5oWlb3T4T+GOwXwOzViNlbydPaR9RQ/j+1NbNsAAAADAAAAAkNPVVBPTgAAAAAAAAAAAABYzLFaGLhSv4ICPKFVoofst3QfHCnyC/Yx4jgHIf+3fgAAAAAAAAAAAAAAAAb/ZncAmJaAAAAAAACjkooAAAABAAAAAIP7IhuaFpW90+E/hjsF8Ds1YjZW8nT2kfUUP4/tTWzbAAAAAwAAAAAAAAACQ09VUE9OAAAAAAAAAAAAAFjMsVoYuFK/ggI8oVWih+y3dB8cKfIL9jHiOAch/7d+AAAAAAAAAAAAAKgfAAehIAAAAAAAo5KLAAAAAQAAAACD+yIbmhaVvdPhP4Y7BfA7NWI2VvJ09pH1FD+P7U1s2wAAAAMAAAAAAAAAAkNPVVBPTgAAAAAAAAAAAABYzLFaGLhSv4ICPKFVoofst3QfHCnyC/Yx4jgHIf+3fgAAAAAAAAAAAAAqDwAB6EgAAAAAAKOSjAAAAAAAAAACIqopbAAAAEBgMwscihR7T+i0tS0pivZsfPzksm11UVh6o7L2eEjXEpUF9MdKjS3taqcNZXtHU8ia9u59RtgSAhSdgFOOU10B7U1s2wAAAEBeE2oyANQPy3Qq3N1t0Hf179jA1wU9JwnOqB2pWd8e9drnJWJYmFC9guL8xIeRzBB5PhmQuuhuGE14xg8UhJQI
2020/10/19 10:38:14 submitting tx XDR to network (async)
2020/10/19 10:38:15 liabilities after resetting
2020/10/19 10:38:16 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=23.50000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:38:16 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:38:16 sell, done creating preceding offers (numLevelsConsumed=0, hitCapacityLimit=false, numOps=0, newTopOfferPrice=<nil>)
2020/10/19 10:38:16 sell | modify | old level=1 | new level = 1 | triggers=[price amount] | targetPriceQuote=0.08563100 | targetAmtBase=4039.94933900 | curPriceQuote=11.73943160 | lowPriceQuote=0.08554537 | highPriceQuote=0.08571663 | curAmtBase=590.44839220 | minAmtBase=4035.90938966 | maxAmtBase=4043.98928834
2020/10/19 10:38:16 liabilities at the end of a call to UpdateWithOps
2020/10/19 10:38:16 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=23.50000000, buyingLiabilities=345.94490185, sellingLiabilities=0.00000000
2020/10/19 10:38:16 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=4039.94933900
2020/10/19 10:38:16 orderConstraintsFilter:  buying, baseAmount=345.94490185, quoteAmount=4039.94933900, keep = true
2020/10/19 10:38:16 orderConstraintsFilter: dropped 0, kept 1 ops from original 1 ops, len(filteredOps) = 1
2020/10/19 10:38:16 created 1 operations to update existing offers
2020/10/19 10:38:16 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 10:38:16 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAAAZAAARv8AAAoJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAg/siG5oWlb3T4T+GOwXwOzViNlbydPaR9RQ/j+1NbNsAAAADAAAAAkNPVVBPTgAAAAAAAAAAAABYzLFaGLhSv4ICPKFVoofst3QfHCnyC/Yx4jgHIf+3fgAAAAAAAAAJZ/9ZDgABTn8AD0JAAAAAAACjkokAAAAAAAAAAiKqKWwAAABAB+9knx47IYNrvl1gzrmPlrvm0+xMcaO5Su+7rFsG56A4AE1/AkWI3mAYBF3XhZWyJGX2TupOHw/IwDXEjcQrC+1NbNsAAABA+Vwq391DTd/9BfcO5RMHOK+7ghDsgc62Q/LkAls05RvDO73cixHuOfyz5ZL3HCARs7X6ykYyIX2LOUMxB++3Cw==
2020/10/19 10:38:16 submitting tx XDR to network (async)
2020/10/19 10:38:16 metric - successfully sent event metric of type 'ce:update'
2020/10/19 10:38:19 (async) tx confirmation hash: 4c6752b15b860eeb3334a5b9d14637562fa3e07b16adf8228a84cba3ad99a864
2020/10/19 10:38:24 (async) tx confirmation hash: eb34c6f1d9f73b3f1c1813bace891b0bd4c8597816ad3a8d86133259d420d495
2020/10/19 10:38:24 ----------------------------------------------------------------------------------------------------
2020/10/19 10:38:24 sleeping for 4m46.275068535s...

@debnil
Copy link
Contributor Author

debnil commented Oct 19, 2020

Sell TWAP run log here. I do see some differences, but should we be swapping the base and quote assets in the config file, in addition to the code changes we've made?

2020/10/19 10:40:01 Starting Kelp Trader: debnil/buytwap:nightly-33ab2afe-77-g48e59fa4-dirty [48e59fa4c91ddf083fba4838b273f0b2f0021e25-dirty]
2020/10/19 10:40:01 will run unbounded iterations
2020/10/19 10:40:01 configs:
2020/10/19 10:40:01      SOURCE_SECRET_SEED: [secret key to account GBHXGGUD3LIAWJHFO7737C4TFNDDDLZ74C6VBEPF5H53XNRCVIUWZA5I]
2020/10/19 10:40:01      TRADING_SECRET_SEED: [secret key to account GCB7WIQ3TILJLPOT4E7YMOYF6A5TKYRWK3ZHJ5UR6UKD7D7NJVWNWIQV]
2020/10/19 10:40:01      ASSET_CODE_A: XLM
2020/10/19 10:40:01      ISSUER_A: 
2020/10/19 10:40:01      ASSET_CODE_B: COUPON
2020/10/19 10:40:01      ISSUER_B: GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI
2020/10/19 10:40:01      TICK_INTERVAL_SECONDS: 300
2020/10/19 10:40:01      MAX_TICK_DELAY_MILLIS: 0
2020/10/19 10:40:01      DELETE_CYCLES_THRESHOLD: 0
2020/10/19 10:40:01      SUBMIT_MODE: both
2020/10/19 10:40:01      FILL_TRACKER_SLEEP_MILLIS: 150000
2020/10/19 10:40:01      FILL_TRACKER_DELETE_CYCLES_THRESHOLD: 0
2020/10/19 10:40:01      SYNCHRONIZE_STATE_LOAD_ENABLE: false
2020/10/19 10:40:01      SYNCHRONIZE_STATE_LOAD_MAX_RETRIES: 0
2020/10/19 10:40:01      FILL_TRACKER_LAST_TRADE_CURSOR_OVERRIDE: 
2020/10/19 10:40:01      HORIZON_URL: https://horizon-testnet.stellar.org
2020/10/19 10:40:01      CCXT_REST_URL: <nil>
2020/10/19 10:40:01      DOLLAR_VALUE_FEED_BASE_ASSET: 
2020/10/19 10:40:01      DOLLAR_VALUE_FEED_QUOTE_ASSET: 
2020/10/19 10:40:01      FEE: 
2020/10/19 10:40:01          CAPACITY_TRIGGER: 0.8
2020/10/19 10:40:01          PERCENTILE: 90
2020/10/19 10:40:01          MAX_OP_FEE_STROOPS: 5000
2020/10/19 10:40:01      CENTRALIZED_PRICE_PRECISION_OVERRIDE: <nil>
2020/10/19 10:40:01      CENTRALIZED_VOLUME_PRECISION_OVERRIDE: <nil>
2020/10/19 10:40:01      CENTRALIZED_MIN_BASE_VOLUME_OVERRIDE: <nil>
2020/10/19 10:40:01      CENTRALIZED_MIN_QUOTE_VOLUME_OVERRIDE: <nil>
2020/10/19 10:40:01      POSTGRES_DB: 
2020/10/19 10:40:01          HOST: localhost
2020/10/19 10:40:01          PORT: 5432
2020/10/19 10:40:01          DB_NAME: kelp
2020/10/19 10:40:01          USER: postgres
2020/10/19 10:40:01          PASSWORD: 
2020/10/19 10:40:01          SSL_ENABLE: false
2020/10/19 10:40:01      DB_OVERRIDE__ACCOUNT_ID: account1
2020/10/19 10:40:01      FILTERS: []
2020/10/19 10:40:01      ALERT_TYPE: 
2020/10/19 10:40:01      ALERT_API_KEY: 
2020/10/19 10:40:01      MONITORING_PORT: 0
2020/10/19 10:40:01      MONITORING_TLS_CERT: 
2020/10/19 10:40:01      MONITORING_TLS_KEY: 
2020/10/19 10:40:01      GOOGLE_CLIENT_ID: 
2020/10/19 10:40:01      GOOGLE_CLIENT_SECRET: 
2020/10/19 10:40:01      ACCEPTABLE_GOOGLE_EMAILS: 
2020/10/19 10:40:01      TRADING_EXCHANGE: 
2020/10/19 10:40:01      EXCHANGE_API_KEYS: 
2020/10/19 10:40:01      EXCHANGE_PARAMS: 
2020/10/19 10:40:01      EXCHANGE_HEADERS: 
2020/10/19 10:40:01 Trading XLM: for COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI
2020/10/19 10:40:02 metric - successfully sent event metric of type 'ce:startup'
2020/10/19 10:40:02 using CCXT-rest URL: http://localhost:3000
2020/10/19 10:40:02 did not create db 'kelp' because it already exists
2020/10/19 10:40:02 creating db schema and running upgrade scripts ...
2020/10/19 10:40:02 fetched dbVersion from db: 6
2020/10/19 10:40:02    skipping upgrade script for version 1 because current db version (6) is equal or ahead
2020/10/19 10:40:02 fetched dbVersion from db: 6
2020/10/19 10:40:02    skipping upgrade script for version 2 because current db version (6) is equal or ahead
2020/10/19 10:40:02 fetched dbVersion from db: 6
2020/10/19 10:40:02    skipping upgrade script for version 3 because current db version (6) is equal or ahead
2020/10/19 10:40:02 fetched dbVersion from db: 6
2020/10/19 10:40:02    skipping upgrade script for version 4 because current db version (6) is equal or ahead
2020/10/19 10:40:02 fetched dbVersion from db: 6
2020/10/19 10:40:02    skipping upgrade script for version 5 because current db version (6) is equal or ahead
2020/10/19 10:40:02 fetched dbVersion from db: 6
2020/10/19 10:40:02    skipping upgrade script for version 6 because current db version (6) is equal or ahead
2020/10/19 10:40:02 ... finished creating db schema and running upgrade scripts
2020/10/19 10:40:02 made db instance with config: host=localhost port=5432 sslmode=disable user=postgres dbname=kelp
2020/10/19 10:40:02 Using network passphrase: Test SDF Network ; September 2015
2020/10/19 10:40:02 Making strategy: sell_twap
2020/10/19 10:40:02 configs:
2020/10/19 10:40:02      START_ASK_FEED_TYPE: exchange
2020/10/19 10:40:02      START_ASK_FEED_URL: kraken/XXLM/ZUSD/mid
2020/10/19 10:40:02      PRICE_TOLERANCE: 0.001
2020/10/19 10:40:02      AMOUNT_TOLERANCE: 0.001
2020/10/19 10:40:02      RATE_OFFSET_PERCENT: 0
2020/10/19 10:40:02      RATE_OFFSET: 0
2020/10/19 10:40:02      RATE_OFFSET_PERCENT_FIRST: true
2020/10/19 10:40:02      DAY_OF_WEEK_DAILY_CAP: 
2020/10/19 10:40:02          Mo: volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:02          Tu: volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:02          We: volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:02          Th: volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:02          Fr: volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:02          Sa: volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:02          Su: volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:02      NUM_HOURS_TO_SELL: 23
2020/10/19 10:40:02      PARENT_BUCKET_SIZE_SECONDS: 600
2020/10/19 10:40:02      DISTRIBUTE_SURPLUS_OVER_REMAINING_INTERVALS_PERCENT_CEILING: 0.05
2020/10/19 10:40:02      EXPONENTIAL_SMOOTHING_FACTOR: 0.5
2020/10/19 10:40:02      MIN_CHILD_ORDER_SIZE_PERCENT_OF_PARENT: 0.2
2020/10/19 10:40:02 ccxt-rest is not running at http://localhost:3000 so we cannot include those exchanges: could not execute http request: Get http://localhost:3000/exchanges: dial tcp [::1]:3000: connect: connection refused
2020/10/19 10:40:03 set latest trade cursor from where to start tracking fills (no override specified): 5533459770519553-0
2020/10/19 10:40:03 validating trustlines...
2020/10/19 10:40:03 trustlines valid
2020/10/19 10:40:03 Starting fill tracker with 2 handlers
2020/10/19 10:40:03 Starting the trader bot...
2020/10/19 10:40:03 ----------------------------------------------------------------------------------------------------
2020/10/19 10:40:03 there were no trades, leaving lastCursor value as 5533459770519553-0
2020/10/19 10:40:04 synchronized state loading is disabled
2020/10/19 10:40:04  (base) assetA=native, maxA=53926.07655740, trustA=math.MaxFloat64
2020/10/19 10:40:04 (quote) assetB=COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI, maxB=998218.49778510, trustB=922337203685.47753906
2020/10/19 10:40:04 orderConstraints for trading pair XLM/COUPON: OrderConstraints[PricePrecision: 7, VolumePrecision: 7, MinBaseVolume: 0.0000001, MinQuoteVolume: <nil>]
2020/10/19 10:40:05 liabilities after resetting
2020/10/19 10:40:05 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:40:05 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:40:05 GetLevels, unix timestamp for 'now' in UTC = 1603129205 (2020-10-19 17:40:05.309109 +0000 UTC)
2020/10/19 10:40:05 volumeFilter = volume/daily/sell/base/10000.0/exact
2020/10/19 10:40:05 returning kraken API key at index 0
2020/10/19 10:40:05 (modifier: mid) price from exchange feed (kraken/XXLM/ZUSD/mid): bidPrice=0.085637, askPrice=0.085650, midPrice=0.085644, lastTradePrice=0.085535; price=0.085644
2020/10/19 10:40:05 bucketInfo: BucketInfo[UUID=5e71d5c69c6a6226e55d3aa67154de14defb62fe, date=2020-10-19, dayID=1 (Monday), bucketID=106, startTime=2020-10-19T17:40:00Z, endTime=2020-10-19T17:49:59Z, sizeSeconds=600, totalBuckets=144, totalBucketsToSell=138, dayBaseSoldStart=0.00000000, dayBaseCapacity=10000.00000000, totalBaseSurplusStart=7681.15942029, baseSurplusIncluded=5120.77294686, baseCapacity=5193.23671498, minOrderSizeBase=1038.64734300, DynamicBucketValues[isNew=true, isLast=false, roundID=0, dayBaseSold=0.00000000, dayBaseRemaining=10000.00000000, baseSold=0.00000000, baseRemaining=5193.23671498, bucketProgress=0.00%, bucketTimeElapsed=0.83%]]; roundInfo: RoundInfo[roundID=0, bucketID=106, bucketUUID=5e71d5c69c6a6226e55d3aa67154de14defb62fe, now=2020-10-19T17:40:05Z (day=Monday, secondsElapsedToday=63605), sizeBaseCapped=1458.49440663, price=0.08564400]
2020/10/19 10:40:05 levels returned (side = sell): [{0.0856440 1458.4944066}]
2020/10/19 10:40:05 deleteSideStrategy: deleting 1 offers
2020/10/19 10:40:05 created 1 operations to prune excess offers
2020/10/19 10:40:06 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 10:40:06 reloading sequence number
2020/10/19 10:40:06 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAAAZAAARv8AAAoKAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAg/siG5oWlb3T4T+GOwXwOzViNlbydPaR9RQ/j+1NbNsAAAADAAAAAkNPVVBPTgAAAAAAAAAAAABYzLFaGLhSv4ICPKFVoofst3QfHCnyC/Yx4jgHIf+3fgAAAAAAAAAAAAAAAAABTn8AD0JAAAAAAACjkokAAAAAAAAAAiKqKWwAAABAxdraBCw+sf9CKWAIE1x6WMcwrnXAYOYu9fJdJvO0DPI9Myj4w1PyvabSpxGjSiE2ipsTAZb6+ugCf7kmv37rB+1NbNsAAABAl9N+cFBJqaE2jXc0qfUOgiQRqODrnW5ikW54yD8FrQc0/df9g3FRAgKoLjbrMKc2n+EJGydm4nH/Hip8uYI4Dw==
2020/10/19 10:40:06 submitting tx XDR to network (async)
2020/10/19 10:40:06 liabilities after resetting
2020/10/19 10:40:06 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:40:07 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 10:40:07 sell | create | new level=1 | priceQuote=0.08564400 | amtBase=1458.49440660
2020/10/19 10:40:07 sell, done creating preceding offers (numLevelsConsumed=1, hitCapacityLimit=false, numOps=1, newTopOfferPrice=0.0856440)
2020/10/19 10:40:07 liabilities at the end of a call to UpdateWithOps
2020/10/19 10:40:07 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=0.00000000, sellingLiabilities=1458.99440660
2020/10/19 10:40:07 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=124.91129496, sellingLiabilities=0.00000000
2020/10/19 10:40:07 orderConstraintsFilter: selling, baseAmount=1458.49440660, quoteAmount=124.91129496, keep = true
2020/10/19 10:40:07 orderConstraintsFilter: dropped 0, kept 1 ops from original 1 ops, len(filteredOps) = 1
2020/10/19 10:40:07 created 1 operations to update existing offers
2020/10/19 10:40:07 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 10:40:07 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAAAZAAARv8AAAoLAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAg/siG5oWlb3T4T+GOwXwOzViNlbydPaR9RQ/j+1NbNsAAAADAAAAAAAAAAJDT1VQT04AAAAAAAAAAAAAWMyxWhi4Ur+CAjyhVaKH7Ld0Hxwp8gv2MeI4ByH/t34AAAADZVSVwgAAU6MAA9CQAAAAAAAAAAAAAAAAAAAAAiKqKWwAAABA4JIX5v9U3WHNGYK/XqGjdXOB5nPEwZYttz3/gZg/2eB4M6VbnbppNq4nvooZUqQkvsp/uxifyrNHlAVjVPv1De1NbNsAAABABEOU6NuTj/1efe/N2YFIquaMNu6Epp3fNpG8QP5ixnzaEQNz390zR9I29YvNb3yPLOuWvfaFbQVdi1u/ffMxDg==
2020/10/19 10:40:07 submitting tx XDR to network (async)
2020/10/19 10:40:07 metric - successfully sent event metric of type 'ce:update'
2020/10/19 10:40:08 (async) tx confirmation hash: 3788fb4042776647345bef822a829f67c7a96ffaa4464b311262f9c9e3dee98c
2020/10/19 10:40:13 (async) tx confirmation hash: a769ebcab2f9cb84738eef260ac63445ac1bc95b9a6c4b59635e97c5507294a3
2020/10/19 10:40:13 ----------------------------------------------------------------------------------------------------
2020/10/19 10:40:13 sleeping for 4m49.800671801s...

@debnil
Copy link
Contributor Author

debnil commented Oct 19, 2020

Logfile when changing the last boolean input parameter for makeSellSideStrategy to true:

2020/10/19 12:57:32 Making strategy: buy_twap
2020/10/19 12:57:32 configs:
2020/10/19 12:57:32      START_ASK_FEED_TYPE: exchange
2020/10/19 12:57:32      START_ASK_FEED_URL: kraken/XXLM/ZUSD/mid
2020/10/19 12:57:32      PRICE_TOLERANCE: 0.001
2020/10/19 12:57:32      AMOUNT_TOLERANCE: 0.001
2020/10/19 12:57:32      RATE_OFFSET_PERCENT: 0
2020/10/19 12:57:32      RATE_OFFSET: 0
2020/10/19 12:57:32      RATE_OFFSET_PERCENT_FIRST: true
2020/10/19 12:57:32      DAY_OF_WEEK_DAILY_CAP: 
2020/10/19 12:57:32          Mo: volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:32          Tu: volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:32          We: volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:32          Th: volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:32          Fr: volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:32          Sa: volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:32          Su: volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:32      NUM_HOURS_TO_SELL: 23
2020/10/19 12:57:32      PARENT_BUCKET_SIZE_SECONDS: 600
2020/10/19 12:57:32      DISTRIBUTE_SURPLUS_OVER_REMAINING_INTERVALS_PERCENT_CEILING: 0.05
2020/10/19 12:57:32      EXPONENTIAL_SMOOTHING_FACTOR: 0.5
2020/10/19 12:57:32      MIN_CHILD_ORDER_SIZE_PERCENT_OF_PARENT: 0.2
2020/10/19 12:57:32 ccxt-rest is not running at http://localhost:3000 so we cannot include those exchanges: could not execute http request: Get http://localhost:3000/exchanges: dial tcp [::1]:3000: connect: connection refused
2020/10/19 12:57:33 set latest trade cursor from where to start tracking fills (no override specified): 5533459770519553-0
2020/10/19 12:57:33 validating trustlines...
2020/10/19 12:57:33 trustlines valid
2020/10/19 12:57:33 Starting fill tracker with 2 handlers
2020/10/19 12:57:33 Starting the trader bot...
2020/10/19 12:57:33 ----------------------------------------------------------------------------------------------------
2020/10/19 12:57:33 there were no trades, leaving lastCursor value as 5533459770519553-0
2020/10/19 12:57:33 synchronized state loading is disabled
2020/10/19 12:57:33  (base) assetA=native, maxA=53926.07655740, trustA=math.MaxFloat64
2020/10/19 12:57:33 (quote) assetB=COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI, maxB=998218.49778510, trustB=922337203685.47753906
2020/10/19 12:57:33 orderConstraints for trading pair XLM/COUPON: OrderConstraints[PricePrecision: 7, VolumePrecision: 7, MinBaseVolume: 0.0000001, MinQuoteVolume: <nil>]
2020/10/19 12:57:34 liabilities after resetting
2020/10/19 12:57:34 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 12:57:34 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 12:57:34 GetLevels, unix timestamp for 'now' in UTC = 1603137454 (2020-10-19 19:57:34.49634 +0000 UTC)
2020/10/19 12:57:34 volumeFilter = volume/daily/sell/base/10000.0/exact
2020/10/19 12:57:34 returning kraken API key at index 0
2020/10/19 12:57:34 (modifier: mid) price from exchange feed (kraken/XXLM/ZUSD/mid): bidPrice=0.085280, askPrice=0.085369, midPrice=0.085325, lastTradePrice=0.085368; price=0.085325
2020/10/19 12:57:34 bucketInfo: BucketInfo[UUID=5ef3dec0b500fbaab51d981ef4ccc20e663c6862, date=2020-10-19, dayID=1 (Monday), bucketID=119, startTime=2020-10-19T19:50:00Z, endTime=2020-10-19T19:59:59Z, sizeSeconds=600, totalBuckets=144, totalBucketsToSell=138, dayBaseSoldStart=0.00000000, dayBaseCapacity=10000.00000000, totalBaseSurplusStart=8623.18840580, baseSurplusIncluded=8623.18840580, baseCapacity=8695.65217391, minOrderSizeBase=1739.13043478, DynamicBucketValues[isNew=true, isLast=false, roundID=0, dayBaseSold=0.00000000, dayBaseRemaining=10000.00000000, baseSold=0.00000000, baseRemaining=8695.65217391, bucketProgress=0.00%, bucketTimeElapsed=75.79%]]; roundInfo: RoundInfo[roundID=0, bucketID=119, bucketUUID=5ef3dec0b500fbaab51d981ef4ccc20e663c6862, now=2020-10-19T19:57:34Z (day=Monday, secondsElapsedToday=71854), sizeBaseCapped=6781.72341733, price=0.08532500]
2020/10/19 12:57:34 levels returned (side = buy ): [{0.0853250 6781.7234173}]
2020/10/19 12:57:34 deleteSideStrategy: deleting 1 offers
2020/10/19 12:57:34 created 1 operations to prune excess offers
2020/10/19 12:57:34 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 12:57:34 reloading sequence number
2020/10/19 12:57:34 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAAAZAAARv8AAAoRAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAg/siG5oWlb3T4T+GOwXwOzViNlbydPaR9RQ/j+1NbNsAAAADAAAAAAAAAAJDT1VQT04AAAAAAAAAAAAAWMyxWhi4Ur+CAjyhVaKH7Ld0Hxwp8gv2MeI4ByH/t34AAAAAAAAAAAAAU1MAA9CQAAAAAACjkqsAAAAAAAAAAiKqKWwAAABAB51clnBemO8iD1F8ZhE8pDHNGjn6DgqKKy8rKUxo8ctXx+A2uLOkQe7xKSlCQDRdpnZ26AKOv7yOz4KrLW66C+1NbNsAAABAAOCdqjAYYjZQSpXdh1UI+frCCHhqOlMmE7FzUBcPUH6rLLS/5U3wd8/OlCxmQWrG+BNTyf4AVLyZFNiM8tkxBQ==
2020/10/19 12:57:34 submitting tx XDR to network (async)
2020/10/19 12:57:35 liabilities after resetting
2020/10/19 12:57:35 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 12:57:35 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 12:57:35 buy  | create | new level=1 | priceQuote=11.71989452 | amtBase=6781.72341730
2020/10/19 12:57:35 buy , done creating preceding offers (numLevelsConsumed=1, hitCapacityLimit=false, numOps=1, newTopOfferPrice=0.0853250)
2020/10/19 12:57:35 liabilities at the end of a call to UpdateWithOps
2020/10/19 12:57:35 asset=base  , balance=53926.07655740, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=6781.72341730, sellingLiabilities=0.50000000
2020/10/19 12:57:35 asset=quote , balance=998218.49778510, trust=922337203685.47753906, minAccountBal=998.21849779, buyingLiabilities=0.00000000, sellingLiabilities=79481.08312100
2020/10/19 12:57:35 orderConstraintsFilter:  buying, baseAmount=6781.72341730, quoteAmount=79481.08312100, keep = true
2020/10/19 12:57:35 orderConstraintsFilter: dropped 0, kept 1 ops from original 1 ops, len(filteredOps) = 1
2020/10/19 12:57:35 created 1 operations to update existing offers
2020/10/19 12:57:35 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 12:57:35 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAAAZAAARv8AAAoSAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAg/siG5oWlb3T4T+GOwXwOzViNlbydPaR9RQ/j+1NbNsAAAADAAAAAkNPVVBPTgAAAAAAAAAAAABYzLFaGLhSv4ICPKFVoofst3QfHCnyC/Yx4jgHIf+3fgAAAAAAAAC5DmrRagAADVUAAJxAAAAAAAAAAAAAAAAAAAAAAiKqKWwAAABAyv4/M2kpfMmcS42jvrk6B2aYafBbWfv2hAfaIwAXOAIDMNgGKQzviIGr4nMrdUEY0etoD/kfK5cG0+CmMVfpAu1NbNsAAABA2rstbiWJCfu6kRk8ucNgzY7GHTHuFuwIiGnXb1wl56KIcgCNH8vi3nyQSYblGNfXcCf2AchpibyMrRfDePGNCg==
2020/10/19 12:57:35 submitting tx XDR to network (async)
2020/10/19 12:57:35 metric - not sending event metric of type 'ce:update' because metrics are disabled
2020/10/19 12:57:38 (async) tx confirmation hash: 3a12ff12414e8d4831b3efeb23ec007614202ea055f827378ce401726cabe793
2020/10/19 12:57:44 (async) tx confirmation hash: cf7beb27a22ceb83211fcd47d0fc0221bc08b384dca0803e037bea2a95003037
2020/10/19 12:57:44 ----------------------------------------------------------------------------------------------------
2020/10/19 12:57:44 sleeping for 4m48.873188883s...

@debnil
Copy link
Contributor Author

debnil commented Oct 19, 2020

@nikhilsaraf After running sell_twap, I then ran buy_twap and got the below. I logged into StellarTerm and confirmed that this can create buy offers and complete trades. Is this sufficient testing?

2020/10/19 15:46:45 Starting fill tracker with 2 handlers
2020/10/19 15:46:45 Starting the trader bot...
2020/10/19 15:46:45 ----------------------------------------------------------------------------------------------------
2020/10/19 15:46:45 there were no trades, leaving lastCursor value as 5621167297667073-0
2020/10/19 15:46:46 synchronized state loading is disabled
2020/10/19 15:46:46  (base) assetA=native, maxA=8999.99997970, trustA=math.MaxFloat64
2020/10/19 15:46:46 (quote) assetB=COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI, maxB=85.33766260, trustB=922337203685.47753906
2020/10/19 15:46:46 orderConstraints for trading pair XLM/COUPON: OrderConstraints[PricePrecision: 7, VolumePrecision: 7, MinBaseVolume: 0.0000001, MinQuoteVolume: <nil>]
2020/10/19 15:46:46 liabilities after resetting
2020/10/19 15:46:46 asset=base  , balance=8999.99997970, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 15:46:46 asset=quote , balance=85.33766260, trust=922337203685.47753906, minAccountBal=0.08533766, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 15:46:46 GetLevels, unix timestamp for 'now' in UTC = 1603147606 (2020-10-19 22:46:46.8704 +0000 UTC)
2020/10/19 15:46:46 volumeFilter = volume/daily/sell/base/10000.0/exact
2020/10/19 15:46:46 returning kraken API key at index 0
2020/10/19 15:46:47 (modifier: mid) price from exchange feed (kraken/XXLM/ZUSD/mid): bidPrice=0.085293, askPrice=0.085349, midPrice=0.085321, lastTradePrice=0.085287; price=0.085321
2020/10/19 15:46:47 bucketInfo: BucketInfo[UUID=e783c018475cd5beeafa6d9d0458ed69738bc896, date=2020-10-19, dayID=1 (Monday), bucketID=136, startTime=2020-10-19T22:40:00Z, endTime=2020-10-19T22:49:59Z, sizeSeconds=600, totalBuckets=144, totalBucketsToSell=138, dayBaseSoldStart=0.00000000, dayBaseCapacity=10000.00000000, totalBaseSurplusStart=9855.07246377, baseSurplusIncluded=9855.07246377, baseCapacity=9927.53623188, minOrderSizeBase=1985.50724638, DynamicBucketValues[isNew=true, isLast=false, roundID=0, dayBaseSold=0.00000000, dayBaseRemaining=10000.00000000, baseSold=0.00000000, baseRemaining=9927.53623188, bucketProgress=0.00%, bucketTimeElapsed=67.78%]]; roundInfo: RoundInfo[roundID=0, bucketID=136, bucketUUID=e783c018475cd5beeafa6d9d0458ed69738bc896, now=2020-10-19T22:46:46Z (day=Monday, secondsElapsedToday=82006), sizeBaseCapped=6304.77380840, price=0.08532100]
2020/10/19 15:46:47 levels returned (side = buy ): [{0.0853210 6304.7738084}]
2020/10/19 15:46:47 deleteSideStrategy: deleting 1 offers
2020/10/19 15:46:47 created 1 operations to prune excess offers
2020/10/19 15:46:47 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 15:46:47 reloading sequence number
2020/10/19 15:46:47 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAAAZAAARv8AAAoVAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAhTStdpNWrQjnj6iRrzbV2X37s4sQ7VDENvLteKvUcC0AAAADAAAAAAAAAAJDT1VQT04AAAAAAAAAAAAAWMyxWhi4Ur+CAjyhVaKH7Ld0Hxwp8gv2MeI4ByH/t34AAAAAAAAAAAAApqEAB6EgAAAAAACjkxgAAAAAAAAAAiKqKWwAAABABzyTrmp6hqMU8h7t+74jAA5to/HQ/olbX88Dq/vbYd0oJRy6vxBRH2uAqtAKUo4b+GmSFamSxRuxcqARnUijAqvUcC0AAABAIOo3o5UX+YBF+g2nS4zrkQVxBWfKJLA2plIh2hcEtBxrxY0cYEkul0ehGsOa51wj1hrmyw66k7OXHy4Xzx/hBg==
2020/10/19 15:46:47 submitting tx XDR to network (async)
2020/10/19 15:46:48 liabilities after resetting
2020/10/19 15:46:48 asset=base  , balance=8999.99997970, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 15:46:48 asset=quote , balance=85.33766260, trust=922337203685.47753906, minAccountBal=0.08533766, buyingLiabilities=0.00000000, sellingLiabilities=0.00000000
2020/10/19 15:46:48 buy  | create | new level=1 | priceQuote=11.72044397 | amtBase=6304.77380840
2020/10/19 15:46:48 we will oversell the asset 'COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI', amountSelling = 73894.74816750, bal = 85.33766260, minAccountBal = 0.08533766, liabilities.Selling = 0.00000000
2020/10/19 15:46:48 computed remainder amount, constrained by selling capacity, returning sellingAmount=85.25232494, buyingAmount=7.27381362
2020/10/19 15:46:48 buy  | create | new level=1 | priceQuote=11.72044397 | amtBase=7.27381362
2020/10/19 15:46:48 buy , done creating preceding offers (numLevelsConsumed=1, hitCapacityLimit=true, numOps=1, newTopOfferPrice=0.0853210)
2020/10/19 15:46:48 liabilities at the end of a call to UpdateWithOps
2020/10/19 15:46:48 asset=base  , balance=8999.99997970, trust=math.MaxFloat64, minAccountBal=22.00000000, buyingLiabilities=7.27381362, sellingLiabilities=0.50000000
2020/10/19 15:46:48 asset=quote , balance=85.33766260, trust=922337203685.47753906, minAccountBal=0.08533766, buyingLiabilities=0.00000000, sellingLiabilities=85.25232494
2020/10/19 15:46:48 orderConstraintsFilter:  buying, baseAmount=7.27381361, quoteAmount=85.25232490, keep = true
2020/10/19 15:46:48 orderConstraintsFilter: dropped 0, kept 1 ops from original 1 ops, len(filteredOps) = 1
2020/10/19 15:46:48 created 1 operations to update existing offers
2020/10/19 15:46:48 lastFee <= maxOpFeeStroops; using last_ledger_base_fee of 100 stroops (maxOpFeeStroops = 5000)
2020/10/19 15:46:48 tx XDR: AAAAAE9zGoPa0Ask5Xf/v4uTK0Yxrz/gvVCR5en7u7YiqilsAAAAZAAARv8AAAoWAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAhTStdpNWrQjnj6iRrzbV2X37s4sQ7VDENvLteKvUcC0AAAADAAAAAkNPVVBPTgAAAAAAAAAAAABYzLFaGLhSv4ICPKFVoofst3QfHCnyC/Yx4jgHIf+3fgAAAAAAAAAAMtB48QABTUkAD0JAAAAAAAAAAAAAAAAAAAAAAiKqKWwAAABAb1CJyBE1109QMePtiHINvp9tp4MHFpzF+4mAn9L+GslYSTV6BLfpIbvkLDb6VA5aQp4MmiLK/VHSv+VJSy4HBKvUcC0AAABA1vT/bwLRWmpF8lkUtnw+1i04egtb9MKH2WvmIxsW3vyM52GgxwuxCUqQnjIPMrKAPnuzt3dDXlK2H8ChAPqcCw==
2020/10/19 15:46:48 submitting tx XDR to network (async)
2020/10/19 15:46:48 metric - not sending event metric of type 'ce:update' because metrics are disabled
2020/10/19 15:46:53 (async) tx confirmation hash: 571ba740326f1e894a6b2cd9ff4a65e116a24509c696d60120e3353e57e17b7d
2020/10/19 15:46:58 (async) tx confirmation hash: ec89e9da2fa45c3aa9983763060620c75133a16c504dfd75d66ef3ed001d2fd7
2020/10/19 15:46:58 ----------------------------------------------------------------------------------------------------
2020/10/19 15:46:58 sleeping for 4m46.95205609s...
2020/10/19 15:49:16 received fill: Trade[txid: 5621227427213313-0, orderId: , ts: 1603147616000, pair: XLM/COUPON, action: buy, type: limit, counterPrice: 0.0855074, baseVolume: 997.0169236, counterCost: 85.2523249, fee: 0.0000100]
2020/10/19 15:49:16 registered market in db: tradingMarket[ID=b0d66371cd, ExchangeName=sdex, BaseAsset=native, QuoteAsset=COUPON:GBMMZMK2DC4FFP4CAI6KCVNCQ7WLO5A7DQU7EC7WGHRDQBZB763X4OQI]
2020/10/19 15:49:16 wrote trade (txid=5621227427213313-0) to db
2020/10/19 15:49:16 updated lastCursor value to 5621227427213313-0

@debnil debnil closed this Oct 19, 2020
@debnil debnil deleted the debnil/buytwap branch October 19, 2020 23:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[8] buyTwap strategy
2 participants