内部市场交易类型显示的问题
上个月的时候,学习了一下内部市场要价(Ask)与出价(Bid)的区别
之后除了偶尔需要换STEEM或者换SBD的时候进一下内部市场,就很少登陆了。
内部市场交易类型都显示为买入
今天尝试了一下在内部市场挂单,竟然发现无论是买入STEEM还是卖出STEEM,挂单成功后显示的交易类型都是Buy, 吓我一身冷汗,我还以为我挂反了呢!如果持续高价买入,低价卖出,估计乐子就大了。那样不叫交易,叫送温暖。
(内部市场当前部分Orders)
(内部市场我的两笔挂单)
通过上边两图可以看出,若我的第二笔挂的是买单,早就应该成交的。
从代码上看程序对买入卖出没有区别
看了一下钱包代码,可以看出程序上是不区分啥买入卖出的
annotated_signed_transaction wallet_api::create_order( string owner, uint32_t order_id, asset amount_to_sell, asset min_to_receive, bool fill_or_kill, uint32_t expiration_sec, bool broadcast )
{
FC_ASSERT( !is_locked() );
limit_order_create_operation op;
op.owner = owner;
op.orderid = order_id;
op.amount_to_sell = amount_to_sell;
op.min_to_receive = min_to_receive;
op.fill_or_kill = fill_or_kill;
op.expiration = expiration_sec ? (fc::time_point::now() + fc::seconds(expiration_sec)) : fc::time_point::maximum();
signed_transaction tx;
tx.operations.push_back( op );
tx.validate();
return my->sign_transaction( tx, broadcast );
}
也就是说,实际上有几种情况:
- 买入STEEM, 付出SBD
- 卖出STEEM, 换取SBD
- 买入SBD, 付出STEEM
- 卖出SBD, 换取STEEM
其中1和4,2和3本质上是相同的,只是不同的视角
无论哪种情况,都是填充以下结构体并广播出去
struct limit_order_create_operation : public base_operation
(代码大家去github自己搜索,不贴出来凑数了。)
然后在这里被处理:
void limit_order_create_evaluator::do_apply( const limit_order_create_operation& o )
(代码大家去github自己搜索,不贴出来凑数了。)
可以通过指定标准来区别何为买入何为卖出
我测试时挂的卖出STEEM订单
我测试时挂的买入STEEM订单
尽管填充的是相同的结构体,但是买和卖的资产类型是对调的。
所以原则上,内部市场可以定出一个参考标准:
- min_to_receive处,资产类型是STEEM的定义成买单。
- min_to_receive处,资产类型是SBD的定义成卖单。
如此一来,在Open Orders显示成这样, 多直观啊
另外,顺便说一下,STEEM内部市场交易0手续费哦
你们各种交易牛,不来研究一下吗?
我有提过那错误显示 sell 为 buy . 这情况有好几星期了。
😄哦,这么说以前正确过呀,我还真没注意这事
以为一直都这样呢
是最近一两星期才砸了。
I really like your post, I will wait for the next posting
Very useful and quality ,can add my insight in everyday life,and hopefully the next post will be better again ,wish you all the best 👍
0手續費,要多去玩玩了,
可惜沒錢。土豪哭穷
土豪,在哪?我去抱大腿。
You also need to translate in English so other user can see.😉
i'm really like this post ,and i hope you can be make a post like this anymore
内部市场?在哪?咱也筹热闹去,谢谢
You mentioned that the error appears selling to buy. This situation has been for several weeks.
upvoted & followed you. kindly spread my post as much you can
or resteem it. because i really need support. https://steemit.com/story/@kumar.malhotra/dear-all-stemians-help-me-i-really-need-it-seriously
upvoted & followed you. kindly spread my post as much you can
or resteem it. because i really need support. https://steemit.com/story/@kumar.malhotra/dear-all-stemians-help-me-i-really-need-it-seriously