Untuk memenuhi berbagai kebutuhan trading pengguna, CoinEx kini mendukung fungsionalitas terkait API P2P. Detailnya sebagai berikut:
Panduan Penggunaan API P2P CoinEx
1. Pengguna Sasaran
Setiap pengguna yang telah menyelesaikan verifikasi ID pedagang P2P di CoinEx.
Jika Anda belum menjadi pedagang terverifikasi, Anda perlu mengajukan status pedagang P2P di halaman P2P sebelum menggunakan layanan API.
2. Efisiensi Eksekusi dan Konten
Bagi pengguna yang beroperasi melalui layanan API, efisiensi pengambilan informasi dan eksekusi permintaan identik dengan yang ada di antarmuka CoinEx. Namun, konten yang dikembalikan mungkin terpotong karena batasan field.
3. Modul yang Didukung
- Manajemen Status Toko P2P
- Manajemen Iklan P2P
- Daftar Iklan Pengguna P2P
- Daftar Iklan Pasar P2P
- Daftar Pesanan P2P
- Modifikasi Harga Iklan P2P
- Data Kedalaman Pasar P2P
Dokumentasi Endpoint API P2P
Silakan kunjungi Dokumentasi API Publik CoinEx untuk autentikasi sebelum menggunakan endpoint di bawah ini.
1. Manajemen Status Toko P2P
Info Endpoint
- URL Path: /v2/p2p/exchange-status
- Metode Permintaan: POST
- Deskripsi: Mengatur status bisnis toko P2P (Buka atau Tutup)
- Izin: Membutuhkan autentikasi
Parameter Permintaan
Body Permintaan:
| Parameter | Required | Type | Description |
| status | Yes | String | Shop status, options: OPEN or CLOSED |
Contoh Permintaan:
POST /v2/p2p/exchange-status HTTP/1.1
Host: api.coinex.com
Content-Type: application/json
{
"status": "OPEN"
}
Parameter Respons
| Parameter | Type | Description |
| status | String | The set shop status, OPEN or CLOSED |
Contoh Respons
{
"code": 0,
"message": "OK",
"data": {
"status": "OPEN"
}
}
2. Manajemen Iklan P2P
Info Endpoint
- URL Path: /v2/p2p/manage-ads
- Metode Permintaan: POST
- Deskripsi: Mengelola iklan P2P secara batch (Online atau Offline)
- Izin: Membutuhkan autentikasi
Parameter Permintaan
| Parameter | Required | Type | Description |
| status | Yes | String | Operation type, options: ONLINE or OFFLINE |
| ad_ids | No | Array[String] | List of ad IDs; if not provided, all eligible ads will be operated on |
Contoh Permintaan
POST /v2/p2p/manage-ads HTTP/1.1
Host: api.coinex.com
Content-Type: application/json
{
"status": "ONLINE",
"ad_ids": ["5f7c8b9d1a2b3c4d5e6f7g8h", "5f7c8b9d1a2b3c4d5e6f7g9i"]
}
Parameter Respons
| Parameter | Type | Description |
| affected_ad_ids | Array[String] | List of successfully operated ad IDs |
Contoh Respons
{
"code": 0,
"message": "OK",
"data": {
"affected_ad_ids": ["5f7c8b9d1a2b3c4d5e6f7g8h", "5f7c8b9d1a2b3c4d5e6f7g9i"]
}
}
3. Daftar Iklan Pengguna P2P
Info Endpoint
- URL Path: /v2/p2p/ads
- Metode Permintaan: GET
- Deskripsi: Mengambil semua iklan dari pengguna saat ini
- Izin: Membutuhkan autentikasi
Parameter Permintaan
Tidak ada
Contoh Permintaan
GET /v2/p2p/ads HTTP/1.1
Host: api.coinex.com
Parameter Respons
Mengembalikan array objek iklan. Setiap objek iklan berisi field berikut:
| Parameter | Type | Description |
| ad_id | String | Ad ID |
| created_at | Number | Creation time (in milliseconds) |
| updated_at | Number | Update time (in milliseconds) |
| ad_number | String | Ad number |
| ad_side | String | Ad direction, BUY or SELL |
| base_ccy | String | Base currency |
| quote_ccy | String | Quote currency |
| price | String | Price |
| available_amount | String | Available amount |
| quote_min_limit | String | Min. trade limit (quote currency) |
| quote_max_limit | String | Max. trade limit (quote currency) |
| status | String | Ad status, options: ONLINE or OFFLINE |
Contoh Respons
{
"code": 0,
"message": "OK",
"data": [
{
"ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
"created_at": 1618456789000,
"updated_at": 1618456789000,
"ad_number": "AD123456789",
"ad_side": "BUY",
"base_ccy": "BTC",
"quote_ccy": "CNY",
"price": "200000",
"available_amount": "0.5",
"quote_min_limit": "500",
"quote_max_limit": "50000",
"status": "ONLINE"
},
{
"ad_id": "5f7c8b9d1a2b3c4d5e6f7g9i",
"created_at": 1618456790000,
"updated_at": 1618456790000,
"ad_number": "AD123456790",
"ad_side": "SELL",
"base_ccy": "ETH",
"quote_ccy": "CNY",
"price": "10000",
"available_amount": "5",
"quote_min_limit": "200",
"quote_max_limit": "20000",
"status": "OFFLINE"
}
]
}
4. Daftar Iklan Pasar P2P
Info Endpoint
- URL Path: /v2/p2p/market/ads
- Metode Permintaan: GET
- Deskripsi: Mengambil daftar iklan pasar P2P
- Izin: Tidak membutuhkan autentikasi
Parameter Permintaan
| Parameter | Required | Type | Description |
| base_ccy | Yes | String | Base currency |
| quote_ccy | Yes | String | Quote currency |
| order_side | Yes | String | Order side, opposite to the ad direction, options: BUY or SELL |
| target_quote_amount | No | Decimal | Target transaction amount (quote currency) |
| sort_by | No | String | Sorting field, default is PRICE, options: COMPLETION_RATE, DEAL_COUNT, ACCEPTANCE_RATE |
| sort_type | No | String | Sorting type, ASC (ascending) or DESC (descending), default is ASC |
| page | No | Integer | Page number, default is 1 |
| limit | No | Integer | Number of items displayed per page, default is 10 |
Contoh Permintaan
GET /v2/p2p/market/ads?base_ccy=BTC"e_ccy=CNY&order_side=BUY&page=1&limit=10 HTTP/1.1
Host: api.coinex.com
Parameter Respons
| Parameter | Type | Description |
| data | Array | List of ads, each structure is the same as the user ad list |
| pagination | Object | Pagination info |
| pagination.total | Integer | Total number of records |
| pagination.has_next | Boolean | Indicates if there is a next page |
Contoh Respons
{
"code": 0,
"message": "OK",
"data": [
{
"ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
"created_at": 1618456789000,
"updated_at": 1618456789000,
"ad_number": "AD123456789",
"ad_side": "BUY",
"base_ccy": "BTC",
"quote_ccy": "CNY",
"price": "200000",
"available_amount": "0.5",
"quote_min_limit": "500",
"quote_max_limit": "50000",
"status": "ONLINE"
},
],
"pagination": {
"total": 50,
"has_next": true
}
}
5. Daftar Pesanan P2P
Info Endpoint
- URL Path: /v2/p2p/order
- Metode Permintaan: GET
- Deskripsi: Mengambil daftar pesanan P2P pengguna
- Izin: Membutuhkan autentikasi
Parameter Permintaan
| Parameter | Required | Type | Description |
| start_time | No | Number | Start time (milliseconds timestamp) |
| end_time | No | Number | End time (milliseconds timestamp) |
| ad_side | No | String | Ad side, BUY or SELL |
| quote_ccy | No | String | Quote currency |
| status | No | string | Order status |
| page | No | Integer | Page number, default is 1 |
| limit | No | Integer | Number of items displayed per page, default is 10 |
Contoh Permintaan
GET /v2/p2p/order?start_time=1618456789000&end_time=1618556789000&status=CREATED&page=1&limit=10 HTTP/1.1
Host: api.coinex.com
Parameter Respons
| Parameter | Type | Description |
| data | Array | List of orders |
| pagination | Object | Pagination info |
| pagination.total | Integer | Total number of records |
| pagination.has_next | Boolean | Indicates if there is a next page |
Setiap objek pesanan (order) berisi field berikut:
| Parameter | Type | Description |
| order_id | Integer | Order ID |
| order_num | String | Order number |
| ad_id | String | Ad ID |
| status | String | Order status, options: CREATED, CONFIRMED, PAID, FINISHED, CANCELED |
| created_at | Number | Creation time (milliseconds timestamp) |
| finished_at | Number | Completion time (milliseconds timestamp) |
| confirm_due_at | Number | Confirmation due time (milliseconds timestamp) |
| payment_due_at | Number | Payment due time (milliseconds timestamp) |
| order_side | String | Order side, BUY or SELL |
| price | String | Price |
| base_ccy | String | Base currency |
| base_ccy_amount | String | Base currency amount |
| quote_ccy | String | Quote currency |
| quote_ccy_amount | String | Quote currency amount |
| cancel_type | String | Cancellation types, options: CONFIRM_TIMEOUT (Merchant failed to confirm within the time limit), MERCHANT_CREATED_CANCEL (Merchant declined the order), CUSTOMER_CREATED_CANCEL (User canceled before accepting the order), PAY_TIMEOUT (Buyer failed to make payment within the time limit), BUYER_CANCEL (Buyer canceled the order), SERVICE_CANCEL (Customer support manually canceled the order), SYSTEM_CANCEL (System automatically canceled the order). |
Contoh Respons
{
"code": 0,
"message": "OK",
"data": [
{
"order_id": 12345,
"order_num": "P2P123456789",
"ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
"status": "FINISHED",
"created_at": 1618456789000,
"finished_at": 1618466789000,
"confirm_due_at": 1618476789000,
"payment_due_at": 1618486789000,
"order_side": "BUY",
"price": "200000",
"base_ccy": "BTC",
"base_ccy_amount": "0.1",
"quote_ccy": "CNY",
"quote_ccy_amount": "20000",
"cancel_type": ""
},
],
"pagination": {
"total": 25,
"has_next": true
}
}
6. Modifikasi Harga Iklan P2P
Info Endpoint
- URL Path: /v2/p2p/ad/modify-price
- Metode Permintaan: POST
- Deskripsi: Modifikasi harga iklan P2P
- Izin: Membutuhkan autentikasi
Parameter Permintaan
| Parameter | Required | Type | Description |
| ads | Yes | Array | Array of ad modification details |
Setiap elemen dalam array ads berisi field berikut:
| Parameter | Required | Type | Description |
| ad_id | Yes | String | Ad ID |
| price | Yes | Decimal | New price |
Contoh Permintaan
POST /v2/p2p/modify-ads HTTP/1.1
Host: api.coinex.com
Content-Type: application/json
{
"ads": [
{
"ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
"price": "210000"
},
{
"ad_id": "5f7c8b9d1a2b3c4d5e6f7g9i",
"price": "11000"
}
]
}
Parameter Respons
Respons mengembalikan sebuah array hasil untuk setiap iklan yang dimodifikasi.
Setiap elemen berisi field berikut:
| Parameter | Type | Description |
| code | Integer | Result code, 0 indicates success |
| message | String | Result message |
| data | Object | Updated ad information on success, null on failure |
Contoh Respons
{
"code": 0,
"message": "OK",
"data": [
{
"code": 0,
"message": "OK",
"data": {
"ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
"created_at": 1618456789000,
"updated_at": 1618556789000,
"ad_number": "AD123456789",
"ad_side": "BUY",
"base_ccy": "BTC",
"quote_ccy": "CNY",
"price": "210000",
"available_amount": "0.5",
"quote_min_limit": "500",
"quote_max_limit": "50000",
"status": "ONLINE"
}
},
{
"code": 11002,
"message": "adv not exists",
"data": null
}
]
}
7. Data Kedalaman Pasar P2P
Info Endpoint
- URL Path: /v2/p2p/market/depth
- Metode Permintaan: GET
- Deskripsi: Mendapatkan data kedalaman pasar P2P
- Izin: Tidak membutuhkan autentikasi
Parameter Permintaan
Query Parameters:
| Parameter | Required | Type | Description |
| base_ccy | Yes | String | Base currency |
| quote_ccy | Yes | String | Quote currency |
Contoh Permintaan
GET /v2/p2p/market/depth?base_ccy=BTC"e_ccy=CNY HTTP/1.1
Host: api.coinex.com
Parameter Respons
| Parameter | Type | Description |
| base_ccy | String | Base currency |
| quote_ccy | String | Quote currency |
| index_price | String | Index price |
| depth | Object | Depth data |
| depth.bids | Array | Depth data |
| depth.asks | Array | Sell order depth |
Setiap elemen dalam array depth berisi field berikut:
| Parameter | Type | Description |
| price | String | Price |
| amount | String | Amount |
Contoh Respons
{
"code": 0,
"message": "OK",
"data": {
"base_ccy": "BTC",
"quote_ccy": "CNY",
"index_price": "200000",
"depth": {
"bids": [
{
"price": "199000",
"amount": "1.5",
},
{
"price": "198000",
"amount": "2.0",
}
],
"asks": [
{
"price": "201000",
"amount": "1.0",
},
{
"price": "202000",
"amount": "1.8",
},
]
}
}
}