* @method * @name ascendex#createOrder * @description create a trade order on the exchange * @see https://ascendex.github.io/ascendex-pro-api/#place-order * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#new-order * @param {string} symbol unified CCXT market sy
(symbol: string, type: OrderType, side: OrderSide, amount: number, price: Num = undefined, params = {})
| 1793 | * @returns [An order structure]{@link https://docs.ccxt.com/?id=order-structure} |
| 1794 | */ |
| 1795 | async createOrder (symbol: string, type: OrderType, side: OrderSide, amount: number, price: Num = undefined, params = {}) { |
| 1796 | await this.loadMarkets (); |
| 1797 | await this.loadAccounts (); |
| 1798 | const market = this.market (symbol); |
| 1799 | const request = this.createOrderRequest (symbol, type, side, amount, price, params); |
| 1800 | let response: NullableDict = undefined; |
| 1801 | if (market['swap']) { |
| 1802 | response = await this.v2PrivateAccountGroupPostFuturesOrder (request); |
| 1803 | } else { |
| 1804 | response = await this.v1PrivateAccountCategoryPostOrder (request); |
| 1805 | } |
| 1806 | // |
| 1807 | // spot |
| 1808 | // |
| 1809 | // { |
| 1810 | // "code":0, |
| 1811 | // "data": { |
| 1812 | // "accountId":"cshwT8RKojkT1HoaA5UdeimR2SrmHG2I", |
| 1813 | // "ac":"CASH", |
| 1814 | // "action":"place-order", |
| 1815 | // "status":"Ack", |
| 1816 | // "info": { |
| 1817 | // "symbol":"TRX/USDT", |
| 1818 | // "orderType":"StopLimit", |
| 1819 | // "timestamp":1654290662172, |
| 1820 | // "id":"", |
| 1821 | // "orderId":"a1812b6840ddU8191168955av0k6Eyhj" |
| 1822 | // } |
| 1823 | // } |
| 1824 | // } |
| 1825 | // |
| 1826 | // swap |
| 1827 | // |
| 1828 | // { |
| 1829 | // "code":0, |
| 1830 | // "data": { |
| 1831 | // "meta": { |
| 1832 | // "id":"", |
| 1833 | // "action":"place-order", |
| 1834 | // "respInst":"ACK" |
| 1835 | // }, |
| 1836 | // "order": { |
| 1837 | // "ac":"FUTURES", |
| 1838 | // "accountId":"futwT8RKojkT1HoaA5UdeimR2SrmHG2I", |
| 1839 | // "time":1654290969965, |
| 1840 | // "orderId":"a1812b6cf322U8191168955oJamfTh7b", |
| 1841 | // "seqNum":-1, |
| 1842 | // "orderType":"StopLimit", |
| 1843 | // "execInst":"NULL_VAL", |
| 1844 | // "side":"Buy", |
| 1845 | // "symbol":"TRX-PERP", |
| 1846 | // "price":"0.083", |
| 1847 | // "orderQty":"1", |
| 1848 | // "stopPrice":"0.082", |
| 1849 | // "stopBy":"ref-px", |
| 1850 | // "status":"Ack", |
| 1851 | // "lastExecTime":1654290969965, |
| 1852 | // "lastQty":"0", |
nothing calls this directly
no test coverage detected