Crypfi Documentation
  • What is Crypfi Exchange
  • Welcome
    • Crypfi Contract Address
    • Trading on Crypfi V1
      • Wallet connection
      • How to trade on Crypfi
        • Deposit & Withdrawal
        • Margin Mode & Leverage
        • Order Type
          • TP/SL
          • Limit/Market
        • Closing Positions
  • Features & Tutorials
    • Basics
      • What is gas Fee ?
      • How to Switch Network ?
    • Feature List
  • Market Makers
    • Complete KYC
    • Request API
    • Provide Liquidity
    • Maker/Taker Fees
    • API Documentation
Powered by GitBook
On this page
  1. Features & Tutorials

Feature List

PreviousHow to Switch Network ?NextComplete KYC

Last updated 1 year ago

Margin Type

Isolated

In this mode, your liability is limited to the initial margin posted. In the event of a liquidation, any you may have will not be used to add margin to your position.

Cross

Cross Margin, also known as “Spread Margin” is a margin method that utilizes the full amount of funds in the Available Balance of the relevant cryptocurrency to avoid liquidations on the positions with the same settlement cryptocurrency. Any Realized PNL from other positions can aid in adding margin on a losing position with the same settlement cryptocurrency.

TIme In Force

Good Till time

This is the type of order which a user can choose when they want to keep the order open for a certain time or cancel themselves.

in this they can choose different time frame till which the order remains open or the user cancel themselves

  1. minutes

  2. hours

  3. days

  4. weeks

Fill or Kill

A FOK order, or "Fill or Kill" order, is an order that must be executed in its entirety or not executed at all. If the exchange cannot immediately fill the entire order quantity, the entire order is canceled.

Immediate or cancel

IOC is an order type that requires the Exchange to attempt to execute the order immediately upon submission. If the entire order cannot be filled immediately, any portion of the order that can be executed will be, and the remaining unfilled portion will be canceled

Liquidation Engine

We will be creating a liquidation engine that will be calculating the liquidation price of the position which show at what price the order will be forcefully closed Formula :- For long = Liquidation Price (LP) = [Entry Price × (1 - Initial Margin Rate + Maintenance Margin Rate)] - (Extra Margin Added/ Contract Size) For Short :- Liquidation Price (LP) = [Entry Price × (1 + Initial Margin Rate - Maintenance Margin Rate)] + (Extra Margin Added/ Contract Size) The remaining funds from liquidation goes to insurance fund wallet

When the liquidation price is triggered a market order is placed for that position which needs to be fulfilled by the market makers

Funding rate

The funding rate is a mechanism used to maintain the balance between the market price of the perpetual swap contract and the underlying reference index or spot price of the cryptocurrency. It is essentially an interest rate that is periodically exchanged between traders who are holding long positions (those expecting the price to rise) and traders who are holding short positions (those expecting the price to fall) or vice versa Mark price = Median* (Price 1, Price 2, Contract Price)

Price 1 = Index Price * (1 + Last Funding Rate * (Time Until Funding / 8))

Price 2 = Index Price + Moving Average (30-minute Basis)

Moving Average (30-minute Basis) = Moving Average ((Bid1+Ask1)/2- Index Price), which measures

every minute in 30-minute interval (Same as in Quarterly Contract)

Funding Rate (F) = Premium Index (P) + clamp (0.01% - Premium Index (P), 0.05%, -0.05%)

Funding Amount=Nominal Value of Positions* ×Funding Rate

Nominal Value of Positions = Mark Price x Size of a Contract

Premium Index (P) =Max (0, Impact Bid Price−Spot Price) −Max (0, Spot Price−Impact Ask Price)/Spot

Price

Impact Bid Price=the average fill price to execute the Impact Margin Notional on the Bid Price.

Impact Ask Price=the average fill price to execute the Impact Margin Notional on the Ask Price.

IMN = Total Position

Impact bid/ask Price = IMN / ((IMN - Sum QX-1*PX-1 )/Px + Sum Q X-1 )

impact bid/ask price = 40,000 / ((40,000 - 14456.38)/ 11410.54 + 1.267)

Average Premium Index =

(1*Premium_Index_1+2*Premium_Index_2+3*Premium_Index_3+···+·480*Premium_index_480)/

(1+2+3+···+480)

Place Order – Buy (Limit)

As a user I buy an asset at a desired price

  1. After selection of asset on left side users can enter the amount of asset they want to buy on Bid manager

  2. Users enter the price at which they want to buy the asset

  3. Users clicks on Buy – order will be placed at the said amount and will be pushed to buy side order book.

Cost :- The cost to place order is to be calculated as per below formula

