ccxt 4.1.91__py2.py3-none-any.whl → 4.1.95__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ccxt/coinbase.py CHANGED
@@ -207,6 +207,8 @@ class coinbase(Exchange, ImplicitAPI):
207
207
  'brokerage/products/{product_id}',
208
208
  'brokerage/products/{product_id}/candles',
209
209
  'brokerage/products/{product_id}/ticker',
210
+ 'brokerage/portfolios',
211
+ 'brokerage/portfolios/{portfolio_uuid}',
210
212
  'brokerage/transaction_summary',
211
213
  'brokerage/product_book',
212
214
  'brokerage/best_bid_ask',
@@ -218,9 +220,17 @@ class coinbase(Exchange, ImplicitAPI):
218
220
  'brokerage/orders/batch_cancel',
219
221
  'brokerage/orders/edit',
220
222
  'brokerage/orders/edit_preview',
223
+ 'brokerage/portfolios',
224
+ 'brokerage/portfolios/move_funds',
221
225
  'brokerage/convert/quote',
222
226
  'brokerage/convert/trade/{trade_id}',
223
227
  ],
228
+ 'put': [
229
+ 'brokerage/portfolios/{portfolio_uuid}',
230
+ ],
231
+ 'delete': [
232
+ 'brokerage/portfolios/{portfolio_uuid}',
233
+ ],
224
234
  },
225
235
  },
226
236
  },
@@ -277,6 +287,8 @@ class coinbase(Exchange, ImplicitAPI):
277
287
  'not_found': ExchangeError, # 404 Resource not found
278
288
  'rate_limit_exceeded': RateLimitExceeded, # 429 Rate limit exceeded
279
289
  'internal_server_error': ExchangeError, # 500 Internal server error
290
+ 'UNSUPPORTED_ORDER_CONFIGURATION': BadRequest,
291
+ 'INSUFFICIENT_FUND': BadRequest,
280
292
  },
281
293
  'broad': {
282
294
  'request timestamp expired': InvalidNonce, # {"errors":[{"id":"authentication_error","message":"request timestamp expired"}]}
@@ -2171,6 +2183,8 @@ class coinbase(Exchange, ImplicitAPI):
2171
2183
  params = self.omit(params, ['timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'stop_price', 'stopDirection', 'stop_direction', 'clientOrderId', 'postOnly', 'post_only', 'end_time'])
2172
2184
  response = self.v3PrivatePostBrokerageOrders(self.extend(request, params))
2173
2185
  #
2186
+ # successful order
2187
+ #
2174
2188
  # {
2175
2189
  # "success": True,
2176
2190
  # "failure_reason": "UNKNOWN_FAILURE_REASON",
@@ -2184,9 +2198,36 @@ class coinbase(Exchange, ImplicitAPI):
2184
2198
  # "order_configuration": null
2185
2199
  # }
2186
2200
  #
2201
+ # failed order
2202
+ #
2203
+ # {
2204
+ # "success": False,
2205
+ # "failure_reason": "UNKNOWN_FAILURE_REASON",
2206
+ # "order_id": "",
2207
+ # "error_response": {
2208
+ # "error": "UNSUPPORTED_ORDER_CONFIGURATION",
2209
+ # "message": "source is not enabled for trading",
2210
+ # "error_details": "",
2211
+ # "new_order_failure_reason": "UNSUPPORTED_ORDER_CONFIGURATION"
2212
+ # },
2213
+ # "order_configuration": {
2214
+ # "limit_limit_gtc": {
2215
+ # "base_size": "100",
2216
+ # "limit_price": "40000",
2217
+ # "post_only": False
2218
+ # }
2219
+ # }
2220
+ # }
2221
+ #
2187
2222
  success = self.safe_value(response, 'success')
2188
2223
  if success is not True:
2189
- raise BadRequest(self.id + ' createOrder() has failed, check your arguments and parameters')
2224
+ errorResponse = self.safe_value(response, 'error_response')
2225
+ errorTitle = self.safe_string(errorResponse, 'error')
2226
+ errorMessage = self.safe_string(errorResponse, 'message')
2227
+ if errorResponse is not None:
2228
+ self.throw_exactly_matched_exception(self.exceptions['exact'], errorTitle, errorMessage)
2229
+ self.throw_broadly_matched_exception(self.exceptions['broad'], errorTitle, errorMessage)
2230
+ raise ExchangeError(errorMessage)
2190
2231
  data = self.safe_value(response, 'success_response', {})
2191
2232
  return self.parse_order(data, market)
2192
2233