# 超导产品API

MOV市场可以分为磁力兑换市场和闪电兑换市场,所以MOV做市也分为在磁力兑换市场做市和闪电兑换市场做市。目前可以通过MOV Server提供的RESTful API或MOV-MMDK在两个市场做市。

# 做市架构

做市架构

# 做市原理

MOV Server只是提供订单与交易之间的相互转化,实际上所有的订单都是由用户签名后提交, 并最终由智能合约进行撮合的过程。 MOV Server提供了与中心化交易所接近一致的API接口,其交易时的API使用体验,基本与中心化交易所一致,但依然有一些不同,下面我们将会进行说明。

# API简要目录

  • symbols 获取市场所有交易对
  • exchange-rate 获取交易对兑换价格
  • pool-info 获取交易所存币总金额
  • build-exchange 构造超导兑换请求
  • submit-exchange 构造超导兑换请求

BaseURL:https://ex.movapi.com/superconducting

# 获取市场所有交易对

返回MOV超导兑换的所有的交易对信息

# Request

GET /v1/symbols

# Response

名称 类型 描述
price_decimal String 交易对报价的精度(小数点后位数)
amount_decimal String 交易对数量的精度(小数点后位数)
base_asset Object 基础货币的对象
asset_id String 基础货币的ID
symbol String 基础货币的名称
quote_asset Object 基础货币的对象
asset_id String 基础货币的ID
symbol String 基础货币的名称

示例

# Request
GET https://ex.movapi.com/superconducting/v1/symbols

# Response
{
   "code":200,
   "msg":"",
   "data":[
      {
         "price_decimal":4,
         "amount_decimal":4,
         "base_asset":{
            "asset_id":"c4644dd6643475d57ed624f63129ab815f282b61f4bb07646d73423a6e1a1563",
            "symbol":"USDC"
         },
         "quote_asset":{
            "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
            "symbol":"USDT"
         }
      },
      {
         "price_decimal":4,
         "amount_decimal":4,
         "base_asset":{
            "asset_id":"25f2069140fa3ff4d6e0dc1d0fcaa11ace01eb721f115f0f1a5a3782db597fb1",
            "symbol":"DAI"
         },
         "quote_asset":{
            "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
            "symbol":"USDT"
         }
      },
      {
         "price_decimal":4,
         "amount_decimal":4,
         "base_asset":{
            "asset_id":"25f2069140fa3ff4d6e0dc1d0fcaa11ace01eb721f115f0f1a5a3782db597fb1",
            "symbol":"DAI"
         },
         "quote_asset":{
            "asset_id":"c4644dd6643475d57ed624f63129ab815f282b61f4bb07646d73423a6e1a1563",
            "symbol":"USDC"
         }
      }
   ]
}

# 获取交易对兑换价格

返回超导交易交易对兑换的价格

# Request

GET /v1/exchange-rate

# Params

名称 必选 类型 描述
symbol String 查询深度的交易对,比如DAI/USDT
amount String 查询的兑换金额,默认为1
side String 查询的兑换方向,填buy或sell

# Response

名称 类型 描述
amount String 交易金额
exchange_rate String 实际兑换汇率
base_exchange_rate String 参考兑换汇率
oracle_exchange_rate String 预言机汇率

示例

# Request
GET https://ex.movapi.com/superconducting/v1/exchange-rate?symbol=DAI/USDT&amount=100&side=buy

# Response
{
   "code":200,
   "msg":"",
   "data":{
      "amount":"500",
      "exchange_rate":"0.998817",
      "base_exchange_rate":"0.999323",
      "oracle_exchange_rate":"1"
   }
}

# 获取交易所存币总金额

返回超导池子里,各个交易对有多少钱

# Request

GET /v1/pool-info

# Response

名称 类型 描述
symbol String 交易对
base_amount String base资产数量
quote_amount String quote资产数量
total_amount String 总量

示例

# Request
GET https://ex.movapi.com/superconducting/v1/pool-info

