etf接口

獲取所有產(chǎn)品

GET /web/etf/products.json

返回例子:

{
    "success":true,
    "data":[
        {
            "id":1,
            "name":"BAI",
            "period":{
                "id":1,
                "state":"selling",
                "start_at":1532523600,
                "end_at":1535634000,
                "amount":"100000",
                "bought":"5013.0",
                "nper":1,
                "can_buy":true
            }
        },
        {
            "id":2,
            "name":"BAI+",
            "period":{
                "id":2,
                "state":"selling",
                "start_at":1532523600,
                "end_at":1535634000,
                "amount":"100000",
                "bought":"3647.0",
                "nper":1,
                "can_buy":true
            }
        }
    ]
}

其中period字段為期數(shù),里面amount表示本期總共額度,bought表示已經(jīng)生效的額度,nper表示第幾期。

獲取點數(shù)據(jù)

GET /web/etf/points/${id}?from=${from}&to=${to}

例子:

GET http://staging.bitrabbit.io/web/etf/points/1?from=2018-04-03&to=2018-08-01?locale=zh-CN
{
    "success":true,
    "data":{
        "name":"BAI",
        "first_price":"1.14",
        "last_price":"1.589",
        "points":[
            {
                "at":1522771200,
                "price":"1.13"
            },
            {
                "at":1522857600,
                "price":"1.13"
            }
        ]
    }
}

獲取用戶所有訂單

GET /web/etf/orders.json

例子:

{
    "success":true,
    "data":[
        {
            "id":35,
            "state":"submitted",
            "active_time":0,
            "redeem_time":0,
            "volume":null,
            "amount":"2.0",
            "product_name":"BAI+",
            "product_id":2,
            "avg_price":null,
            "avg_end_price":null,
            "memo":null,
            "currency":"USDT",
            "created_at":"2018-07-31T11:24:02.000+08:00",
            "nper":1
        },
        {
            "id":34,
            "state":"submitted",
            "active_time":0,
            "redeem_time":0,
            "volume":null,
            "amount":"1.0",
            "product_name":"BAI",
            "product_id":1,
            "avg_price":null,
            "avg_end_price":null,
            "memo":null,
            "currency":"USDT",
            "created_at":"2018-07-31T11:23:46.000+08:00",
            "nper":1
        }
    ]
}

其中以product_id來區(qū)分對應(yīng)哪個產(chǎn)品。state枚舉如下:

{
  "etf_state_submitting": "提交中",
  "etf_state_submitted": "申購中",
  "etf_state_rejected": "已拒絕",
  "etf_state_executed": "已生效",
  "etf_state_redeeming": "贖回中",
  "etf_state_redeemed": "已贖回"
}

avg_price是生效時的均價,avg_end_price是贖回時的均價,amount是USDT數(shù)量,volume是訂單的BAI份額。

用戶下訂單

POST /web/etf/orders.json

例子:

入?yún)?/p>

{
    "amount":"100",
    "currency":"USDT",
    "product_id":2,
    "period_id":1,
    "locale":"zh-CN"
}

表示花費100``USDT購買product_id2的產(chǎn)品,期數(shù)id為1

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容