etf接口

作者: sekaiamber | 来源:发表于2018-08-01 14:16 被阅读0次

    获取所有产品

    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字段为期数,里面amount表示本期总共额度,bought表示已经生效的额度,nper表示第几期。

    获取点数据

    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来区分对应哪个产品。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数量,volume是订单的BAI份额。

    用户下订单

    POST /web/etf/orders.json
    

    例子:

    入参

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

    表示花费100``USDT购买product_id2的产品,期数id为1

    相关文章

      网友评论

          本文标题:etf接口

          本文链接:https://www.haomeiwen.com/subject/vxtrvftx.html