create a trade order https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#create-order :param str symbol: unified symbol of the market to create an order in :param str type: must be 'limit' :param str side: 'buy' or 'sell' :param float am
(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})
| 873 | return self.safe_balance(result) |
| 874 | |
| 875 | def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}): |
| 876 | """ |
| 877 | create a trade order |
| 878 | |
| 879 | https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#create-order |
| 880 | |
| 881 | :param str symbol: unified symbol of the market to create an order in |
| 882 | :param str type: must be 'limit' |
| 883 | :param str side: 'buy' or 'sell' |
| 884 | :param float amount: how much of currency you want to trade in units of base currency |
| 885 | :param float price: the price at which the order is to be fulfilled, in units of the quote currency |
| 886 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 887 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 888 | """ |
| 889 | self.load_markets() |
| 890 | if type == 'market': |
| 891 | raise BadRequest(self.id + ' createOrder() can only accept orders with type "limit"') |
| 892 | market = self.market(symbol) |
| 893 | request = { |
| 894 | 'market': market['id'], |
| 895 | 'side': side, |
| 896 | 'amount': self.amount_to_precision(symbol, amount), |
| 897 | 'price': self.price_to_precision(symbol, price), |
| 898 | } |
| 899 | response = self.privatePostOrderNew(self.extend(request, params)) |
| 900 | # |
| 901 | # { |
| 902 | # "success": True, |
| 903 | # "errorCode": "", |
| 904 | # "message": "", |
| 905 | # "result": { |
| 906 | # "orderId": 171906478744, # Order id |
| 907 | # "market": "ETH_BTC", # Market name |
| 908 | # "price": "0.04348", # Price |
| 909 | # "side": "buy", # Side |
| 910 | # "type": "limit", # Order type |
| 911 | # "timestamp": 1698484861.746517, # Order creation time |
| 912 | # "dealMoney": "0", # Filled total |
| 913 | # "dealStock": "0", # Filled amount |
| 914 | # "amount": "0.0277", # Original amount |
| 915 | # "takerFee": "0.002", # taker fee |
| 916 | # "makerFee": "0.002", # maker fee |
| 917 | # "left": "0.0277", # Unfilled amount |
| 918 | # "dealFee": "0" # Filled fee |
| 919 | # } |
| 920 | # } |
| 921 | # |
| 922 | result = self.safe_dict(response, 'result') |
| 923 | return self.parse_order(result, market) |
| 924 | |
| 925 | def cancel_order(self, id: str, symbol: Str = None, params={}): |
| 926 | """ |
nothing calls this directly
no test coverage detected