-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added extra optional parameter "bid_amount_money" to "order.put_market_stock" RPC. #36
base: master
Are you sure you want to change the base?
Conversation
@djpnewton @haipome Any plans to merge it? 😄 |
its up to @haipome but I would be happy |
@djpnewton Hey, any updates on this guys? |
I guess I just need some feedback from @haipome on whether he is ok with the direction of this PR |
} | ||
} else { | ||
if (mpd_cmp(taker->left, maker->left, &mpd_ctx) < 0) { | ||
mpd_copy(amount, taker->left, &mpd_ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(More of a stylistic and lower priority comment than anything else.)
For a file of this size, could we not replace many of the if/else blocks with a ternary operator, to improve code readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure but perhaps that kind of stylistic change should probably be in a dedicated PR
fuck, me_loader.c int ret = market_put_market_order(false, NULL, market, user_id, side, amount, taker_fee, source, /* bid_amount_money what to do? */); me_loader.c Market records for loading databases, but the database does not have bid_amount_money, How to fill bid_amount_money when loading? |
ec54fa4
to
158d832
Compare
I have rebased this PR to master |
when i check the deal.stock and deal.money on finished orders using the change with the optional parameter market orders, the returned values are zero. Is this expected behavior? |
This function is useful. I will read and test careful before merge it into master |
This code has a serious bug. Sometimes the deal's money exceeds the user's balance. Because of the calculation problem on these lines of code:
Then matching engine try to subtract this
But the balance is not enough and the balance_sub method return |
The problem is on balance calculation. This line should be moved after the balance check:
|
oh i see, money_required is being freed too soon |
updated |
f49f462
to
1a5541a
Compare
rebased |
the "amount" parameter now refers to the order "stock"
…t_stock" RPC. Default value is true and has no change to behavior. If the value is false then the "amount" parameter of a market bid is treated as "stock" instead of "money"
1a5541a
to
3f789c2
Compare
any update on this? currently this functionality cannot be used as: "I want to buy x amount stock from the market". I believe this is a de facto standard among exchange services. They all provide "stock amount" in market orders. |
Default value is true and has no change to behavior. If the value is false then the "amount" parameter of a market bid is treated as "stock" instead of "money"
see also issue #32
replaces #35