Skip to content

Commit 158d832

Browse files
committed
update me_load.c
1 parent c1f2be1 commit 158d832

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

matchengine/me_load.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int load_limit_order(json_t *params)
262262

263263
static int load_market_order(json_t *params)
264264
{
265-
if (json_array_size(params) != 6)
265+
if (json_array_size(params) != 6 && json_array_size(params) != 7)
266266
return -__LINE__;
267267

268268
// user_id
@@ -313,7 +313,16 @@ static int load_market_order(json_t *params)
313313
if (strlen(source) > SOURCE_MAX_LEN)
314314
goto error;
315315

316-
int ret = market_put_market_order(false, NULL, market, user_id, side, amount, taker_fee, source);
316+
// bid amount money (should the bid amount be treated as "money" or "stock")
317+
// optional parameter, default is true
318+
bool bid_amount_money = true;
319+
if (json_array_size(params) == 7) {
320+
if (!json_is_boolean(json_array_get(params, 6)))
321+
goto error;
322+
bid_amount_money = json_boolean_value(json_array_get(params, 6));
323+
}
324+
325+
int ret = market_put_market_order(false, NULL, market, user_id, side, amount, taker_fee, source, bid_amount_money);
317326

318327
mpd_del(amount);
319328
mpd_del(taker_fee);

0 commit comments

Comments
 (0)