# Response
{
   "code":200,
   "msg":"",
   "data":[
      {
         "symbol":"USDC/USDT",
         "base_amount":"510487.766162",
         "quote_amount":"563948.740743",
         "total_amount":"1074436.506905"
      },
      {
         "symbol":"DAI/USDT",
         "base_amount":"174766.143552",
         "quote_amount":"808404.879614",
         "total_amount":"983171.023166"
      },
      {
         "symbol":"DAI/USDC",
         "base_amount":"91427.196482",
         "quote_amount":"445954.744501",
         "total_amount":"537381.940983"
      }
   ]
}

# 构造超导兑换请求

构造超导交易兑换的请求

# Request

GET /v1/build-exchange

# Params

名称 必选 类型 描述
address String 账户地址

# Body

名称 必选 类型 描述
pubkey String 公钥
symbol String 基本币对
side String 报价方向
amount String 报价总金额
exchange_rate String 报价汇率

# Response

名称 类型 描述
tx Object 交易的对象
hash String 交易哈希
status_fail Bool 交易是否为一笔手续费耗尽的无效交易
size Int 交易体积
submission_timestamp Int 交易提交的时间戳
memo String Memo信息
inputs Array UTXO输入
script String 脚本地址
address String 地址
asset Object 资产对象
asset_id String 资产ID
symbol String 资产代码
amount Int 资产数量
type String UTXO类型
outputs Array UTXO输出
script String 脚本地址
address String 地址
asset String 资产ID
amount Int 资产数量
type String UTXO类型
fee Int 交易手续费
balances Array 资产金额变动
asset String 资产ID
amount Int 资产数量
types Array 交易类型
chain_tx:链式合并UTXO 交易
mov_matched_tx:磁力合约成交交易
mov_place_order:磁力合约挂单交易
mov_cancel_order:磁力合约取消挂单交易
mov_cancel_order:闪兑交易
raw_transaction String 待签名的交易信息
signing_instructions Array 交易需要签名的信息
derivation_path Array 派生路径
sign_data Array 签名数据
pubkey String 公钥
# Request
POST https://ex.movapi.com/superconducting/v1/build-exchange?address=vp1qzpm9pqf3phngkv9qnv73tgtr2mzdnxpdswphm3

{
   "pubkey":"b66e20a477fefef087cb1fc70c7cea09c53cb072b8b22bf80b5f15890a8a0daf",
   "symbol":"DAI/USDT",
   "side":"buy",
   "amount":"0.1",
   "exchange_rate":"0.977421"
}

