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
  • General Info
  • General API Information
  • Market Data Endpoints
  • Test Connectivity
  • Exchange Pair Listing
  • Kline/Candlestick Data
  • Websocket Market Stream
  • Live Connect/Disconnect to Stream
  • Trade Stream
  • Order Book Stream
  • Ticker Info
  • Mark Price and Index Price and Funding Countdown
  • User Active Orders
  • User Active Positions & PNL
  1. Market Makers

API Documentation

___________________________________________________________________________________

General Info

General API Information

  • Some endpoints will require an API Key.

  • The base endpoint is: //Exchange_Domain

  • All endpoints return either a JSON object or array.

  • Data is returned in descending order. Oldest last, newest first.

General Information of Endpoints

  • For GET endpoints, parameters must be sent as a query string.

  • For POST, PUT, and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded or application/json. You may mix parameters between both the query string and request body if you wish to do so.

  • Parameters may be sent in any order.

_______________________________________________________________________________________________________

Market Data Endpoints

Test Connectivity

Test Connectivity

GET /api/ping

Pair Listing

Exchange Pair Listing

GET /api/orders/v1/order/user/pair_list

Kline/Candlestick Data

Kline/Candlestick Data

GET /api/orders/v1/order/kline/history

Query Parameters

Name
Type
Description

interval*

String

pairName*

String

fromDate*

Miliseconds

toDate*

Miliseconds

Websocket Market Stream

  • The baseurl for websocket is wss://domain_name

  • All symbols for streams are lowercase

  • A single connection is only valid for 24 hours; expect to be disconnected at the 24 hour mark

  • Considering the possible data latency from RESTful endpoints during an extremely volatile market, it is highly recommended to get the order status, position, etc from the Websocket user data stream.

Live Connect/Disconnect to Stream

  • The following data can be sent through the websocket instance in order to connect/disconnect from streams. Examples can be seen below.

Connect to a stream

// Stream {Event: "CurrentPair"}
// Request {
    "pair": "matic_usdt"o
    "chainId": 80001
}
// Response {
    "buyOrderBook": [],
    "sellOrderBook": [],
    "trades": []
}

Disconnect to a stream

// Stream {Event: "Unsubscribe"}
// Request {
    "pair": "matic_usdt"
    "chainId": 80001
}

Trade Stream

// Stream {Event: "<Market>_TRADE_ORDERBOOK"}
// Request {}
// Response {
    "filled_amount": 4,
    "side": 1,
    "total": 12,
    "price": 3,
    "buyerPrice": 3,
    "sellerPrice": 3,
    "created_at": "2023-09-07T10:21:59.250Z"
}

Order Book Stream

New and Update Buy Order

// Stream {Event: "<Market>_BUY_ORDERBOOK"}
// Request {}
// Response {
    "price": 4,
    "quantity": 2,
}

New and Update Sell Order

// Stream {Event: "<Market>_SELL_ORDERBOOK"}
// Request {}

Remove Buy/Sell Order

// Event {Event: "<Market>_CANCEL_ORDER"}
// Request {}
// Response {
    "id": 24,
    "price": 2,
    "quantity": 3,
    "total": 6,
    "side": 0
}

Ticker Info

// Stream {Event: "allStat"}
// Request {}zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
// Response {
    "high": 23,
    "volume": 32,
    "low": 12,
    "open": 12,
    "close": 23,
    "change": 11,
    "lastPrice": 23,
    "close_24hour": 12,
    "volumeCoin": 57.41225199231547,
    "pairName": "matic_usdt",
    "markPrice": 0.557114,
    "indexPrice": 0.55733,
    "fundingRate": 0.550407
}

Mark Price and Index Price and Funding Countdown

// Stream {Event: "funding_rate_countdown"}
// Request {}
// Response {
	"funding_rate_countdown": "06:13:50",
	"futurePrices": {
		"MATICUSDT": {
			"INDEX_PRICE": 0.55733,
			"MARK_PRICE": 0.557114,
			"FUNDING_RATE": 0.550407
		}
	}
}

User Active Orders

// Stream {Event: "<Market>_ACTIVE_ORDERS"}
// Request {}
// Response {
    "price": 2,
    "quantity": 3,
    "total": 6,
    "userId": 76,
    "id": 24,
    "executed_price": 0,
    "filled_amount": 0,
    "side": 0,
    "type": 0,
    "trigger_price": 2,
    "created_at": "2023-09-07T09:52:39.228Z"
}

User Active Positions & PNL

// Stream {Event: "<Market>_TRADE_ORDER_POSITION_BOOK"}
// Request {}
// Response {
	"postions": [
		{
			"id": 12,
			"side": 0,
			"user_id": 76,
			"pair": "matic_usdt",
			"quantity": 2,
			"price": 2,
			"order_size": 2,
			"liquidation_price": 1.8,
			"margin_mode": "ISOLATED",
			"leverage": 9,
			"status": 1,
			"created_at": "2023-09-07T09:52:40.000Z"
		}
	],
	"userpnl": 0
}

PreviousMaker/Taker Fees

Last updated 1 year ago