BYBIT 创建活动委托单

1.USDT永续合约下单:

logging.info(test.create_order('BITUSDT','Buy', quantity=1.01, price=2.4001))

# 返回:
{'ret_code': 10001, 'ret_msg': 'Price err', 'ext_code': '', 'ext_info': '', 'result': None, 'time_now': '1637657028.650889', 'rate_limit_status': 99, 'rate_limit_reset_ms': 1637657028648, 'rate_limit': 100}
# 原因:最小价格变化为0.001,也就是只能有三位小数,这里有4位小数。

失败原因:最小价格变化为0.001,也就是只能有三位小数,这里有4位小数。更正如下:

logging.info(test.create_order('BITUSDT','Buy', quantity=1.01, price=2.401))

# 返回:
 {'ret_code': 0, 'ret_msg': 'OK', 'ext_code': '', 'ext_info': '', 'result': {'order_id': 'd265a3ea-d5a3-4d17-865b-6863bfc13003', 'user_id': 3506111, 'symbol': 'BITUSDT', 'side': 'Buy', 'order_type': 'Limit', 'price': 2.401, 'qty': 1, 'time_in_force': 'GoodTillCancel', 'order_status': 'Created', 'last_exec_price': 0, 'cum_exec_qty': 0, 'cum_exec_value': 0, 'cum_exec_fee': 0, 'reduce_only': False, 'close_on_trigger': False, 'order_link_id': '', 'created_time': '2021-11-23T08:47:36Z', 'updated_time': '2021-11-23T08:47:36Z', 'take_profit': 0, 'stop_loss': 0, 'tp_trigger_by': 'UNKNOWN', 'sl_trigger_by': 'UNKNOWN'}, 'time_now': '1637657256.971028', 'rate_limit_status': 99, 'rate_limit_reset_ms': 1637657256966, 'rate_limit': 100}

2反向永续拿合约下单:

logging.info(test.create_order('BITUSD','Sell', quantity=1.5, price=2.7011))

# 返回:
{'ret_code': 10001, 'ret_msg': 'bind error:strconv.ParseInt: parsing "1.5": invalid syntax', 'ext_code': '', 'ext_info': '', 'result': None, 'time_now': '1637657457.082083', 'rate_limit_status': 99, 'rate_limit_reset_ms': 1637657457079, 'rate_limit': 100}

出错原因:最小订单数为1USD, 这时用了1.5。更正如下:

logging.info(test.create_order('BITUSD','Sell', quantity=1, price=2.7011))

# 返回
{'ret_code': 0, 'ret_msg': 'OK', 'ext_code': '', 'ext_info': '', 'result': {'user_id': 3506111, 'order_id': 'a297af93-df29-4dc3-afb0-c3c88d2cc50d', 'symbol': 'BITUSD', 'side': 'Sell', 'order_type': 'Limit', 'price': 2.701, 'qty': 1, 'time_in_force': 'GoodTillCancel', 'order_status': 'Created', 'last_exec_time': 0, 'last_exec_price': 0, 'leaves_qty': 1, 'cum_exec_qty': 0, 'cum_exec_value': 0, 'cum_exec_fee': 0, 'reject_reason': 'EC_NoError', 'order_link_id': '', 'created_at': '2021-11-23T08:53:42.900Z', 'updated_at': '2021-11-23T08:53:42.900Z', 'take_profit': '0.000', 'stop_loss': '0.000', 'tp_trigger_by': 'UNKNOWN', 'sl_trigger_by': 'UNKNOWN'}, 'time_now': '1637657622.901103', 'rate_limit_status': 98, 'rate_limit_reset_ms': 1637657622898, 'rate_limit': 100}

3.现货下单:

logging.info(test.create_order('bitusdt','Sell', quantity=4.001, price=2.7011))

# 返回
{'ret_code': -1134, 'ret_msg': 'Order price decimal too long.', 'ext_code': None, 'ext_info': None, 'result': None}

logging.info(test.create_order('bitusdt','Sell', quantity=3.7001, price=2.701))

# 返回
{'ret_code': -1137, 'ret_msg': 'Order volume decimal too long', 'ext_code': None, 'ext_info': None, 'result': None}

出错原因:第一次是价格精度太长了,第二次是数量精度长太了。下单数量及价格分别是最多支持3位小数、2位小数。更正如下:

logging.info(test.create_order('bitusdt','Sell', quantity=3.71, price=2.701))

# 返回:
{'ret_code': 0, 'ret_msg': '', 'ext_code': None, 'ext_info': None, 'result': {'accountId': '4063428', 'symbol': 'BITUSDT', 'symbolName': 'BITUSDT', 'orderLinkId': '1637668674590267', 'orderId': '1031234017554391808', 'transactTime': '1637668674599', 'price': '2.701', 'origQty': '3.71', 'executedQty': '0', 'status': 'NEW', 'timeInForce': 'GTC', 'type': 'LIMIT', 'side': 'SELL'}}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值