example-python-marketmaker/3.MangoAccount.md

2.7 KiB

🥭 Mango Explorer

🥭 Set up a devnet Mango Account

This section is optional - if you know what you're doing please feel free to ignore it

Marketmaking, and buying and selling on Mango more generally, requires a Mango Account. This holds the balances of tokens you've moved to Mango as well as your current perp positions. You can create a Mango Account by running:

ensure-account --cluster-name devnet

In order to use your devnet USDC as collateral for buying and selling perps you need to move it into your Mango Account. To do this, run:

deposit --symbol USDC --quantity 10000 --cluster-name devnet

Now if you check your Mango Account balances using:

show-account-balances --cluster-name devnet

You should see something like:

Token Balances [DWJhP3shiGDTPDpn5F2mKN47MRowpCG63MgMpsZcEMPs]:
               « InstrumentValue:         0.96714968 Pure SOL »
Total Value:   « InstrumentValue:         0.00000000 USDC »

⚠ WARNING! ⚠ This is a work-in-progress and these figures may be wrong!


Account Balances [7tgFpqoUVpc8akBJPRTbKY5w4uGzYtkt51cdGr5fDWQM]:
« AccountInstrumentValues USDC
    Deposited  : « InstrumentValue:    10,000.00000013 USDC »
    Borrowed   : « InstrumentValue:         0.00000000 USDC »
    Unsettled:
      Base     : « InstrumentValue:         0.00000000 USDC » (« InstrumentValue:         0.00000000 USDC » free)
      Quote    : « InstrumentValue:         0.00000000 USDC » (« InstrumentValue:         0.00000000 USDC » free)
    Perp:
      Base     : « InstrumentValue:         0.00000000 USDC »
      Quote    : 0
    If Executed:
      All Bids : « InstrumentValue:         0.00000000 USDC »
      All Asks : « InstrumentValue:         0.00000000 USDC »
    Net Value  : « InstrumentValue:    10,000.00000013 USDC »
»
Account Total: « InstrumentValue:    10,000.00000013 USDC »

Grand Total:   « InstrumentValue:    10,000.00000013 USDC »

A couple of things worth noting from this:

  • The amount of devnet SOL you have has fallen to 0.96714968 SOL. Creating the Mango Account ties up some SOL for Solana's 'rent' but you can reclaim this SOL when you close your Mango Account.
  • The amount of devnet USDC has grown to something like 10,000.00000013 USDC. Interest on balances in Mango Accounts is applied continuously so even the short time it has been in your account that devnet USDC has been hard at work earning interest.

🦮 Support

🥭 Mango Markets support is available at: Docs | Discord | Twitter | Github | Email