# Response
{
   "code":200,
   "msg":"",
   "data":[
      {
         "tx":{
            "hash":"2ee2299dfdff9e26a5a0eb12733202ad959a86f76fa65693a850a6229a00cb2c",
            "status":True,
            "size":263,
            "submission_timestamp":0,
            "memo":"",
            "inputs":[
               {
                  "script":"0014fe0b2ba5ef7176083702e2b67cdf37b862e4375f",
                  "address":"vp1qlc9jhf00w9mqsdczu2m8ehehhp3wgd6lfvyluc",
                  "asset":{
                     "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
                     "symbol":"USDT"
                  },
                  "amount":"0.112687",
                  "type":"spend"
               }
            ],
            "outputs":[
               {
                  "utxo_id":"77122548d46a644e7e941587bde15d12c5bfa5e51467ee79c09cf8cf01d9d503",
                  "script":"0014e45c93204670591cf4568bb53024225987d2bd9c",
                  "address":"vp1qu3wfxgzxwpv3eazk3w6nqfpztxra90vuvh3v56",
                  "asset":{
                     "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
                     "symbol":"USDT"
                  },
                  "amount":"0.1",
                  "type":"control"
               },
               {
                  "utxo_id":"77762e1a08d5359677306f1c169772eb115115e039afa1f12ae0ab4fb61d4395",
                  "script":"0014fe0b2ba5ef7176083702e2b67cdf37b862e4375f",
                  "address":"vp1qlc9jhf00w9mqsdczu2m8ehehhp3wgd6lfvyluc",
                  "asset":{
                     "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
                     "symbol":"USDT"
                  },
                  "amount":"0.012687",
                  "type":"control"
               }
            ],
            "fee":"0",
            "balances":[
               {
                  "asset":{
                     "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
                     "symbol":"USDT"
                  },
                  "amount":"-0.1"
               }
            ],
            "types":[
               "ordinary"
            ]
         },
         "raw_transaction":"07010001015e015c0bb26ace224218e8e782adcbd90e72f787c1a84d31cfc3014fa06bc87361eed6184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46aff0060201160014fe0b2ba5ef7176083702e2b67cdf37b862e4375f220120b66e20a477fefef087cb1fc70c7cea09c53cb072b8b22bf80b5f15890a8a0daf02013d003b184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46a08d0601160014e45c93204670591cf4568bb53024225987d2bd9c00013c003a184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd468f6301160014fe0b2ba5ef7176083702e2b67cdf37b862e4375f00",
         "signing_instructions":[
            {
               "derivation_path":[
                  "2c000000",
                  "99000000",
                  "01000000",
                  "00000000",
                  "01000000"
               ],
               "sign_data":[
                  "73e3000f7f6eb98ad2fcce58ad0479f22845aca9d74c3b42b54787fa1819496f"
               ],
               "pubkey":"b66e20a477fefef087cb1fc70c7cea09c53cb072b8b22bf80b5f15890a8a0daf"
            }
         ]
      }
   ]
}

# 提交超导兑换请求

构造超导交易兑换的请求

# Request

GET /v1/submit-exchange

# Params

名称 必选 类型 描述
address String 账户地址

# Body

名称 必选 类型 描述
raw_transaction String 上一个build-exchange接口返回的数据
signatures Array 签名数据

# Response

名称 类型 描述
tx_hash String 交易哈希
order Object 订单
symbol String 交易对,比如DAI/USDT
side String 交易方向,buy:买单,sell:卖单
base_amount String 基础金额
quote_amount String 报价金额
build_exchange_rate String 兑换汇率
tx_hash String 交易哈希
fee String 交易费率
timestamp Int64 订单更新时间

示例

# Request
GET https://ex.movapi.com/superconducting/v1/submit-exchange?address=vp1qzpm9pqf3phngkv9qnv73tgtr2mzdnxpdswphm3

{
   "raw_transaction":"07010001015e015ce590d63398cccf34b9005689c2b608c7609baf7fe06a57b1370abb7aa983a992184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46f8f0060001160014fe0b2ba5ef7176083702e2b67cdf37b862e4375f220120b66e20a477fefef087cb1fc70c7cea09c53cb072b8b22bf80b5f15890a8a0daf02013d003b184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46a08d0601160014e45c93204670591cf4568bb53024225987d2bd9c00013c003a184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46d86301160014fe0b2ba5ef7176083702e2b67cdf37b862e4375f00",
   "signatures":[
      [
         "3f9c28bd3b883fae75ec60fb3b381767d5671a73ffa0e1cc44debfca828395574816d0da27879be2990ef5abf742ac1f905f3dd0a643f745ac253f5189101c01"
      ]
   ]
}

# Response

{
   "code":200,
   "msg":"",
   "data":{
      "tx_hash":"2ee2299dfdff9e26a5a0eb12733202ad959a86f76fa65693a850a6229a00cb2c",
      "order":{
         "order_id":227695,
         "symbol":"DAI/USDT",
         "side":"buy",
         "base_amount":"0.097672",
         "quote_amount":"0.100000",
         "build_exchange_rate":"0.9767210000",
         "tx_hash":"2ee2299dfdff9e26a5a0eb12733202ad959a86f76fa65693a850a6229a00cb2c",
         "fee":"0.000048",
         "type":"superconducting_swap",
         "timestamp":1595498532
      }
   }
}
上次更新: 10/23/2020, 3:30:56 PM