# MOV现货API

MOV现货的基础URL:https://bcapi.movapi.com

该版本是开放协议的版本,没有用户的概念,只有地址的概念,所有涉及的用户都是指那个地址

# API列表

  • 获取市场所有交易对
  • 获取市场深度
  • 获取账户信息
  • 发送订单
  • 撤销订单
  • 查询订单

# 获取市场所有交易对

返回MOV所有的交易对信息

# Request

GET /api/v3/vapor/mov/common/symbols

# Response

  • String- price_decimal:交易对报价的精度(小数点后位数)
  • String- amount_decimal:交易对数量的精度(小数点后位数)
  • Object- base_asset:基础货币的信息
    • String-asset_id:发行资产代码的ID
    • String-symbol:发行资产代码的名字
  • Object- quote_asset:报价货币的信息
    • String-asset_id:发行资产代码的ID
    • String-symbol:发行资产代码的名字
  • 示例:
# Request
GET https://bcapi.movapi.com/api/v3/vapor/mov/common/symbols

# Response
{
   "code":200,
   "msg":"",
   "result":{
      "data":[
         {
            "price_decimal":4,
            "amount_decimal":2,
            "base_asset":{
               "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
               "symbol":"BTM"
            },
            "quote_asset":{
               "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
               "symbol":"USDT"
            }
         },
         {
            "price_decimal":2,
            "amount_decimal":4,
            "base_asset":{
               "asset_id":"78de44ffa1bce37b757c9eae8925b5f199dc4621b412ef0f3f46168865284a93",
               "symbol":"ETH"
            },
            "quote_asset":{
               "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
               "symbol":"USDT"
            }
         },
         {
            "price_decimal":8,
            "amount_decimal":2,
            "base_asset":{
               "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
               "symbol":"BTM"
            },
            "quote_asset":{
               "asset_id":"78de44ffa1bce37b757c9eae8925b5f199dc4621b412ef0f3f46168865284a93",
               "symbol":"ETH"
            }
         },
         {
            "price_decimal":8,
            "amount_decimal":2,
            "base_asset":{
               "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
               "symbol":"BTM"
            },
            "quote_asset":{
               "asset_id":"bda946b3110fa46fd94346ce3f05f0760f1b9de72e238835bc4d19f9d64f1742",
               "symbol":"BTC"
            }
         },
         {
            "price_decimal":2,
            "amount_decimal":4,
            "base_asset":{
               "asset_id":"bda946b3110fa46fd94346ce3f05f0760f1b9de72e238835bc4d19f9d64f1742",
               "symbol":"BTC"
            },
            "quote_asset":{
               "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
               "symbol":"USDT"
            }
         },
         {
            "price_decimal":6,
            "amount_decimal":4,
            "base_asset":{
               "asset_id":"78de44ffa1bce37b757c9eae8925b5f199dc4621b412ef0f3f46168865284a93",
               "symbol":"ETH"
            },
            "quote_asset":{
               "asset_id":"bda946b3110fa46fd94346ce3f05f0760f1b9de72e238835bc4d19f9d64f1742",
               "symbol":"BTC"
            }
         }
      ]
   }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

# 获取市场深度

获取市场指定交易对的深度

# Request

GET /api/v3/vapor/mov/market/depth

# Params

  • String- symbol:需查询深度的交易对,比如BTM/USDT
  • Int- depth:返回的订单数量

# Response

  • String- symbol:交易对
  • Double- timestamp:服务器时间戳
  • Array- bids:指定深度的买单的价格和数量
  • Array- asks:指定深度的卖单的价格和数量
  • 示例:
# Request
GET https://bcapi.movapi.com/api/v3/vapor/mov/market/depth?symbol=BTM/USDT&depth=5


# Response
{
  "code": 200,
  "msg": "",
  "result": {
    "data": {
      "symbol": "BTC/USDT",
      "asks": [
        ["8829.77", "0.043849"],
        ["8829.78", "2.643894"],
        ["8829.79", "2.643894"],
        ["8829.80", "2.643894"],
        ["8829.81", "2.643894"]
      ],
      "bids": [
        ["8155.00", "0.001100"],
        ["8100.00", "0.030000"],
        ["8000.00", "0.002000"],
        ["7783.02", "2.408383"],
        ["7783.00", "2.502442"]
      ],
      "timestamp": 1579253174875
    }
  }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

# 获取账户信息

根据Address获取账户信息

# Request

POST https://bcapi.movapi.com/api/v3/vapor/account/get-balance?address=您的侧链地址

# Params

  • String- address:您的侧链地址

# Response

  • String- asset:资产ID
  • String- balance:资产余额,这个余额是总余额,他是可用余额与挂单冻结金额的和
  • String- available_balance:资产可用余额
  • String- total_received:接收的资产数量
  • String- total_sent:发送的资产数量
  • String- name:资产简称
  • String- symbol:资产代码
  • String- in_usd:资产以美元计价的总价值
  • String- in_cny:资产以人民币计价的总价值
  • String- in_btc:资产以比特币计价的总价值
  • 示例:
# Request
POST https://bcapi.movapi.com/api/v3/vapor/account/get-balance?address=您的侧链地址

# Response
{
   "code":200,
   "msg":"",
   "result":{
      "data":{
         "address":"vp1qhg8qjtd5e3thlem569fmt8l8uc6xyd2nmsscks",
         "label":"",
         "balances":[
            {
               "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
               "balance":"18.70282",
               "available_balance":"18.70282",
               "total_received":"3398.33793",
               "total_sent":"3379.63511",
               "name":"Bytom",
               "symbol":"BTM",
               "in_usd":"1.23",
               "in_cny":"8.70",
               "in_btc":"0.000132"
            },
            {
               "asset":"bda946b3110fa46fd94346ce3f05f0760f1b9de72e238835bc4d19f9d64f1742",
               "balance":"0",
               "available_balance":"0",
               "total_received":"0.01",
               "total_sent":"0.01",
               "name":"Bitcoin",
               "symbol":"BTC",
               "in_usd":"0.00",
               "in_cny":"0.00",
               "in_btc":"0.000000"
            },
            {
               "asset":"78de44ffa1bce37b757c9eae8925b5f199dc4621b412ef0f3f46168865284a93",
               "balance":"0",
               "available_balance":"0",
               "total_received":"0.1",
               "total_sent":"0.1",
               "name":"Ethereum",
               "symbol":"ETH",
               "in_usd":"0.00",
               "in_cny":"0.00",
               "in_btc":"0.000000"
            },
            {
               "asset":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
               "balance":"0.185603",
               "available_balance":"0.185603",
               "total_received":"98.020768",
               "total_sent":"97.835165",
               "name":"USDT-ERC20",
               "symbol":"USDT",
               "in_usd":"0.19",
               "in_cny":"1.31",
               "in_btc":"0.000020"
            }
         ],
         "votes":[

         ]
      }
   }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

# Native Sign

MOV是一个去中心化的链上交易,所以发送订单需要多步完成,包括构建交易,交易签名和交易提交,MOV是基于UTXO模型的Vapor链,交易提交时为了合并UTXO需要提交多次链式交易。

这里介绍的Native Sign是用于用户对服务器端传送来的交易进行签名的。

#参照前面做市商前置准备中说的安装pybtm
pip3 install pybtm
1
2

对build-place-order-tx、build-cancel-order-tx 返回的数据调用SDK进行本地离线签名 使用pybtm中的xprv_sign函数进行签名

对于每一个得到的TX,签名流程如下

#示例代码:
from pybtm import key
raw_transaction = data["result"]["data"]["raw_transaction"]
signing_instructions = data["result"]["data"]["signing_instructions"]

arr = []
for signing in signing_instructions:
    derivation_path = signing["derivation_path"]
    sign_data = signing["sign_data"]
    new_secret_key = key.get_child_xprv(self.secret_key, derivation_path)
    sign_data = [key.xprv_sign(new_secret_key, s) for s in sign_data]
    arr.append(sign_data)

params = {
    "raw_transaction": raw_transaction,
    "signatures": arr,
    "client_id": "123"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 构建创建订单请求

注意:MOV的挂单价格和数量是以交易对的前者为基准,比如BTC/USDT,是以BTC为基准,如果side为buy,则是用USDT买BTC,如果side为sell,则以BTC换USDT

# Build Request

/api/v3/vapor/mov/merchant/build-place-order-tx?address=您的侧链地址

# Params

  • String- address:您的侧链地址

# Body

  • String- price:挂单的价格
  • String- amount:挂单的数量
  • String- side:买单/卖单
  • String- symbol:交易对,比如BTC/USDT
  • String- pubkey:不是必填,公钥(没有guid的地址必填,否则返回错误)

# Build Response

  • String- raw_transaction:待签名的交易信息
  • Array- signing_instructions:非交易相关待签名的信息
# Request
POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/build-place-order-tx?address="您的侧链地址"
{
  'pubkey': '',(不是必填,公钥(没有wallet的地址必填,否则返回错误))
  'price': '6100',
  'amount': '0.01',
  'side': 'buy',
  'symbol': 'BTC/USDT'
}


# Response
{
   "code":200,
   "msg":"",
   "result":{
      "data":[
         {
            "tx":{
               "hash":"1e9f7857bceb739926204984db28150e86c2e3e533faddc6a25a6b68ad77cd27",
               "status_fail":False,
               "size":411,
               "submission_timestamp":0,
               "memo":"",
               "inputs":[
                  {
                     "script":"0014ba0e092db4cc577fe774d153b59fe7e634623553",
                     "address":"vp1qhg8qjtd5e3thlem569fmt8l8uc6xyd2nmsscks",
                     "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "amount":500000000,
                     "type":"spend"
                  },
                  {
                     "script":"0014ba0e092db4cc577fe774d153b59fe7e634623553",
                     "address":"vp1qhg8qjtd5e3thlem569fmt8l8uc6xyd2nmsscks",
                     "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "amount":500000000,
                     "type":"spend"
                  }
               ],
               "outputs":[
                  {
                     "utxo_id":"ec8b6274a893529e1cf383b24e7761a601eb60e48416a6cdef30d616f1eae8d9",
                     "script":"0020184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd465102e204160014ba0e092db4cc577fe774d153b59fe7e63462355320083b80e0259d963abbcd43d0195dfde3c03e50c6fb5e2ee13ff0429de091a2e2",
                     "address":"smart contract",
                     "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "amount":1000000000,
                     "type":"control"
                  }
               ],
               "fee":0,
               "balances":[
                  {
                     "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "amount":"-1000000000"
                  }
               ],
               "types":[
                  "mov_place_order"
               ]
            },
            "raw_transaction":"070100020160015e1c26175abd084670eed9a668d687be6695f32f0138948bdd00b615a950dc6005ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80cab5ee010001160014ba0e092db4cc577fe774d153b59fe7e634623553220120083b80e0259d963abbcd43d0195dfde3c03e50c6fb5e2ee13ff0429de091a2e20160015e633abd2da2bfd0a1a387d0faec667278d045318cc786eb4d7e802d6643227ef5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80cab5ee010001160014ba0e092db4cc577fe774d153b59fe7e634623553220120083b80e0259d963abbcd43d0195dfde3c03e50c6fb5e2ee13ff0429de091a2e201018801008501ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc03015e0020184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd465102e204160014ba0e092db4cc577fe774d153b59fe7e63462355320083b80e0259d963abbcd43d0195dfde3c03e50c6fb5e2ee13ff0429de091a2e200",
            "signing_instructions":[
               {
                  "derivation_path":[
                     "2c000000",
                     "99000000",
                     "01000000",
                     "00000000",
                     "01000000"
                  ],
                  "sign_data":[
                     "d3a866ecd5ebd6fce0bc0182129277606a9e6920012d9a9b9db4920c6361234b"
                  ],
                  "pubkey":"083b80e0259d963abbcd43d0195dfde3c03e50c6fb5e2ee13ff0429de091a2e2"
               },
               {
                  "derivation_path":[
                     "2c000000",
                     "99000000",
                     "01000000",
                     "00000000",
                     "01000000"
                  ],
                  "sign_data":[
                     "db7c6fe7b6c3d5b8779669ac7d7c8ce622412a025a26e8e126a668c1052a6d55"
                  ],
                  "pubkey":"083b80e0259d963abbcd43d0195dfde3c03e50c6fb5e2ee13ff0429de091a2e2"
               }
            ],
            "fee":0
         }
      ]
   }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

# 签名交易 (提交到submit-payment地址)

# Params

  • String- address:您的侧链地址

# Body (/api/v3/vapor/merchant/submit-payment)

  • String- raw_transaction:上一个build-place-order-tx接口返回的数据
  • Array- signatures:签名数据

# Sign Response

  • String- tx_hash:交易哈希
  • Array- signatures:交易签名信息
# Request
POST https://bcapi.movapi.com/api/v3/mov/vapor/merchant/submit-payment?address="您的侧链地址"

{
  'raw_transaction': '0701000101aa0101a701298c6ec482ccbab07427361741de38005a166affdab94fa9a1ceff77ba48b749d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b00016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570303e5b102011416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435010001013e003cd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b0116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
  'signatures': [
    ['e94004a6f532bc6cff0b2f2ad83dc478b8e0187ec6bddd6b4c1fd2e22f275e64f848bdb106763c22df41882d6fbbbbfe50f5cbd0630c10e7bea3831a230ba40b']
  ],
  'client_id': '123'
}

# Response (https://bcapi.movapi.com/api/v3/vapor/merchant/submit-payment?address="您的侧链地址")

{
    "raw_transaction":"070100010160015e26978b848afd77d559980e58db9b60559b716312bd1e24af7e44c6efa5c1605dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0a885fd0201011600140ff923ae0944af0cfdd3eb3671db354eaa6b5795220120c44537a8d397ee09315755cd77fd02d66db015f32ba358c3bfafe20d887d041202013cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f011600141e03ad3233693b551be8c86f5db062bdbe0c9f6600013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8b292cd02011600140ff923ae0944af0cfdd3eb3671db354eaa6b579500",
    "signatures":[
        [
            "4f5e0b94f983ab6d98c230e7edf031951c93809af318d0bb6c362714794c38c5939df58e43ac1a45599d777386724354c0ced7bab54d19bac02c233fa9e2050a"
        ]
    ],
    "memo":"mock"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 签名交易(提交到submit-place-order-tx地址)

# Params

  • String- address:您的侧链地址

# Body (/api/v3/vapor/mov/merchant/submit-place-order-tx)

  • String- raw_transaction:上一个build-place-order-tx接口返回的数据
  • Array- signatures:签名数据

# Sign Response

  • String- tx_hash:交易哈希
  • Object- order:交易订单
    • String- symbol:交易品种
    • String-side:交易方向
    • Int-order_id:订单ID
    • String-open_price:开仓价
    • String-deal_price:成交均价
    • String-amount:交易数量
    • String-filled_amount:已成交数量
    • String-fee_amount:手续费
    • String-type:交易类型
    • String-client_id:用户附加信息
    • Array-order_txs:订单哈希类信息数组
      • String-hash:订单哈希
      • String-type:订单类型
      • Double-timestamp:订单写入到数据库的时间
    • Double-order_timestamp:下单时间戳
    • Double-update_timestamp:订单更新时间戳
# Request
POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-place-order-tx?address="您的侧链地址"

{
  'raw_transaction': '0701000101aa0101a701298c6ec482ccbab07427361741de38005a166affdab94fa9a1ceff77ba48b749d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b00016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570303e5b102011416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435010001013e003cd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b0116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
  'signatures': [
    ['e94004a6f532bc6cff0b2f2ad83dc478b8e0187ec6bddd6b4c1fd2e22f275e64f848bdb106763c22df41882d6fbbbbfe50f5cbd0630c10e7bea3831a230ba40b']
  ],
  'client_id': '123'
}

# Response (https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-place-order-tx?address="您的侧链地址")
{
    "code": 200,
    "msg": "",
    "result": {
        "data":  {
            "tx_hash": "27dad6d060ebd2171b2af018ef61bce4b46b9f209d4c00d2a56f664b1ecdf202",
            "order": {
                "symbol": "BTM/CTM",
                "side": "sell",
                "order_id": 1,
                "open_price": "0.00000933000000000000",
                "deal_price": "0",
                "amount": "1.01",
                "filled_amount": "0.00",
                "fee_amount": "0.00000000",
                "status": "submitted",
                "type": "mov",
                "client_id": "123",
                "order_txs": [
                    {
                        "hash": "27dad6d060ebd2171b2af018ef61bce4b46b9f209d4c00d2a56f664b1ecdf202",
                        "type": "mov_place_order",
                        "timestamp": 1575367734
                    }
                ],
                "order_timestamp": 1575367734,
                "update_timestamp": 1575367734
            }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

# 如何发送一笔完整的交易 (示例)

1.对一笔订单,我们首先进行构建交易

POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/build-place-order-tx?address="您的侧链地址"
{
  'pubkey': '',(不是必填,公钥(没有wallet的地址必填,否则返回错误))
  'price': '6100',
  'amount': '0.01',
  'side': 'buy',
  'symbol': 'BTC/USDT'
}
1
2
3
4
5
6
7
8

2.如果build-place-order-tx返回多个TX,则需要调用多次签名,调用方法如Native Sign所说。

3.开始提交签名信息到如下地址,

(1)对于前 N-1个签名信息,提交到 如下地址

POST /api/v3/vapor/mov/merchant/submit-payment?address=您的侧链地址

(2)最后一笔签名信息提交到下面这个地址

POST /api/v3/vapor/mov/merchant/submit-place-order-tx?address=您的侧链地址

这段描述看起来可能会难以理解,具体可以看我们的SDK实现。点击这里https://github.com/Bytom/movApiDoc

* 示例如下: 
1.首先进行构建交易

POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/build-place-order-tx?address="您的侧链地址"
{
  'pubkey': '',(不是必填,公钥(没有wallet的地址必填,否则返回错误))
  'price': '6100',
  'amount': '0.01',
  'side': 'buy',
  'symbol': 'BTC/USDT'
}

2.提交交易订单

对于上面的tx,分别进行Native Sign 签名,并将签名信息提交

前N-1个交易签名,使用https://bcapi.movapi.com/api/v3/vapor/merchant/submit-payment?address="您的侧链地址" 来提交签名

最后一个交易签名,使用https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-place-order-tx?address="您的侧链地址" 来提交签名

对于前面的N-1个签名

# Request
POST https://bcapi.movapi.com/api/v3/mov/vapor/merchant/submit-payment?address="您的侧链地址"

{
  'raw_transaction': '0701000101aa0101a701298c6ec482ccbab07427361741de38005a166affdab94fa9a1ceff77ba48b749d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b00016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570303e5b102011416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435010001013e003cd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b0116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
  'signatures': [
    ['e94004a6f532bc6cff0b2f2ad83dc478b8e0187ec6bddd6b4c1fd2e22f275e64f848bdb106763c22df41882d6fbbbbfe50f5cbd0630c10e7bea3831a230ba40b']
  ],
  'client_id': '123'
}

# Response (https://bcapi.movapi.com/api/v3/vapor/merchant/submit-payment?address="您的侧链地址")

{
    "raw_transaction":"070100010160015e26978b848afd77d559980e58db9b60559b716312bd1e24af7e44c6efa5c1605dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0a885fd0201011600140ff923ae0944af0cfdd3eb3671db354eaa6b5795220120c44537a8d397ee09315755cd77fd02d66db015f32ba358c3bfafe20d887d041202013cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f011600141e03ad3233693b551be8c86f5db062bdbe0c9f6600013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8b292cd02011600140ff923ae0944af0cfdd3eb3671db354eaa6b579500",
    "signatures":[
        [
            "4f5e0b94f983ab6d98c230e7edf031951c93809af318d0bb6c362714794c38c5939df58e43ac1a45599d777386724354c0ced7bab54d19bac02c233fa9e2050a"
        ]
    ],
    "memo":"mock"
}

对于最后的一个签名交易
# Request
POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-place-order-tx?address="您的侧链地址"

{
  'raw_transaction': '0701000101aa0101a701298c6ec482ccbab07427361741de38005a166affdab94fa9a1ceff77ba48b749d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b00016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570303e5b102011416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435010001013e003cd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b0116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
  'signatures': [
    ['e94004a6f532bc6cff0b2f2ad83dc478b8e0187ec6bddd6b4c1fd2e22f275e64f848bdb106763c22df41882d6fbbbbfe50f5cbd0630c10e7bea3831a230ba40b']
  ],
  'client_id': '123'
}

# Response (https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-place-order-tx?address="您的侧链地址")

最终,在最后一个submit-place-order-tx里面,我们得到了如下的返回结果
{
    "code": 200,
    "msg": "",
    "result": {
        "data":  {
            "tx_hash": "27dad6d060ebd2171b2af018ef61bce4b46b9f209d4c00d2a56f664b1ecdf202",
            "order": {
                "symbol": "BTM/CTM",
                "side": "sell",
                "order_id": 1,
                "open_price": "0.00000933000000000000",
                "deal_price": "0",
                "amount": "1.01",
                "filled_amount": "0.00",
                "fee_amount": "0.00000000",
                "status": "submitted",
                "type": "mov",
                "client_id": "123",
                "order_txs": [
                    {
                        "hash": "27dad6d060ebd2171b2af018ef61bce4b46b9f209d4c00d2a56f664b1ecdf202",
                        "type": "mov_place_order",
                        "timestamp": 1575367734
                    }
                ],
                "order_timestamp": 1575367734,
                "update_timestamp": 1575367734
            }
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

# 构建取消订单请求

# Build Request

POST /api/v3/vapor/mov/merchant/build-cancel-order-tx?address=您的侧链地址

# Params

  • String- address:您的侧链地址

# Body

  • Int- order_id:待取消的订单

# Build Response

  • String- raw_transaction:待签名的交易信息
  • Array- signing_instructions:非交易相关待签名的信息
    • Array- derivation_path:派生路径
    • Array- sign_data:签名数据信息
# Request
POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/build-cancel-order-tx?address="您的侧链地址"
{
  'order_id': 6100
}

# Response
{
   "code":200,
   "msg":"",
   "result":{
      "data":{
         "tx":{
            "hash":"da7043bd2086d8cfec8b4c71c496c0e8d0aa54863c0dd22550a505980334bf49",
            "status":True,
            "size":247,
            "submission_timestamp":0,
            "memo":"",
            "inputs":[
               {
                  "script":"00204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570302d90602a861160014fe58c74561ef4014a75f9f442701bb56be4a0cee203a4494cc844df0ab65368c986f356dfaf93fb7b5ffae1014e8d03dca8f063302",
                  "address":"smart contract",
                  "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                  "amount":"26.72",
                  "type":"spend"
               }
            ],
            "outputs":[
               {
                  "utxo_id":"2caf0b939245b0f1d88580e7787e1dd4d07d0e3954db4d770bebf8b6adec187b",
                  "script":"0014fe58c74561ef4014a75f9f442701bb56be4a0cee",
                  "address":"tp1qlevvw3tpaaqpff6lnazzwqdm26ly5r8wa8yyg9",
                  "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                  "amount":"26.72",
                  "type":"control"
               }
            ],
            "fee":"0",
            "balances":[
               {
                  "asset":{
                     "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "symbol":"BTM"
                  },
                  "amount":"26.72"
               }
            ],
            "types":[
               "ordinary"
            ]
         },
         "raw_transaction":"0701000101ab0101a801f10fa83dc3b2b94f2b8e78e67a802d4df028684102a16b167b86b8ecc752e52bffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80f88dfa0900016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570302d90602a861160014fe58c74561ef4014a75f9f442701bb56be4a0cee203a4494cc844df0ab65368c986f356dfaf93fb7b5ffae1014e8d03dca8f063302010001013f003dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80f88dfa0901160014fe58c74561ef4014a75f9f442701bb56be4a0cee00",
         "signing_instructions":[
            {
               "derivation_path":[
                  "2c000000",
                  "99000000",
                  "01000000",
                  "00000000",
                  "01000000"
               ],
               "sign_data":[
                  "82fc98d0c8410556b814aa53fec2624e243b9239b9bcb4770388aae3e3fbb3fe"
               ]
            }
         ]
      }
   }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

# 提交取消订单请求签名

# Submit Request

POST /api/v3/vapor/mov/merchant/submit-cancel-order-tx?address=您的侧链地址

# Params

  • String- address:您的侧链地址

# Body

  • String- raw_transaction:上一个cancel-place-order-tx接口返回的数据
  • Array- signatures:签名数据

# Submit Response

  • String- tx_hash:交易哈希
# Request
POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-cancel-order-tx?address="您的侧链地址"

{
  'raw_transaction': '070100050160015ea36a32db05dde6387a1af256e59dbf549e3388b6e5fe76aec90ad3bc5375673b4483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570383fa9ad104010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e9e6916db156b3bdeb1053080841967cbfc6ef86ac933667fbb04ca5427b551604483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703e1d4a8ce04010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e34fb4bfeb7e6cd6a3ab6d59139783748cec60408f91c7ce296a39d01c5bb29974483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703a9b6b6c004010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e4fdb42acd18b165e1622ba3249f6c45cb06b66d2082545b8902c6000f2c02f2a4483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703cdeca9bf04010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e2255d1f1b3967ce291c42f020d302b4a3e2b1ad11b45cabe2e5da8ca94fdb8c64483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703c0f79cbe04010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435020188010085014483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570380badadc16015e0020d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d4925102d41716001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb43500013d003b4483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f57039aaf660116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
  'signatures': [
    ['718a54649e43dcccf3b4e855fd9bf4ea23d5bd05517540eea09e2eb96ebc5b59dcfa4741b3280ec8aae003b276482cb51e2b967087d7821cae5e2d469c245100'],
    ['57032992d83e998325a385d247670175d8fc031e117c54d7b14fb887f276947907321d4cef2a592fb25737092353b96252a9dcb943ab4588a9fde42df32a470e'],
    ['0f521a9fc08b32053cac86e845fae332928d6588aa1039a72c41fe1d9f5418d6a333be2754e83405eed4303ebcb2ddc908792fb3761cd12dcd3154354f64670c'],
    ['8a30dc5d085f701466f3918a88eb5322835860956e33cd8fbb1c3e1afffb8695fe0bc2eac83cd43f365422cdf9e8358af611b3b031b99eb233c984c93fc0c40d'],
    ['7e2d41ddd5b2d15b32375c46cb6807dba4d3d6e6cedb36fef04d4e11a971c1e4495cb0d633738d6113cacc7adb004ab1703f76954d2c952408a509d78d439e0a']
  ],
  'client_id': '123'
}

# Response
{
   "code":200,
   "msg":"",
   "result":{
      "data":{
         "tx_hash":"da7043bd2086d8cfec8b4c71c496c0e8d0aa54863c0dd22550a505980334bf49"
      }
   }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 如何取消订单(示例)

首先我们提交取消订单的请求

POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/build-cancel-order-tx?address="您的侧链地址"
{
  'order_id': 6100
}
1
2
3
4

之后我们对返回的结果进行签名,并将签名信息提交到submit-cancel-order-tx

POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-cancel-order-tx?address="您的侧链地址"
{
  'raw_transaction': '070100050160015ea36a32db05dde6387a1af256e59dbf549e3388b6e5fe76aec90ad3bc5375673b4483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570383fa9ad104010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e9e6916db156b3bdeb1053080841967cbfc6ef86ac933667fbb04ca5427b551604483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703e1d4a8ce04010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e34fb4bfeb7e6cd6a3ab6d59139783748cec60408f91c7ce296a39d01c5bb29974483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703a9b6b6c004010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e4fdb42acd18b165e1622ba3249f6c45cb06b66d2082545b8902c6000f2c02f2a4483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703cdeca9bf04010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb4350160015e2255d1f1b3967ce291c42f020d302b4a3e2b1ad11b45cabe2e5da8ca94fdb8c64483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f5703c0f79cbe04010116001449f9cb425163e24791f39e9189a7ef3126a0fe0a22012066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435020188010085014483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570380badadc16015e0020d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d4925102d41716001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb43500013d003b4483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f57039aaf660116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
  'signatures': [
    ['718a54649e43dcccf3b4e855fd9bf4ea23d5bd05517540eea09e2eb96ebc5b59dcfa4741b3280ec8aae003b276482cb51e2b967087d7821cae5e2d469c245100'],
    ['57032992d83e998325a385d247670175d8fc031e117c54d7b14fb887f276947907321d4cef2a592fb25737092353b96252a9dcb943ab4588a9fde42df32a470e'],
    ['0f521a9fc08b32053cac86e845fae332928d6588aa1039a72c41fe1d9f5418d6a333be2754e83405eed4303ebcb2ddc908792fb3761cd12dcd3154354f64670c'],
    ['8a30dc5d085f701466f3918a88eb5322835860956e33cd8fbb1c3e1afffb8695fe0bc2eac83cd43f365422cdf9e8358af611b3b031b99eb233c984c93fc0c40d'],
    ['7e2d41ddd5b2d15b32375c46cb6807dba4d3d6e6cedb36fef04d4e11a971c1e4495cb0d633738d6113cacc7adb004ab1703f76954d2c952408a509d78d439e0a']
  ],
  'client_id': '123'
}
1
2
3
4
5
6
7
8
9
10
11
12

# 查询订单 (查询某类状态的订单)

通过指定的参数查询满足条件的订单

# Request

POST /api/v3/vapor/mov/merchant/list-orders?address="您的侧链地址"

# Params

  • String- address:您的侧链地址

# Body

  • String- side:买或者卖,不填表示所有订单
    • buy:买单
    • sell:卖单
  • String- filter:过滤器,具体选项如下
    • open:未成交的订单
    • partial:部分成交的订单
    • filled:全部成交的订单
    • cancelled:已撤销的订单
    • submitted:已提交,但还未上链,无法撤销的订单

# Response

  • Array- data:订单数组
    • String- symbol:交易对
    • String- side:买或者卖
    • Int- order_id:订单ID
    • String- open_price:挂单的价格
    • String- deal_price:成交的价格
    • String- amount:挂单数量
    • String- filled_amount:订单完成数量
    • String- fee_amount:手续费
    • String- status:订单状态
    • String- type:订单类型
    • String- client_id:附加的订单信息
    • Array- order_txs:批量传入订单的Hash等结构
      • String-hash:订单哈希
      • String-type:订单类型
      • Double-timestamp:订单写入到数据库的时间
    • String- order_timestamp:订单创建的时间戳
    • String- update_timestamp:订单更新的时间戳
  • 示例:
# Request
POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/list-orders?address="您的侧链地址"

{
  'symbol': 'BTC/USDT',
  'side': '',
  'filter': {
    'states': ['open', 'partial']   
  }
}


# Response
{
   "code":200,
   "msg":"",
   "result":{
      "_links":{

      },
      "data":[
         {
            "symbol":"BTM/USDT",
            "side":"sell",
            "order_id":535154,
            "open_price":"0.0800000000",
            "deal_price":"0.0000000000",
            "amount":"10.00",
            "filled_amount":"0.00",
            "fee_amount":"0.000000",
            "status":"open",
            "type":"mov",
            "client_id":"123",
            "order_txs":[
               {
                  "hash":"3ff7a447bbeac87f988c73ab79ceb7e989d9ab11c808b328946e2fcd83ebc39b",
                  "type":"mov_place_order",
                  "timestamp":1588937712
               }
            ],
            "order_timestamp":1588937712,
            "update_timestamp":1588937713
         },
         {
            "symbol":"BTM/USDT",
            "side":"sell",
            "order_id":533143,
            "open_price":"0.0800000000",
            "deal_price":"0.0000000000",
            "amount":"10.00",
            "filled_amount":"0.00",
            "fee_amount":"0.000000",
            "status":"open",
            "type":"mov",
            "client_id":"123",
            "order_txs":[
               {
                  "hash":"d647ef9564d52a27dcd5176ea32dabec434e6e2de702cebeb9164ced4b5c464f",
                  "type":"mov_place_order",
                  "timestamp":1588927928
               }
            ],
            "order_timestamp":1588927928,
            "update_timestamp":1588927929
         }
      ],
      "limit":1000,
      "start":0
   }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

# 查询订单 (查询批量订单)

通过指定的参数查询满足条件的订单

# Request

POST /api/v3/vapor/mov/merchant/search-orders?address="您的侧链地址"

# Params

  • String- address:您的侧链地址

# Body

  • Array- order_ids:批量传入的订单id

# Response

  • Array- data:订单数组
    • String- symbol:交易对
    • String- side:买或者卖
    • Int- order_id:订单ID
    • String- open_price:挂单的价格
    • String- deal_price:成交的价格
    • String- amount:挂单数量
    • String- filled_amount:订单完成数量
    • String- fee_amount:手续费
    • String- status:订单状态
    • String- type:订单类型
    • String- client_id:附加的订单信息
    • Array- order_txs:批量传入订单的Hash等结构
      • String-hash:订单哈希
      • String-type:订单类型
      • Double-timestamp:订单写入到数据库的时间
    • String- order_timestamp:订单创建的时间戳
    • String- update_timestamp:订单更新的时间戳
  • 示例:
# Request
POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/search-orders?address="您的侧链地址"

{
  "order_ids": [535154]
}

# Response
{
   "code":200,
   "msg":"",
   "result":{
      "data":[
         {
            "symbol":"BTM/USDT",
            "side":"sell",
            "order_id":535154,
            "open_price":"0.0800000000",
            "deal_price":"0.0000000000",
            "amount":"10.00",
            "filled_amount":"0.00",
            "fee_amount":"0.000000",
            "status":"open",
            "type":"mov",
            "client_id":"123",
            "order_txs":[
               {
                  "hash":"3ff7a447bbeac87f988c73ab79ceb7e989d9ab11c808b328946e2fcd83ebc39b",
                  "type":"mov_place_order",
                  "timestamp":1588937712
               }
            ],
            "order_timestamp":1588937712,
            "update_timestamp":1588937713
         }
      ]
   }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Last Updated: 5/25/2020, 11:21:11 AM