Skip to content

034send_order

ipqhjjybj edited this page May 9, 2020 · 15 revisions

Send Order V2 Version

  • Request description: send order

  • Request type: POST

  • Signature required: Yes

  • First do:

  • Request Url:https://bcapi.movapi.com/api/v2/vapor/mov/merchant/build-place-order-tx

  • Request parameter:

    name type description
    guid string the account id
    price string the string of the price
    amount string the string of the amount
    side string buy / sell
    symbol string BTC / USDT
  • Return value description:

    name type description
    hash string the hash of the transaction
    status_fail bool not important
    size int not important
    submission_timestamp int the timestamp that when submit
    inputs array the array of the script data , as the input
    outputs array the array of the script data , as the output
    fee int the cost fee
    balances array the balance information
    types array not important
    raw_transaction string the trade record which should be sign
    signing_instructions array the instructions that need for signing
  • Then do:

  • First N-1 Request Url:https://bcapi.movapi.com/api/v2/vapor/merchant/submit-payment

  • Request parameter:

    name type description
    guid string the account id
    raw_transaction string the account id
    signatures array the array of the sinature data
  • Return value description:

    name type description
    transaction_hash string the hash of the transaction
  • Last Request Url:https://bcapi.movapi.com/api/v2/vapor/mov/merchant/submit-place-order-tx

  • Request parameter:

    name type description
    guid string the account id
    raw_transaction string the transaction info
    signatures array the array of the sinature data
  • Return value description:

    name type description
    transaction_hash string the hash of the transaction
    order_id int the id of the order
  • Example:

# Request
First you should build the order

{
  'guid': '80f95d4c-65e0-4706-83d6-96e3184dddf7',
  'price': '6100',
  'amount': '0.01',
  'side': 'buy',
  'symbol': 'BTC/USDT'
}

POST https://bcapi.movapi.com/api/v2/vapor/mov/merchant/build-cancel-order-tx


# Response

{
  'code': 200,
  'msg': '',
  'result': {
    'data': [
      'tx': {
        'hash': 'e0b8c28b7d3c25f1541db1428fabec14b164ff23abfc00fa84e5b10e8bf84f81',
        'status_fail': False,
        'size': 245,
        'submission_timestamp': 0,
        'memo': '',
        'inputs': [{
          'script': '00204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f57030325790d016416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435',
          'address': 'smart contract',
          'asset': 'd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492',
          'amount': 264389400,
          'type': 'spend'
        }],
        'outputs': [{
          'utxo_id': '43986762af30a808d1e36900835acc726e3ad42bf2a7ad670d866b58381dc690',
          'script': '001449f9cb425163e24791f39e9189a7ef3126a0fe0a',
          'address': 'tp1qf8uuksj3v03y0y0nn6gcnfl0xyn2pls2zzy8pz',
          'asset': 'd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492',
          'amount': 264389400,
          'type': 'control'
        }],
        'fee': 0,
        'balances': [{
          'asset': 'd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492',
          'amount': '264389400'
        }],
        'types': ['ordinary']
      },
      'raw_transaction': '0701000101aa0101a70195555343f37e792c689102aa4ca43ae880ef98666c3fb87270a60954b2c93f68d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d4929886897e00016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f57030325790d016416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435010001013e003cd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d4929886897e0116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
      'signing_instructions': [{
        'derivation_path': ['2c000000', '99000000', '01000000', '00000000', '01000000'],
        'sign_data': ['4560b3cc518fadba09cc7764f370278285025fe6fa76a05dcef5674e122bdc49']
      }],
      'fee': 0
    ]
  }
}

You can see that there is N(N>=1) dictionary in data,

For first N-1 dictionary , you should send to /api/v2/vapor/merchant/submit-payment

As for the last dic, you should send to /api/v2/vapor/mov/merchant/submit-place-order-tx

For every data you send , you should dealing them as below:

You should use secret_key to encode such data

send data such as:

{
  'guid': '80f95d4c-65e0-4706-83d6-96e3184dddf7',
  'raw_transaction': '0701000101aa0101a701298c6ec482ccbab07427361741de38005a166affdab94fa9a1ceff77ba48b749d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b00016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f570303e5b102011416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435010001013e003cd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492e080a57b0116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
  'signatures': [
    ['e94004a6f532bc6cff0b2f2ad83dc478b8e0187ec6bddd6b4c1fd2e22f275e64f848bdb106763c22df41882d6fbbbbfe50f5cbd0630c10e7bea3831a230ba40b']
  ],
  'client_id': '123'
}


For first N-1 request

POST https://bcapi.movapi.com/api/v2/vapor/merchant/submit-payment

# Response

{
    "guid":"03f8d45a-6755-44f8-8342-32c78839f1bc",
    "raw_transaction":"070100010160015e26978b848afd77d559980e58db9b60559b716312bd1e24af7e44c6efa5c1605dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0a885fd0201011600140ff923ae0944af0cfdd3eb3671db354eaa6b5795220120c44537a8d397ee09315755cd77fd02d66db015f32ba358c3bfafe20d887d041202013cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f011600141e03ad3233693b551be8c86f5db062bdbe0c9f6600013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8b292cd02011600140ff923ae0944af0cfdd3eb3671db354eaa6b579500",
    "signatures":[
        [
            "4f5e0b94f983ab6d98c230e7edf031951c93809af318d0bb6c362714794c38c5939df58e43ac1a45599d777386724354c0ced7bab54d19bac02c233fa9e2050a"
        ]
    ],
    "memo":"mock"
}


