MCPcopy Create free account
hub / github.com/ccxt/ccxt / parseOrder

Method parseOrder

ts/src/whitebit.ts:2468–2564  ·  view source on GitHub ↗
(order: Dict, market: Market = undefined)

Source from the content-addressed store, hash-verified

2466 }
2467
2468 parseOrder (order: Dict, market: Market = undefined): Order {
2469 //
2470 // createOrder, fetchOpenOrders, cancelOrder
2471 //
2472 // {
2473 // "orderId":105687928629,
2474 // "clientOrderId":"",
2475 // "market":"DOGE_USDT",
2476 // "side":"sell",
2477 // "type":"stop market",
2478 // "timestamp":1659091079.729576,
2479 // "dealMoney":"0", // executed amount in quote
2480 // "dealStock":"0", // base filled amount
2481 // "amount":"100",
2482 // "takerFee":"0.001",
2483 // "makerFee":"0",
2484 // "left":"100",
2485 // "price": "40000", // price if price isset
2486 // "dealFee":"0",
2487 // "activation_price":"0.065" // stop price (if stop limit or stop market)
2488 // }
2489 //
2490 // fetchClosedOrders
2491 //
2492 // {
2493 // "id":105531094719,
2494 // "clientOrderId":"",
2495 // "ctime":1659045334.550127,
2496 // "ftime":1659045334.550127,
2497 // "side":"buy",
2498 // "amount":"5.9940059", // cost in terms of quote for regular market orders, amount in terms or base for all other order types
2499 // "price":"0",
2500 // "type":"market",
2501 // "takerFee":"0.001",
2502 // "makerFee":"0",
2503 // "dealFee":"0.0059375815",
2504 // "dealStock":"85", // base filled amount
2505 // "dealMoney":"5.9375815", // executed amount in quote
2506 // }
2507 //
2508 const marketId = this.safeString (order, 'market');
2509 market = this.safeMarket (marketId, market, '_');
2510 const symbol = market['symbol'];
2511 const side = this.safeString (order, 'side');
2512 const filled = this.safeString (order, 'dealStock');
2513 let remaining = this.safeString (order, 'left');
2514 let clientOrderId = this.safeString (order, 'clientOrderId');
2515 if (clientOrderId === '') {
2516 clientOrderId = undefined;
2517 }
2518 const price = this.safeString (order, 'price');
2519 const triggerPrice = this.safeNumber (order, 'activation_price');
2520 const orderId = this.safeString2 (order, 'orderId', 'id');
2521 const type = this.safeString (order, 'type');
2522 const orderType = this.parseOrderType (type);
2523 if (orderType === 'market') {
2524 remaining = undefined;
2525 }

Callers 5

fetchOrderMethod · 0.95
createOrderMethod · 0.95
editOrderMethod · 0.95
cancelOrderMethod · 0.95
fetchClosedOrdersMethod · 0.95

Calls 11

parseOrderTypeMethod · 0.95
parseOrderStatusMethod · 0.95
safeStringMethod · 0.45
safeMarketMethod · 0.45
safeNumberMethod · 0.45
safeString2Method · 0.45
parseNumberMethod · 0.45
safeTimestamp2Method · 0.45
safeTimestampMethod · 0.45
safeOrderMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected