Giter Club home page Giter Club logo

mango-client-v3's People

Contributors

abacus-x avatar abrzezinski94 avatar ckamm avatar dafyddd avatar ebatsell avatar efoley avatar godmodegalactus avatar gsuz avatar impossiblepairs avatar kierangillen avatar lagzda avatar microwavedcola1 avatar mschneider avatar muneebmohammed avatar nicholasgodfreyclarke avatar opinionatedgeek avatar riordanp avatar silas-x avatar tlrjs avatar waterquarks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mango-client-v3's Issues

spot orders often filled a minSize too small

place a taker order to buy 10, immediately spotOpenOrdersAccounts[marketIndex] values are empty and my balance on the token is 9.9. i think it payed the taker fee but i can't see how to get an exact output, or how much i paid.

i'm guessing the taker fee is 0.001 so i should 10 * 1.001 = 10.01 and round up on orderSizeDecimals so 10.1 for this example, to get 10 out.

Spot BUY fills with 0.0001 less

Problem:
All spot BUY trades fill with 0.0001 less than ordered. This happens on all pairs. BTC/USDC, ETH/USDC, etc.

Reproduction:

  1. Go to https://devnet.mango.markets/market?name=BTC%2FUSDC
  2. Place a spot limit buy on BTC for any quantity
  3. Wait for fill
  4. Go to Trade History
  5. Notice you were filled for 0.0001 BTC less

I verified that this issue occurs both through this library and online on devnet. I have not tested mainnet.

Blockheight expiry strategy is accidentally conservative

const timeoutBlockHeight = signedAtBlock
? signedAtBlock.lastValidBlockHeight +
MAXIMUM_NUMBER_OF_BLOCKS_FOR_TRANSACTION
: 0;

Hey! I stumbled upon this line of code. I don't think this does what it's meant to do. lastValidBlockHeight is actually ‘the block height at which this recent blockhash will no longer be valid,’ so timeoutBlockHeight is just signedAtBlock.lastValidBlockHeight here.

Support getAvgImpactPriceUi

Return the average expected price from clearing one side of the order book. Feature to compliment getImpactPriceUi

Invalid or missing nodebanks

I'm getting this error when trying to use method: client.settleFunds(mangoGroup, mangoAccount, owner, spotMarket);

/Users/borkur/Desktop/Coding/mango-client-v3/src/client.ts:2649
throw new Error('Invalid or missing node banks');
^
Error: Invalid or missing node banks
at MangoClient. (/Users/borkur/Desktop/Coding/mango-client-v3/src/client.ts:2649:13)
at Generator.next ()
at fulfilled (/Users/borkur/Desktop/Coding/mango-client-v3/src/client.ts:28:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Issue using as a dependencie in a typescript package

I'm not very confident with Typescript, not sure the issue is on my side

"dependencies": {
      "@blockworks-foundation/mango-client-v3": "git+ssh://[email protected]:blockworks-foundation/mango-client-v3.git",
   // ...

I'm having issues that seems to come from the fact that the mango-client import also its node-dependencies, is it normal? Also missing id.json?

Screenshot 2021-10-28 at 9 12 05 AM

Add getCumlativeQty()

Add support for a function that given X price and 'buy' / 'sell' can return the cumulative quantity on the order book for prices greater(if buy) or less (if sell) than the price input

ie. input (38,sell), returns 8,219.81
image

Inconsistent value in utils.ZERO_BN causes "size too small" error

Background:
Installed in project via yarn @blockworks-foundation/mango-client
Version: 3.2.16
Problem: Orders placed to BTC SPOT intermittently fail with "size too small"

Diagnosis:
The value of utils.ZERO_BN is randomly inconsistent at

if (maxBaseQuantity.lte(ZERO_BN)) {

Additional Information:
I place a log in that function for utils.ZERO_BN and noticed it's value was not 0 when placing my order. After manually changing the base quantity comparison to a consistent value of BN(0), my orders stopped failing.

if (maxBaseQuantity.lte(new BN(0))) {
  throw new Error('size too small');
}

It's possible that the value is being changed in-place somewhere in the library. The behavior is not consistent, so reproduction is difficult, but it's happening.

show-health error: Exception: Could not find market for spot token ADA.

Hi Team, I run the ./show-health in the bin directory. It shows the errors below. Mango has no ADA/USDC spot market,however, it seems still checks the ADA spot market. pls help fix it. thanks.


2022-02-08 17:00:43 ⚠ root         
⚠ WARNING ⚠

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    🥭 Mango Markets: https://mango.markets
    📄 Documentation: https://docs.mango.markets/
    💬 Discord: https://discord.gg/67jySBhxrg
    🐦 Twitter: https://twitter.com/mangomarkets
    🚧 Github: https://github.com/blockworks-foundation
    📧 Email: mailto:[email protected]

Traceback (most recent call last):
  File "/Users/foonsun/works/mango-explorer/bin/./show-health", line 51, in <module>
    mango.output("Health", health_calculator.calculate(mango_account, spot_open_orders, group, cache))
  File "/opt/anaconda3/envs/driftenv/lib/python3.9/site-packages/mango/calculators/healthcalculator.py", line 157, in calculate
    raise Exception(f"Could not find market for spot token {priced_report.base_token.symbol}.")
Exception: Could not find market for spot token ADA.

My account scout log is below:

2022-02-08 16:56:37 ⓘ root         Address: 8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag
« ScoutReport [8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag]:
    Summary:
        Found 13 error(s) and 0 warning(s).

    Errors:
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'MNGO'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'BTC'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'ETH'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'SOL'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'USDT'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'SRM'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'RAY'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'COPE'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'FTT'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'MSOL'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'BNB'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'AVAX'.
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has no account for token 'LUNA'.

    Warnings:
        None

    Details:
        Account '8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag' has 1 USDC token account(s): [AztsQ8K4MfDzL3AXgjV4n5ymt6WmqGqjztcEW6ZRugbD]
        Margin account: « Account (un-named), Version.V3 [GUM8tdeVsKzKaBns828SgNbeA3i5oBQMZarutukZsVJt]
            « Metadata Version.V2 - Account: Initialized »
            Owner: 8AhMgKNmKmYtDnc6YCvK6GRmbEM8RmbAkjSSCdJz4Mag
            Delegated To: None
            Group: « Group 'mainnet.1' [98pjRuQjK3qA6gXts96PqZT4Ze5QmnCmt3QYjhbUSPue] »
            Advanced Orders Account: None
            MSRM: 0
            Bankrupt? False
            Upgradable? True
            Being Liquidated? False
            Shared Quote Token:
                « AccountSlot [15] USDC
                    Net Value:     « InstrumentValue:       679.80051715 USDC »
                        Deposited: « InstrumentValue:       679.80051715 USDC » (raw value: 657.72375935230919452579)
                        Borrowed:  « InstrumentValue:         0.00000000 USDC » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        None
                »
            In Basket: MNGO, BTC, ETH, SOL, USDT, SRM, RAY, COPE, FTT, ADA, MSOL, BNB, AVAX, LUNA
            Basket [14 in basket]:
                « AccountSlot [0] MNGO
                    Net Value:     « InstrumentValue:         0.00000000 MNGO »
                        Deposited: « InstrumentValue:         0.00000000 MNGO » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 MNGO » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [1] BTC
                    Net Value:     « InstrumentValue:         0.00000000 BTC »
                        Deposited: « InstrumentValue:         0.00000000 BTC » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 BTC » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [2] ETH
                    Net Value:     « InstrumentValue:         0.00000000 ETH »
                        Deposited: « InstrumentValue:         0.00000000 ETH » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 ETH » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [3] SOL
                    Net Value:     « InstrumentValue:         0.60000928 SOL »
                        Deposited: « InstrumentValue:         0.60000928 SOL » (raw value: 599.26469950687738474926)
                        Borrowed:  « InstrumentValue:         0.00000000 SOL » (raw value 0E-20)
                    Spot OpenOrders: 2gWc3qrroPFMsF1BGwnamTUb1RtMggWXWcsSytAVUoAc
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [4] USDT
                    Net Value:     « InstrumentValue:         0.00000000 USDT »
                        Deposited: « InstrumentValue:         0.00000000 USDT » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 USDT » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [5] SRM
                    Net Value:     « InstrumentValue:         0.00000000 SRM »
                        Deposited: « InstrumentValue:         0.00000000 SRM » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 SRM » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [6] RAY
                    Net Value:     « InstrumentValue:         0.00000000 RAY »
                        Deposited: « InstrumentValue:         0.00000000 RAY » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 RAY » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [7] COPE
                    Net Value:     « InstrumentValue:         0.00000000 COPE »
                        Deposited: « InstrumentValue:         0.00000000 COPE » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 COPE » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [8] FTT
                    Net Value:     « InstrumentValue:         0.00000000 FTT »
                        Deposited: « InstrumentValue:         0.00000000 FTT » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 FTT » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [9] ADA
                    Net Value:     « InstrumentValue:         0.00000000 Cardano »
                        Deposited: « InstrumentValue:         0.00000000 Cardano » (raw value: 0)
                        Borrowed:  « InstrumentValue:         0.00000000 Cardano » (raw value 0)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount
                            Base Position: « InstrumentValue:         0.00000000 Cardano »
                            Quote Position: 0E-20
                            Long Settled Funding: 0E-20
                            Short Settled Funding: 0E-20
                            Bids Quantity: 1
                            Asks Quantity: 0
                            Taker Base: 0
                            Taker Quote: 0
                            MNGO Accrued: « InstrumentValue:         0.00000000 MNGO »
                            OpenOrders:
                                « PerpOpenOrders
                                    Orders:
                                        « PlacedOrder BUY [186330561888540172549656] 1644310038812 »
                                »
                        »
                »
                « AccountSlot [10] MSOL
                    Net Value:     « InstrumentValue:         0.00000000 MSOL »
                        Deposited: « InstrumentValue:         0.00000000 MSOL » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 MSOL » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [11] BNB
                    Net Value:     « InstrumentValue:         0.00000000 BNB »
                        Deposited: « InstrumentValue:         0.00000000 BNB » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 BNB » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [12] AVAX
                    Net Value:     « InstrumentValue:         0.00000000 AVAX »
                        Deposited: « InstrumentValue:         0.00000000 AVAX » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 AVAX » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
                « AccountSlot [13] LUNA
                    Net Value:     « InstrumentValue:         0.00000000 LUNA »
                        Deposited: « InstrumentValue:         0.00000000 LUNA » (raw value: 0E-20)
                        Borrowed:  « InstrumentValue:         0.00000000 LUNA » (raw value 0E-20)
                    Spot OpenOrders: None
                    Perp Account:
                        « PerpAccount (empty) »
                »
        »
»

[Doc] Starting devnet

Hi, I'm attempting to launch a devnet group, but the commands keep failing and im not sure why. I'm very new to this product and im simply trying to run the market maker on the devnet. Is there any definitive instruction for newcomers in the form of 1, 2, 3? I've installed solana and created the wallets on devnet. I just cant get this to run.

Also, the fees vault is missing from the README for the instruction to add USDC

yarn launch-realistic-group
yarn run v1.22.15
$ ts-node test/initRealisticDevnetGroup.ts
starting
new group initialized
adding MNGO oracle
listing and adding MNGO spot market
Error: Command failed: yarn cli add-spot-market devnet.2 MNGO Bb9bsTQa1bGEtQ5KagGkvSHyuLqDWumFUcRqFusFNJWC --base_lot_size 1000000 --quote_lot_size 100 --init_leverage 1.25 --maint_leverage 2.5 --liquidation_fee 0.2
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market devnet.2 MNGO Bb9bsTQa1bGEtQ5KagGkvSHyuLqDWumFUcRqFusFNJWC --base_lot_size 1000000 --quote_lot_size 100 --init_leverage 1.25 --maint_leverage 2.5 --liquidation_fee 0.2'
}
---
adding BTC oracle
listing and adding BTC spot market
Error: Command failed: yarn cli add-spot-market devnet.2 BTC 3UNBZ6o52WTWwjac2kPUb4FyodhU1vFkRJheu1Sh2TvU --base_lot_size 100 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market devnet.2 BTC 3UNBZ6o52WTWwjac2kPUb4FyodhU1vFkRJheu1Sh2TvU --base_lot_size 100 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05'
}
adding BTC perp market
Error: Command failed: yarn cli add-perp-market devnet.2 BTC --init_leverage 10 --maint_leverage 20 --liquidation_fee 0.025 --base_lot_size 100 --quote_lot_size 10
cli.ts add-perp-market <group> <symbol>

add a perp market to the group

Positionals:
  group   the mango group name 🥭                            [string] [required]
  symbol  the base token symbol                              [string] [required]

Options:
  --help                  Show help                                    [boolean]
  --version               Show version number                          [boolean]
  --maint_leverage                                        [number] [default: 20]
  --init_leverage                                         [number] [default: 10]
  --liquidation_fee                                    [number] [default: 0.025]
  --maker_fee                                              [number] [default: 0]
  --taker_fee                                         [number] [default: 0.0005]
  --base_lot_size                                        [number] [default: 100]
  --quote_lot_size                                        [number] [default: 10]
  --max_num_events                                       [number] [default: 256]
  --rate                                                   [number] [default: 1]
  --max_depth_bps                                        [number] [default: 200]
  --target_period_length                                [number] [default: 3600]
  --mngo_per_period                                        [number] [default: 0]
  --exp                                                    [number] [default: 2]
  --cluster               the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config                the config file to store all public keys
                                                              [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair               the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: Unable to find symbol: MNGO in GroupConfig
    at Object.getTokenBySymbol (/Users/person/Documents/mango/mango-client-v3/src/config.ts:240:11)
    at Object.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/commands/addPerpMarket.ts:48:19)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/commands/addPerpMarket.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-perp-market devnet.2 BTC --init_leverage 10 --maint_leverage 20 --liquidation_fee 0.025 --base_lot_size 100 --quote_lot_size 10'
}
---
adding ETH oracle
listing and adding ETH spot market
Error: Command failed: yarn cli add-spot-market devnet.2 ETH Cu84KB3tDL6SbFgToHMLYVDJJXdJjenNzSKikeAvzmkA --base_lot_size 1000 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market devnet.2 ETH Cu84KB3tDL6SbFgToHMLYVDJJXdJjenNzSKikeAvzmkA --base_lot_size 1000 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05'
}
---
adding SOL oracle
^C
person@al-hustle-mac mango-client-v3 % 
person@al-hustle-mac mango-client-v3 % 
person@al-hustle-mac mango-client-v3 % yarn launch-realistic-group
yarn run v1.22.15
$ ts-node test/initRealisticDevnetGroup.ts
starting
new group initialized
adding MNGO oracle
listing and adding MNGO spot market
Error: Command failed: yarn cli add-spot-market me.devnet.3 MNGO Bb9bsTQa1bGEtQ5KagGkvSHyuLqDWumFUcRqFusFNJWC --base_lot_size 1000000 --quote_lot_size 100 --init_leverage 1.25 --maint_leverage 2.5 --liquidation_fee 0.2
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market me.devnet.3 MNGO Bb9bsTQa1bGEtQ5KagGkvSHyuLqDWumFUcRqFusFNJWC --base_lot_size 1000000 --quote_lot_size 100 --init_leverage 1.25 --maint_leverage 2.5 --liquidation_fee 0.2'
}
---
adding BTC oracle
listing and adding BTC spot market
Error: Command failed: yarn cli add-spot-market me.devnet.3 BTC 3UNBZ6o52WTWwjac2kPUb4FyodhU1vFkRJheu1Sh2TvU --base_lot_size 100 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market me.devnet.3 BTC 3UNBZ6o52WTWwjac2kPUb4FyodhU1vFkRJheu1Sh2TvU --base_lot_size 100 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05'
}
adding BTC perp market
Error: Command failed: yarn cli add-perp-market me.devnet.3 BTC --init_leverage 10 --maint_leverage 20 --liquidation_fee 0.025 --base_lot_size 100 --quote_lot_size 10
cli.ts add-perp-market <group> <symbol>

add a perp market to the group

Positionals:
  group   the mango group name 🥭                            [string] [required]
  symbol  the base token symbol                              [string] [required]

Options:
  --help                  Show help                                    [boolean]
  --version               Show version number                          [boolean]
  --maint_leverage                                        [number] [default: 20]
  --init_leverage                                         [number] [default: 10]
  --liquidation_fee                                    [number] [default: 0.025]
  --maker_fee                                              [number] [default: 0]
  --taker_fee                                         [number] [default: 0.0005]
  --base_lot_size                                        [number] [default: 100]
  --quote_lot_size                                        [number] [default: 10]
  --max_num_events                                       [number] [default: 256]
  --rate                                                   [number] [default: 1]
  --max_depth_bps                                        [number] [default: 200]
  --target_period_length                                [number] [default: 3600]
  --mngo_per_period                                        [number] [default: 0]
  --exp                                                    [number] [default: 2]
  --cluster               the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config                the config file to store all public keys
                                                              [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair               the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: Unable to find symbol: MNGO in GroupConfig
    at Object.getTokenBySymbol (/Users/person/Documents/mango/mango-client-v3/src/config.ts:240:11)
    at Object.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/commands/addPerpMarket.ts:48:19)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/commands/addPerpMarket.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-perp-market me.devnet.3 BTC --init_leverage 10 --maint_leverage 20 --liquidation_fee 0.025 --base_lot_size 100 --quote_lot_size 10'
}
---
adding ETH oracle
listing and adding ETH spot market
Error: Command failed: yarn cli add-spot-market me.devnet.3 ETH Cu84KB3tDL6SbFgToHMLYVDJJXdJjenNzSKikeAvzmkA --base_lot_size 1000 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market me.devnet.3 ETH Cu84KB3tDL6SbFgToHMLYVDJJXdJjenNzSKikeAvzmkA --base_lot_size 1000 --quote_lot_size 10 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05'
}
---
adding SOL oracle
listing and adding SOL spot market
Error: Command failed: yarn cli add-spot-market me.devnet.3 SOL So11111111111111111111111111111111111111112 --base_lot_size 100000000 --quote_lot_size 100 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market me.devnet.3 SOL So11111111111111111111111111111111111111112 --base_lot_size 100000000 --quote_lot_size 100 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05'
}
---
adding SRM oracle
listing and adding SRM spot market
Error: Command failed: yarn cli add-spot-market me.devnet.3 SRM AvtB6w9xboLwA145E221vhof5TddhqsChYcx7Fy3xVMH --base_lot_size 100000 --quote_lot_size 100 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market me.devnet.3 SRM AvtB6w9xboLwA145E221vhof5TddhqsChYcx7Fy3xVMH --base_lot_size 100000 --quote_lot_size 100 --init_leverage 5 --maint_leverage 10 --liquidation_fee 0.05'
}
---
adding RAY oracle
listing and adding RAY spot market
Error: Command failed: yarn cli add-spot-market me.devnet.3 RAY 3YFQ7UYJ7sNGpXTKBxM3bYLVxKpzVudXAe4gLExh5b3n --base_lot_size 100000 --quote_lot_size 100 --init_leverage 3 --maint_leverage 6 --liquidation_fee 0.0833
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market me.devnet.3 RAY 3YFQ7UYJ7sNGpXTKBxM3bYLVxKpzVudXAe4gLExh5b3n --base_lot_size 100000 --quote_lot_size 100 --init_leverage 3 --maint_leverage 6 --liquidation_fee 0.0833'
}
---
adding USDT oracle
listing and adding USDT spot market
Error: Command failed: yarn cli add-spot-market me.devnet.3 USDT DAwBSXe6w9g37wdE2tCrFbho3QHKZi4PjuBytQCULap2 --base_lot_size 1000000 --quote_lot_size 100 --init_leverage 10 --maint_leverage 20 --liquidation_fee 0.025
cli.ts add-spot-market <group> <symbol> <mint_pk>

add a spot market to the group

Positionals:
  group    the mango group name 🥭                           [string] [required]
  symbol   the base token symbol                             [string] [required]
  mint_pk  the public key of the base token mint             [string] [required]

Options:
  --help             Show help                                         [boolean]
  --version          Show version number                               [boolean]
  --market_pk        the public key of the spot market    [string] [default: ""]
  --base_lot_size    Lot size of the base mint           [number] [default: 100]
  --quote_lot_size   Lot size of the quote mint           [number] [default: 10]
  --maint_leverage                                        [number] [default: 10]
  --init_leverage                                          [number] [default: 5]
  --liquidation_fee                                     [number] [default: 0.05]
  --optimal_util     optimal utilization interest rate param
                                                         [number] [default: 0.7]
  --optimal_rate     optimal interest rate param        [number] [default: 0.06]
  --max_rate         max interest rate param             [number] [default: 1.5]
  --cluster          the cluster to connect to
                              [choices: "devnet", "mainnet"] [default: "devnet"]
  --config           the config file to store all public keys [string] [default:
  "/Users/person/Documents/mango/mango-client-v3/src/ids.json"]
  --keypair          the keypair used to sign all transactions
          [string] [default: "/Users/person/.config/solana/devnet.json"]

Error: {"InstructionError":[2,{"Custom":1}]}
    at MangoClient.<anonymous> (/Users/person/Documents/mango/mango-client-v3/src/client.ts:282:15)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/person/Documents/mango/mango-client-v3/src/client.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'yarn cli add-spot-market me.devnet.3 USDT DAwBSXe6w9g37wdE2tCrFbho3QHKZi4PjuBytQCULap2 --base_lot_size 1000000 --quote_lot_size 100 --init_leverage 10 --maint_leverage 20 --liquidation_fee 0.025'
}
---
Succcessfully created new mango group.
✨  Done in 90.10s.

