# API規格文件
## 目錄
- [多語系](#多語系)
- [設定語系](#設定語系)
- [檢查當前語系](#檢查當前語系)
- [註冊頁](#註冊頁)
- [取得驗證碼](#取得驗證碼)
- [檢查驗證碼](#檢查驗證碼)
- [註冊帳號](#註冊帳號)
- [登入頁](#登入頁)
- [取得驗證碼](#登入-取得驗證碼)
- [檢查驗證碼](#登入-檢查驗證碼)
- [登入](#登入)
- [登出](#登出)
- [忘記密碼頁](#忘記密碼頁)
- [取得驗證碼](#忘記密碼-取得驗證碼)
- [檢查驗證碼](#忘記密碼-檢查驗證碼)
- [忘記密碼](#忘記密碼)
- [現貨紀錄頁(必須先登入)](#現貨紀錄頁(必須先登入))
- [列表](#列表)
- [合約紀錄頁(必須先登入)](#合約紀錄頁(必須先登入))
- [列表](#列表)
- [電子帳單頁(必須先登入)](#電子帳單頁(必須先登入))
- [總帳單](#總帳單)
- [現貨](#現貨)
- [合約](#合約)
- [總盈利](#總盈利)
---
### 多語系
#### 設定語系
<span style="color:red">[GET]</span> /language/{locale} (目前只支援"en", "zh_TW")
```
data: {
}
repsonse: {
"zh_TW"
}
```
#### 檢查當前語系
<span style="color:red">[GET]</span> /language/check
```
data: {
}
repsonse: {
"zh_TW"
}
```
### 註冊頁
#### 取得驗證碼
<span style="color:red">[POST]</span> /sms/registration
```
data: {
"ICP": "+886",
"mobile": "0919557754"
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": []
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
#### 檢查驗證碼
<span style="color:red">[POST]</span> /verification/registration
```
data: {
"verification_code": "505415",
"ICP": "+886",
"mobile": "0919557754"
}
repsonse: {
"status": true,
"code": "0003",
"message": "驗證成功",
"data": {
"type": "註冊",
"ICP": "+886",
"mobile": "0919557754"
}
}
error: {
"status": false,
"code": "9917",
"message": "驗證失敗",
"data": [
"驗證失敗,請重新輸入,剩餘輸入次數:2"
]
}
```
#### 註冊帳號
<span style="color:red">[POST]</span> /registration
```
data: {
"name": "test",
"nick_name": "",
"verification_code":"714853",
"email": "andy8520842@livemail.tw",
"ICP": "+886",
"mobile": "0919557754",
"password": "AD&87y878Aa$",
"password_confirmation":"AD&87y878Aa$",
"referral_code": ""
}
repsonse: {
"status": true,
"code": "0001",
"message": "註冊成功",
"data": []
}
error: {
"status": false,
"code": "9915",
"message": "註冊失敗",
"data": {
"verification_code": [
"「驗證碼」不存在"
],
"email": [
"「電子郵件」已被使用"
],
"mobile": [
"「手機號碼」已被使用"
]
}
}
```
### 登入頁
#### 登入-取得驗證碼
<span style="color:red">[POST]</span> /sms/login
```
data: {
"ICP": "+886",
"mobile": "0919557754"
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": []
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
#### 登入-檢查驗證碼
<span style="color:red">[POST]</span> /verification/login
```
data: {
"verification_code": "505415",
"ICP": "+886",
"mobile": "0919557754"
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": []
}
error: {
"status": false,
"code": "9917",
"message": "驗證失敗",
"data": [
"驗證失敗,請重新輸入,剩餘輸入次數:2"
]
}
```
#### 登入
<span style="color:red">[POST]</span> /login
```
data: {
"ICP": "+886",
"mobile": "0919557752",
"password": "",
"verification_code": "12345"
}
repsonse: {
"status": true,
"code": "0005",
"message": "登入成功",
"data": []
}
error: {
"status": false,
"code": "9903",
"message": "登入失敗",
"data": {
"password": [
"密碼必填"
],
"code": [
"「驗證碼」不存在"
]
}
}
```
### 登出
<span style="color:red">[POST]</span> /logout
```
data: {}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": []
}
error: {
}
```
### 忘記密碼頁
#### 忘記密碼-取得驗證碼
<span style="color:red">[POST]</span> /sms/resetting-password
```
data: {
"ICP": "+886",
"mobile": "0919557754"
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": []
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
#### 忘記密碼-檢查驗證碼
<span style="color:red">[POST]</span> /verification/resetting-password
```
data: {
"verification_code": "505415",
"ICP": "+886",
"mobile": "0919557754"
}
repsonse: {
"status": true,
"code": "0003",
"message": "驗證成功",
"data": {
"type": "註冊",
"ICP": "+886",
"mobile": "0919557754"
}
}
error: {
"status": false,
"code": "9917",
"message": "驗證失敗",
"data": [
"驗證失敗,請重新輸入,剩餘輸入次數:2"
]
}
```
#### 忘記密碼
<span style="color:red">[POST]</span> /resetting-password
```
data: {
"ICP": "+886",
"mobile": "0919557754",
"password": "AD&87y878Aa$",
"password_confirmation": "AD&87y878Aa$",
"verification_code": "787138"
}
repsonse: {
"status": true,
"code": "0004",
"message": "重設密碼成功",
"data": []
}
error: {
"status": false,
"code": "9920",
"message": "重設密碼失敗",
"data": {
"code": [
"「驗證碼」不存在"
]
}
}
```
### 現貨紀錄頁(必須先登入)
#### 列表
<span style="color:red">[POST]</span> /api/frontend/v1/spot-log/data-table
```
data: {
"search": {
},
"sorting": {
"column": "id",
"dir": "desc"
},
"page": 1,
"length": 10
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": {
"data": [
{
"id": 1,
"position_type": "新倉", //部位類型
"trading_pair": "BTC/USDT", //交易對
"exchanges": "iste", //交易所名稱
"created_at": "2023-08-28 20:58:04", //建單時間
"quantity": "0.96000000", //交易數量
"average_price": "29171848.93000000", //成交均價
"fee": "546023960.83000000", //手續費
"order_type": "停損限價單", //下單類型
"price": "43907532.22", //成交金額
"sort": 1, //補倉順序
"action": "賣出", //買賣方向
"position_direction": "做多", //持倉方向
"order_state": "成交單" //訂單種類
}
],
"pagination": {
"total": 100, //總筆數
"count": 10, //切幾頁
"length": 10, //一頁幾筆資料
"current_page": 1, //當前頁數
"total_pages": 10, //總頁數
"start": 1, //該頁第一筆項次
"end": 10 //該頁最後一筆項次
}
}
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
### 合約紀錄頁(必須先登入)
#### 列表
<span style="color:red">[POST]</span> /api/frontend/v1/perpetual-log/data-table
```
data: {
"search": {
},
"sorting": {
"column": "id",
"dir": "desc"
},
"page": 1,
"length": 10
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": {
"data": [
{
"id": 1,
"position_type": "新倉", //部位類型
"trading_pair": "BTC/USDT", //交易對
"exchanges": "iste", //交易所名稱
"created_at": "2023-08-28 20:58:04", //建單時間
"quantity": "0.96000000", //交易數量
"average_price": "29171848.93000000", //成交均價
"fee": "546023960.83000000", //手續費
"order_type": "停損限價單", //下單類型
"price": "43907532.22", //成交金額
"sort": 1, //補倉順序
"action": "賣出", //買賣方向
"position_direction": "做多", //持倉方向
"order_state": "成交單" //訂單種類
}
],
"pagination": {
"total": 100, //總筆數
"count": 10, //切幾頁
"length": 10, //一頁幾筆資料
"current_page": 1, //當前頁數
"total_pages": 10, //總頁數
"start": 1, //該頁第一筆項次
"end": 10 //該頁最後一筆項次
}
}
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
### 策略紀錄頁
#### 列表
```
data: {
robot_type(type: String): 'perpetual', // 合約: perpetual、現貨: spot
robot_status(type: String): 'close' // 運作中: actived、已關閉: closed
page(type: Number): 1,
length(type: Number): 10
}
response: {
status: true,
code: 0000,
message: '成功',
data: {
data: [
{
id(type: Number): 1,
robot_type(type: String): 'perpetual', // 策略類型
robot_status(type: String): 'close' // 運作中: actived、已關閉: closed
trading_pair(type: String): 'BTC/USDT', // 交易對
leveraged(type: Number): 5, // 槓桿倍率
exchanges(type: String): 'binance', // 交易所
created_at(type: Datetime): '2023-08-08 10:00:00', // 建單時間
end_at(type: Datetime): '2023-08-08 10:00:00', // 結束時間
duration(type: String): '20日10時10分', // 持續時間
investment_amount(type: Number): 8888, // 投資額
total_floating_profit(type: Number): 8888, // 浮動利潤
close_profit(type: Number): 8888, // 平倉收益
long_floating_profit(type: Number): 8888, // 多單浮動利潤
short_floating_profit(type: Number): 8888, // 空單浮動利潤
total_rate(type: Number): 0.1234, // 總報酬率
arbitrage_times_24h(type: Number): 100, // 24小時套利次數
arbitrage_times(type: Number): 1000, // 總套利次數
fee(type: Number): 123, // 手續費
price(type: Number): 8888, // 當前價格
close_order(type: String): '手動取消' // 關單原因
}
]
}
}
error: {
status: false,
code: "9999",
message: "API呼叫異常,請聯絡系統管理員",
data: []
}
```
#### 單筆
```
data: {
robot_type(type: String): 'perpetual', // 合約: perpetual、現貨: spot
id(type: Number): 1
}
response: {
status: true,
code: 0000,
message: '成功',
data: {
data: {
info(type: Object): {
id(type: Number): 1,
robot_type(type: String): 'perpetual', // 策略類型
robot_status(type: String): 'close' // 運作中: actived、已關閉: closed
trading_pair(type: String): 'BTC/USDT', // 交易對
leveraged(type: Number): 5, // 槓桿倍率
exchanges(type: String): 'binance', // 交易所
created_at(type: Datetime): '2023-08-08 10:00:00', // 建單時間
end_at(type: Datetime): '2023-08-08 10:00:00', // 結束時間
duration(type: String): '20日10時10分', // 持續時間
investment_amount(type: Number): 8888, // 投資額
total_floating_profit(type: Number): 8888, // 浮動利潤
close_profit(type: Number): 8888, // 平倉收益
long_floating_profit(type: Number): 8888, // 多單浮動利潤
short_floating_profit(type: Number): 8888, // 空單浮動利潤
total_rate(type: Number): 0.1234, // 總報酬率
arbitrage_times_24h(type: Number): 100, // 24小時套利次數
arbitrage_times(type: Number): 1000, // 總套利次數
arbitrage_times_day(type: Number): 50 // 日均套利次數
fee(type: Number): 123, // 手續費
price(type: Number): 8888, // 當前價格
close_order(type: String): '手動取消' // 關單原因
},
data_list(type: Array): [ // 交易圖表內容
{
date(type: Datetime): '10/01 12:00', // 日期
profit_rate(type: Number): 0.1234, // 利潤
count(type: Number): 100 // 成交筆數
}
],
log_list(type: Array): [ // 交易紀錄
{
id(type: Number): 0,
position_type(type: String): '開倉', // 部位類型
position_direction(type: String): '做多', // 部位方向
average_price(type: Number): 1234, // 成交均價
fee(type: Number): 123,
price(type: Number): 100, // 成交金額
profit(type: Number): 0, // 損益
created_at(Datetime): '10/10 10:00' // 建單時間
}
]
}
}
}
error: {
status: false,
code: "9999",
message: "API呼叫異常,請聯絡系統管理員",
data: []
}
```
### 電子帳單頁(必須先登入)
#### 總帳單
<span style="color:red">[POST]</span> /api/frontend/v1/profit/data-table
```
data: {
"search": {
},
"sorting": {
"column": "created_at",
"dir": "desc"
},
"page": 1,
"length": 10
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": {
"data": [
{
"created_at": "2023-08-30 14:21:55",
"profit": "583894062.95000000"
}
],
"pagination": {
"total": 3,
"count": 3,
"length": 10,
"current_page": 1,
"total_pages": 1,
"start": 1,
"end": 3
}
}
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
#### 現貨
<span style="color:red">[POST]</span> /api/frontend/v1/profit/spot/data-table
```
data: {
"search": {
},
"sorting": {
"column": "created_at",
"dir": "desc"
},
"page": 1,
"length": 10
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": {
"data": [
{
"created_at": "2023-08-30 14:21:55",
"profit": "583894062.95000000"
}
],
"pagination": {
"total": 3,
"count": 3,
"length": 10,
"current_page": 1,
"total_pages": 1,
"start": 1,
"end": 3
}
}
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
#### 合約
<span style="color:red">[POST]</span> /api/frontend/v1/profit/perpetual/data-table
```
data: {
"search": {
},
"sorting": {
"column": "created_at",
"dir": "desc"
},
"page": 1,
"length": 10
}
repsonse: {
"status": true,
"code": "0000",
"message": "成功",
"data": {
"data": [
{
"created_at": "2023-08-30 14:21:55",
"profit": "583894062.95000000"
}
],
"pagination": {
"total": 3,
"count": 3,
"length": 10,
"current_page": 1,
"total_pages": 1,
"start": 1,
"end": 3
}
}
}
error: {
"status": false,
"code": "9999",
"message": "API呼叫異常,請聯絡系統管理員[64ddb3d689cad]",
"data": []
}
```
#### 總帳單
<span style="color:red">[GET]</span> /api/frontend/v1/profit/data-table
```
data: {
}
repsonse: {
9392.26000000
}
error: {}
```
# **首頁**
* 取得基本資料
```
data: {
}
repsonse: {
{
status: true,
code: "0000",
message: "重設密碼成功",
data: {
user_id(type: Number): 0,
name(type: String): '',
avatar_path(type: String): '',
status(type: String): '',
level_info(type: Object): {
level(type: Number): 0,
name(type: String): ''
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "",
data: {
}
}
}
```
* 取得幣種列表
```
data: {
exchanges(type: String): '',
type(type: String): '',
traning_pair(type: String): '',
minimum(type: Number): 0
}
repsonse: {
{
status: true,
code: "0000",
message: "重設密碼成功",
data: {
ticker_list(type: Array): [
{
id(type: Number): 0,
ticker_name: ''
price(type: Number): '',
change_in_24h(type: Number): 0,
icon(type: String): '',
tranding_pair(type: String): ''
zh: 'AAVE'
}
]
}
}
}
error: {
{
status: false,
code: "0000",
message: "",
data: {
}
}
}
```
# **API授權**
* 取得授權狀態
```
response: {
{
status: true,
code: "0000",
message: "取得授權狀態成功",
data: {
[
{
id(type: Number): 1,
platform(type: String): 'binance',
name(type: String): 'Binance',
status(type: Boolean): false,
},
{
id(type: Number): 2,
platform(type: String): 'okx',
name(type: String): 'Okx',
status(type: Boolean): true,
}
]
}
}
}
error: {
{
status: false,
code: "0000",
message: "取得授權狀態失敗",
data: {
}
}
}
```
* 取的單一平台授權狀態
```
response: {
{
status: true,
code: "0000",
message: "取得授權狀態成功",
data: {
{
id(type: Number): 1,
platform(type: String): 'binance',
name(type: String): 'Binance',
status(type: Boolean): false,
api_key(type: String): '',
secret_key(type: String): '',
api_password(type: String): ''
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "取得授權狀態失敗",
data: {
}
}
}
```
* 修改授權內容
```
data: {
platform(type: String): '',
api_key(type: String): '',
secret_key(type: String): '',
api_password(type: String): ''
}
response: {
{
status: true,
code: "0000",
message: "修改授權狀態成功",
data: {
{
id(type: Number): 1,
platform(type: String): 'binance',
name(type: String): 'Binance',
status(type: Boolean): false,
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "修改授權狀態失敗",
data: {
}
}
}
```
* 取消授權
```
response: {
{
status: true,
code: "0000",
message: "取消授權成功",
data: {
{
id(type: Number): 1,
platform(type: String): 'binance',
name(type: String): 'Binance',
status(type: Boolean): false
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "取消授權失敗",
data: {
}
}
}
```
# **錢包**
* 取得錢包資訊
```
response: {
{
status: true,
code: "0000",
message: "取得錢包資訊成功",
data: {
{
usdt_balance(type: Number): 0,
credit_balance(type: Number): 0,
usdt_deposit_address(type: String): ''
gainList(type: Array): [
{
name(type: String): '',
today_profit(type: Number): 0,
total_profit(type: Number): 0
}
]
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "取得錢包資訊失敗",
data: {
}
}
}
```
* 提款
```
data: {
address(type: String): '',
amount(type: Number): 0,
valid_code(type: Number): 0
}
response: {
{
status: true,
code: "0000",
message: "提款成功",
data: {
{
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "提款失敗",
data: {
}
}
}
```
* 購買點數
```
data: {
credit(type: Number): 0,
valid_code(type: Number): 0
}
response: {
{
status: true,
code: "0000",
message: "購買點數成功",
data: {
{
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "購買點數失敗",
data: {
}
}
}
```
* 確認當前點數需支付金額
```
data: {
credit(type: Number): 0
}
response: {
{
status: true,
code: "0000",
message: "查詢成功",
data: {
{
amount: 0
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "查詢失敗",
data: {
}
}
}
```
* 錢包紀錄
```
data: {
type(type: String): 'deposit/withdraw/recharge',
page(type: Number): 1,
length(type: Number): 10
}
response: {
{
status: true,
code: "0000",
message: "查詢成功",
data: {
{
type(type: String): 'deposit/withdraw/recharge',
record_list(type: Array): [
{
id(type: Number): 0,
type(type: String): 'deposit/withdraw/recharge/profit',
source(type: String): ''
amount(type: Number): 100, // 提幣數量、充值數量
quantity(type: Number): 97, // 到帳數量
address(type: String): '0x1234567890', // 提幣地址、充值地址
transaction_time(type: String): '2021-08-01 12:00:00', // 提幣時間、充值時間
created_at(type: String): ''
status(type: Boolean): 'success' // 提幣狀態、充值狀態
}
],
recharge_list(type: Array): [
{
{
id(type: Number): 0,
type(type: String): '充值',
amount(type: Number): 100,
create_time(type: String): '2021-08-01 12:00:00'
},
{
id(type: Number): 1,
type(type: String): '扣除服務費',
amount(type: Number): 100,
create_time(type: String): '2021-08-01 12:00:00'
}
}
]
page(type: Number): 1,
length(type: Number): 10
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "查詢失敗",
data: {
}
}
}
```
# **社群**
* 取得個人社群收益
```
data: {
period(type: String): 'all/yesterday/week/month/custom',
period_at(type: String): '2023-08-01',
period_end(type: String): '2023-08-08'
}
response: {
{
status: true,
code: "0000",
message: "取得收益資訊成功",
data: {
{
period_at(type: String): '2023-08-01',
period_end(type: String): '2023-08-08'
amount(type: Number): 100,
increase_amount(type: Number): 100,
active_friend(type: Number): 100,
increase_acrive_friend(type: Number): 100,
all_friend(type: Number): 100,
increase_all_friend(type: Number): 100
recommender(type: Object): {
amount(type: Number): 100,
id(type: String): 100
},
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "取得收益資訊失敗",
data: {
}
}
}
```
* 取得社群樹
```
response: {
{
status: true,
code: "0000",
message: "取得社群樹成功",
data: {
{
community_tree(type: Object): {
id(type: Number): 123,
nickname(type: String): '第一層',
avatar_path(type: String): '',
amount(type: Number): 100,
extend(type: Boolean): true,
children(type: Array): [
{
id(type: Number): 1234,
nickname(type: String): '第二層-1',
avatar_path(type: String): '',
amount(type: Number): 100,
extend(type: Boolean): true
},
{
id(type: Number): 123,
nickname(type: String): '第二層-2',
avatar_path(type: String): '',
amount(type: Number): 100,
extend(type: Boolean): true,
children(type: Array): [
{
id(type: Number): 1234,
nickname(type: String): '第三層-1',
avatar_path(type: String): '',
amount(type: Number): 100,
extend(type: Boolean): true
}
]
}
]
}
}
}
}
}
error: {
{
status: false,
code: "0000",
message: "取得社群樹失敗",
data: {
}
}
}
```
```