Order Cost = Initial Margin + Fee to Open Position + Fee to Close Position

  • Initial Margin = (Order Price × Order Quantity) / Leverage

  • Fee to Open Position = Order Quantity × Order Price × Taker Fee Rate

  • Fee to Close Position = Order Quantity × Bankruptcy Price × Taker Fee Rate

  • Bankruptcy Price for Long Position = Order Price × ( Leverage − 1) / Leverage

Note : user must have balance in the platform wallet

Place Order – Sell (Limit)

As a user I want to sell my asset at a desired price

  1. After selection of asset on left side users can enter the amount of asset they want to buy on Bid manager

  2. Users enter the price at which they want to buy the asset

  3. Users clicks on Buy – order will be placed at the said amount and will be pushed to buy side order book.

Cost :- The cost to place order is to be calculated as per below formula

Order Cost = Initial Margin + Fee to Open Position + Fee to Close Position

  • Initial Margin = (Order Price × Order Quantity) / Leverage

  • Fee to Open Position = Order Quantity × Order Price × Taker Fee Rate

  • Fee to Close Position = Order Quantity × Bankruptcy Price × Taker Fee Rate

  • Bankruptcy Price for Long Position = Order Price × ( Leverage + 1) / Leverage

Note : user must have balance in the platform wallet

Place Order – Buy (Market)

As a user I buy an asset at Market place Market Price – best available price on sell order book

  1. After selection of assets on the left side users can enter the amount of asset they want to buy on Bid manager.

  2. Users clicks on Buy – order will be matched with the best available price on the sell order book.

Cost :- The cost to place order is to be calculated as per below formula

Order Cost = Initial Margin + Fee to Open Position + Fee to Close Position

  • Initial Margin = (Order Price × Order Quantity) / Leverage

  • Fee to Open Position = Order Quantity × Order Price × Taker Fee Rate

  • Fee to Close Position = Order Quantity × Bankruptcy Price × Taker Fee Rate

  • Bankruptcy Price for Long Position = Order Price × ( Leverage − 1) / Leverage

Note : user must have in the platform wallet

Place Order – Sell (Market)

As a user I sell an asset at Market place Market Price – best available price on buy order book

  1. After selection of asset on left side users can enter the amount of asset they want to sell on Bid manager

  2. Users clicks on sell – order will be matched with the best available price on the buy order book.

Cost :- The cost to place order is to be calculated as per below formula

Order Cost = Initial Margin + Fee to Open Position + Fee to Close Position

  • Initial Margin = (Order Price × Order Quantity) / Leverage

  • Fee to Open Position = Order Quantity × Order Price × Taker Fee Rate

  • Fee to Close Position = Order Quantity × Bankruptcy Price × Taker Fee Rate

  • Bankruptcy Price for Long Position = Order Price × ( Leverage + 1) / Leverage

Note : user must have balance in the platform wallet

Place order - Stop Limit and Stop Market

Here users can place orders for their open positions in order to help them reduce the loss. While placing these order user needs to fill the following

  1. Qty

  2. Trigger Price

  3. Stop Limit (in case of limit ) - it will be empty in case of market order.

Take Profit Limit & Market

This helps users to place odrders for their option position to take the profit automatically. When the defined trigger price arrives an order is placed at the defined price in case of limit and at market price in case of Market . Users will enter the following while making take profit orders

  1. Qty

  2. Trigger Price

  3. Limit (in case of limit ) - it will be empty in case of market order.

Bid Manager

Components of Bid Manager

  1. Limit

  2. Market

  3. Price

  4. Size

  5. Available Balance

  6. Buy/sell Max Amount

  7. Cost to buy/sell

  8. Buy/sell CTA buttons

Order Book

Components of order Book

  1. Selection of type of order book a. Buy/sell – shows both b. Buy – shows only Buy c. Sell- Shows only sell

  2. Price – price at which orders are placed

  3. Size – Quantity of the order

  4. Sum – amount of order in underlying asset – USDT.

The order book for all the chains will be common i.e a user can deposit BNB to BSC and can use that amount to trade on Cronos and withdraw the earnings to Cronos chain

Liquidity Management – in the case of multi chain. Client requested to keep some balance in each chain.

Trade Book

Components of Trade Book

  1. Price

  2. Amount

  3. Time

Color of the trade are decided on the bases of taker

  1. If taker is buying then trade color will be green

  2. If taker is selling then trade color will be red

Position Book

Position tab will consist of following components

  1. Name of the Asset in which position is take eg – BTCUSDT perpetual

  2. Size of the position take eg – 0.1 BTC

  3. Notional Size of the position – total amount of position taken eg- 20 USDT

  4. Margin Ratio

  5. Liquidation Price – the Price at which the position will be closed automatically eg - $20000

  6. Unrealized P&L

  7. Margin – Amount used From the wallet eg – 1 USDT

  8. Entry Price – At which the order is filled eg – 19980 USDT

  9. Mark Price – Weighted average price calculated at backend using formulas

  10. Close Position

Available Balance