# What is the Bancor algorithm and how it is used for RAM trading?

In simple terms, what is the Bancor algorithm, and how does it work? In particular, how is it use to trade RAM?

Traditionally, price discovery is achieved through buying and selling with bids and asks. Liquidity, or the relative ability to move larger sums of assets with low price slippage, was created by market makers, or large financial institutions who's job it is to continue buying and selling.

Bancor's price discovery is dictated by a formula. This effectively removes the need for market makers to exist. The Bancor algorithm is always available to trade with and will show you the guaranteed price of your order (no matter how large..) before you place it. The formula for price is below.

When you buy, you're buying from the contract. When you sell, you sell to the contract. There is not another person, also known as a counter party, that is picking up the other end of your trade. In buying, you pay EOS and get RAMCORE tokens which entitle you to store as much RAM as your RAMCORE tokens allow:

( ( RAMCORE held / Total RAMCORE supply ) * Total RAM bytes available )

Your EOS is added to the connector balance and the RAMCORE tokens are created on the spot and added to the outstanding supply. The opposite occurs when you sell your RAMCORE token thus effectively releasing your right to occupy that RAM. Your EOS given to you is deducted from the connector balance and the RAMCORE tokens are destroyed.

Connector balance = how much EOS is held in reserve to conduct trading

Smart Token's outstanding supply = Total RAMCORE tokens (100 trillion (with 4 decimal places comes to 10B)

Smart Token’s total value = price × Smart Token supply (10 billion RAMCORE)

You can find the connector weight by going:

``````cleos -u https://nodes.get-scatter.com:443 get table eosio eosio rammarket

{
"rows": [{
"supply": "10000000000.0000 RAMCORE",
"base": {
"balance": "11870290976 RAM",
"weight": "0.50000000000000000"
},
"quote": {
"balance": "5789275.3804 EOS",
"weight": "0.50000000000000000"
}
}
],
"more": false
}
``````

More on CW:

"The CW is expressed as a percentage greater than 0% and up to 100%, and as mentioned, is initially set by the creator when a Smart Token is configured. The value chosen for the CW has significant implications for the pricing of the token"

The higher the CW % the less volatility there is. The reason the CW exists is to prevent the reserve value of EOS tokens from being depleted, i.e., the price lowers drastically as the supply goes down to prevent others from being able to receive value from selling as they will receive less and less. Here is a photo that illustrates some of the CW rates and their corresponding affect on price as supply reaches 100%.

## How many EOS you will get back for your RAMCORE when you sell:

Bonus Spreadsheet from Bancor with all the formulas