viabtc / viabtc_exchange_server

A trading engine with high-speed performance and real-time notification
MIT License
2.68k stars 1.48k forks source link

question on market order #179

Closed objectt closed 5 years ago

objectt commented 5 years ago
int market_put_market_order(.....) {
....
mpd_t *balance = balance_get(user_id, BALANCE_TYPE_AVAILABLE, m->money);
if (!balance || mpd_cmp(balance, amount, &mpd_ctx) < 0)
  return -1;
....

@haipome What does this line imply? Does it mean you cannot bid below your total balance even though 'money' can worth way more than 'stock'?

qyangdu commented 5 years ago

The amount in market buy order is actual the money you want to pay, so it has to check you have enough money available.