Bug in prependFeePrioritizationIx compute units

In prependFeePrioritizationIx in https://github.com/blockworks-foundation/mango-client-v3/blame/main/src/utils/utils.ts, which was added by this PR #101 you set the requested units in the ComputeBudgetProgram instruction to 200000 * transaction.instructions.length + 1. Surely there should be parentheses, making it 200000 * (transaction.instructions.length + 1). Ie, for a transaction that had 1 instruction before prepending the fee prioritization instruction, we should have 200_000 * (1 + 1) = 400_000 units, rather than 200_001 units?

version installed doesn't match the examples/docs

npm install @blockworks-foundation/mango-client and yarn add @blockworks-foundation/mango-client both download version 2.2.1, whose directory structure only has lib/ and no src/, whereas all the examples and docs (eg. https://docs.mango.markets/developer-resources/code-examples#subscribe-to-an-order-book) import from src.

I had to manually specify the recent version: yarn add @blockworks-foundation/[email protected].
I think the npm package should be updated.

Using the PerpAccount class

Hi,

I am trying to use getAverageOpenPrice() function of the PerpAccount class, but I am missing some documentation / examples. What exactly is the events argument? Is there perhaps some other way of getting the "Avg Entry Price" that is displayed on the Web UI of the exchange?

Thanks for your help in advance!

subscribe to spot fills classes/methods are missing

Hello,

in the example for 'subscribe-to-fills.ts', its described how to subscribe to fills for the perpMarket.
For the spotMarket, the classes SpotEventQueue and SpotEventQueueLayout are missing.

For my case i solved it this way:

    connection.onAccountChange(spotMarketConfig.eventsKey, (accountInfo, context) => {
        let events = decodeEventQueue(accountInfo.data, 100)
            .filter(
                (event) => event.eventFlags.fill && event.nativeQuantityPaid.gtn(0),
            );
        if(events.length > 0){
            console.log(events);
            ...
        }
    });

But i think a build in Mango Solution would be the best.

Could not find a declaration file for module 'buffer-layout'

The buffer-layout package does not provide types nor does it have types available as @types/buffer-layout in the DefinitelyTyped project. This results in a compilation error when using @blockworks-foundation/mango-client in a TypeScript project with strict compiler settings:

Could not find a declaration file for module 'buffer-layout'. '<my project path>/node_modules/buffer-layout/lib/Layout.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/buffer-layout` if it exists or add a new declaration (.d.ts) file containing `declare module 'buffer-layout';`

import { Blob, Layout, Structure, UInt, Union } from 'buffer-layout';

Adding a declaration declare module 'buffer-layout' like the error suggests leads to other difficult-to-diagnose type errors.

Thankfully the folks over at Solana Labs have created their own well-typed fork of buffer-layout and are rolling it out into their own published packages.

Could this library switch to using that fork too?

A temporary workaround that worked for me is suggested here: set "noImplicitAny": false in tsconfig.json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.