POST https://bcapi.movapi.com/api/v2/vapor/mov/merchant/submit-place-order-tx


# Response

{
  'code': 200,
  'msg': '',
  'result': {
    'data': {
      'transaction_hash': '665e657f91f2afe3c676bf94decb1f4062bd76030e2a9d2967193c3267582848',
      'orders': [{
        'order_id': 711076,
        'client_id': '123'
      }]
    }
  }
}

Send Order V3 Version

  • Request description: send order

  • Request type: POST

  • Signature required: Yes

  • First do:

  • Request Url:https://bcapi.movapi.com/api/v3/vapor/mov/merchant/build-place-order-tx?address=您的侧链地址

  • Request parameter:

    name type description
    price string the string of the price
    amount string the string of the amount
    side string buy / sell
    symbol string BTC / USDT
  • Return value description:

    name type description
    hash string the hash of the transaction
    status_fail bool not important
    size int not important
    submission_timestamp int the timestamp that when submit
    inputs array the array of the script data , as the input
    outputs array the array of the script data , as the output
    fee int the cost fee
    balances array the balance information
    types array not important
    raw_transaction string the trade record which should be sign
    signing_instructions array the instructions that need for signing
  • Then do:

  • First N-1 Request Url:https://bcapi.movapi.com/api/v3/vapor/merchant/submit-payment?address=您的侧链地址

  • Request parameter:

    name type description
    raw_transaction string the account id
    signatures array the array of the sinature data
  • Return value description:

    name type description
    transaction_hash string the hash of the transaction
  • Last Request Url:https://bcapi.movapi.com/api/v3/vapor/mov/merchant/submit-place-order-tx?address=您的侧链地址

  • Request parameter:

    name type description
    raw_transaction string the transaction info
    signatures array the array of the sinature data
  • Return value description:

    name type description
    transaction_hash string the hash of the transaction
    order_id int the id of the order
  • Example:

# Request
First you should build the order

{
  'pubkey': '',(不是必填,公钥(没有wallet的地址必填,否则返回错误))
  'price': '6100',
  'amount': '0.01',
  'side': 'buy',
  'symbol': 'BTC/USDT'
}

POST https://bcapi.movapi.com/api/v3/vapor/mov/merchant/build-cancel-order-tx?address=您的侧链地址


# Response

{
  'code': 200,
  'msg': '',
  'result': {
    'data': [
      'tx': {
        'hash': 'e0b8c28b7d3c25f1541db1428fabec14b164ff23abfc00fa84e5b10e8bf84f81',
        'status_fail': False,
        'size': 245,
        'submission_timestamp': 0,
        'memo': '',
        'inputs': [{
          'script': '00204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f57030325790d016416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435',
          'address': 'smart contract',
          'asset': 'd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492',
          'amount': 264389400,
          'type': 'spend'
        }],
        'outputs': [{
          'utxo_id': '43986762af30a808d1e36900835acc726e3ad42bf2a7ad670d866b58381dc690',
          'script': '001449f9cb425163e24791f39e9189a7ef3126a0fe0a',
          'address': 'tp1qf8uuksj3v03y0y0nn6gcnfl0xyn2pls2zzy8pz',
          'asset': 'd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492',
          'amount': 264389400,
          'type': 'control'
        }],
        'fee': 0,
        'balances': [{
          'asset': 'd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d492',
          'amount': '264389400'
        }],
        'types': ['ordinary']
      },
      'raw_transaction': '0701000101aa0101a70195555343f37e792c689102aa4ca43ae880ef98666c3fb87270a60954b2c93f68d50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d4929886897e00016000204483893ef7d9aac788c0e9e49a12398c1d35a2172adb1c8dc551fd169a6f57030325790d016416001449f9cb425163e24791f39e9189a7ef3126a0fe0a2066fb66a351b651ad70de9bdb1cafa3c95c10fc28d19d627cc3c3e34c090eb435010001013e003cd50a426bdaaf1458d161aba4d8c3ebdd095eac7e1bbeb4a0252a3737ccf2d4929886897e0116001449f9cb425163e24791f39e9189a7ef3126a0fe0a00',
      'signing_instructions': [{
        'derivation_path': ['2c000000', '99000000', '01000000', '00000000', '01000000'],
        'sign_data': ['4560b3cc518fadba09cc7764f370278285025fe6fa76a05dcef5674e122bdc49']
      }],
      'fee': 0
    ]
  }
}

You can see that there is N(N>=1) dictionary in data,

For first N-1 dictionary , you should send to /api/v3/vapor/merchant/submit-payment?address=您的侧链地址

As for the last dic, you should send to /api/v3/vapor/mov/merchant/submit-place-order-tx?address=您的侧链地址

For every data you send , you should dealing them as below:

You should use secret_key to encode such data

send data such as:

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


For first N-1 request

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

# Response

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


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


# Response
{
    "code": 200,
    "msg": "",
    "result": {
        "data":  {
            "transaction_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
            }
    }
}

MOV Trading API Introduction

MOV Exchange has such features.

HTTP API Introduction

Common API

Flash API

Spot API

WebSocket API Introduction


If any problems occur when using API, please contact us: support@8btc.com

Clone this wiki locally